Compare commits

...

1 Commits

Author SHA1 Message Date
Matthew Gordon 59be110a55 Glass bunny scene 2025-03-29 16:04:54 -03:00
2 changed files with 38 additions and 15 deletions

View File

@ -55,11 +55,11 @@ impl Integrator for SimpleRandomIntegrator {
}
pub fn test_lighting_environment(w_o: &Vec3<f64>, wavelength: f64) -> f64 {
//let sun_direction = Vec3::new(1.0, 1.0, -1.0).normalize();
//if w_o.dot(&sun_direction) >= 0.99 {
// 300.0
//} else {
let sun_direction = Vec3::new(1.0, 1.0, -1.0).normalize();
if w_o.dot(&sun_direction) >= 0.99 {
300.0
} else {
let sky_colour = ColourRgbF::new(w_o.y(), w_o.y(), 1.0);
Spectrum::reflection_from_linear_rgb(&sky_colour).intensity_at_wavelength(wavelength)
//}
}
}

View File

@ -16,7 +16,7 @@ use std::time::Duration;
use vanrijn::accumulation_buffer::AccumulationBuffer;
use vanrijn::colour::{ColourRgbF, NamedColour, Spectrum};
use vanrijn::image::{ClampingToneMapper, ImageRgbU8};
use vanrijn::materials::LambertianMaterial;
use vanrijn::materials::{LambertianMaterial, SmoothTransparentDialectric};
use vanrijn::math::Vec3;
use vanrijn::mesh::load_obj;
use vanrijn::partial_render_scene;
@ -122,13 +122,16 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Loading object...");
let mut model_object = load_obj(
&model_file_path,
Arc::new(LambertianMaterial {
colour: Spectrum::reflection_from_linear_rgb(&ColourRgbF::from_named(
NamedColour::Yellow,
//Arc::new(LambertianMaterial {
// colour: Spectrum::reflection_from_linear_rgb(&ColourRgbF::from_named(
// NamedColour::Yellow,
// )),
// diffuse_strength: 0.05,
// //reflection_strength: 0.9,
//}),
Arc::new(SmoothTransparentDialectric::new(
Spectrum::diamond_index_of_refraction(),
)),
diffuse_strength: 0.05,
//reflection_strength: 0.9,
}),
)?;
println!("Building BVH...");
let model_bvh: Box<dyn Primitive> =
@ -149,6 +152,26 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
diffuse_strength: 0.1,
}),
)) as Box<dyn Primitive>,
Box::new(Plane::new(
Vec3::new(1.0, 0.0, 0.0),
-6.0,
Arc::new(LambertianMaterial {
colour: Spectrum::reflection_from_linear_rgb(&ColourRgbF::new(
0.55, 0.27, 0.04,
)),
diffuse_strength: 0.1,
}),
)),
Box::new(Plane::new(
Vec3::new(0.0, 0.0, 1.0),
12.0,
Arc::new(LambertianMaterial {
colour: Spectrum::reflection_from_linear_rgb(&ColourRgbF::new(
0.55, 0.27, 0.04,
)),
diffuse_strength: 0.1,
}),
)),
Box::new(Sphere::new(
Vec3::new(-6.25, -0.5, 1.0),
1.0,