Fix MIS bugs

This commit is contained in:
hal8174 2025-01-08 22:31:57 +01:00
parent 27ea5c5d93
commit 908efa79c2
5 changed files with 33 additions and 15 deletions

View file

@ -91,9 +91,14 @@ impl<R: Rng + 'static> ExampleScene<R> for MISTest<R> {
let area = light_offset * light_offset * 4.0;
let material_offset = materials.len() as u32;
materials.push(BVHMaterial::new_light(AreaLight::new(
Color::white() * 10.0 / area,
)));
let color = match i % 3 {
0 => Color::new(1.0, 0.0, 0.0),
1 => Color::new(0.0, 1.0, 0.0),
2 => Color::new(0.0, 0.0, 1.0),
_ => unreachable!(),
};
materials.push(BVHMaterial::new_light(AreaLight::new(color * 10.0 / area)));
triangles.extend_from_slice(&[
Triangle::new(