diff options
author | Julian T <julian@jtle.dk> | 2021-03-07 18:25:35 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-03-07 18:25:35 +0100 |
commit | 94b14ec5a24f587c97b11d6c56b9116a58a7385a (patch) | |
tree | 7dd8f776c257b296be96dfc6ecb9c182343e70ce /src/main.rs | |
parent | 3f78cacdd93036dbd51bae77d5d8e5430a0bc75f (diff) |
Add light materials
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 9ffcac4..dc9ea43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use rendering::trace::DefaultTracer; use rendering::core::{Vector2i, Vector3f, Spectrum}; use rendering::render::{RenderContext, RenderCoord}; use rendering::sample::UniformSampler; -use rendering::material::{Reflectant, Lambertian}; +use rendering::material::*; use std::sync::Arc; @@ -15,7 +15,7 @@ fn main() { target: Vector3f::new_xyz(0.0, 0.0, -1.0), origin: Vector3f::new_xyz(1.7, 0.0, 0.3), up: Vector3f::new_xyz(0.0, 1.0, 0.0), - fov: 40.0, + fov: 60.0, filmsize: res, focus: None, aperture: Some(20.0), @@ -23,16 +23,21 @@ fn main() { let brown = Arc::new(Lambertian::new(Spectrum::new_rgb(0.5, 0.3, 0.0))); let blue = Arc::new(Lambertian::new(Spectrum::new_rgb(0.0, 0.3, 0.7))); - let metal = Arc::new(Reflectant::new(Spectrum::new_rgb(0.75, 0.75, 0.75), None)); + let metal = Arc::new(Reflectant::new(Spectrum::new_rgb(0.8, 0.8, 0.9), Some(1.0))); + let sun = Arc::new(DiffuseLight::new_white(13.0)); let mut scn = Scene::new(); scn.add_objects(vec![ - Object::new(metal, Box::new(Sphere::new(0.5, Vector3f::new_xyz(0.0, 0.0, -1.0)))), + Object::new(metal, Box::new(Sphere::new(0.2, Vector3f::new_xyz(0.0, 0.0, -1.0)))), Object::new(blue, Box::new(Sphere::new(0.5, Vector3f::new_xyz(1.0, 0.0, -1.0)))), Object::new(brown, Box::new(Sphere::new(100.0, Vector3f::new_xyz(0.0, -100.5, -1.0)))), + Object::new(sun, Box::new(Sphere::new(0.4, Vector3f::new_xyz(-1.0, 0.7, 0.0)))), ]); - let tracer = DefaultTracer::new(&scn, Some(50)); + let tracer = DefaultTracer::new(&scn, Some(50), + //Some(Box::new(SkyLight::new())) + None + ); let mut sampler = UniformSampler::new(); @@ -40,9 +45,9 @@ fn main() { let mut film = Film::new(res); { - let coord = RenderCoord::new(&mut film, Vector2i::new_xy(32, 32), 100); + let coord = RenderCoord::new(&mut film, Vector2i::new_xy(64, 64), 400); - coord.run_threaded(&ctx, &mut sampler, 4); + coord.run_threaded(&ctx, &mut sampler, 8); } let image = film.finalize_image(); |