Fix hopefully last nan for iridescent material

This commit is contained in:
hal8174 2025-05-28 19:08:38 +02:00
parent b1351747b7
commit 86d009fb4c
Signed by: hal8174
SSH key fingerprint: SHA256:JwuqS+eVfISfKr+DkDQ6NWAbGd1jFAHkPpCM1yCnlTs
3 changed files with 84 additions and 64 deletions

View file

@ -51,9 +51,13 @@ fn render_image<
for _ in 0..samples_per_pixel {
let r =
renderer.render_pixel(scene, camera, x, y, &mut rng) / (samples_per_pixel as Float);
c[0] += r.r();
c[1] += r.g();
c[2] += r.b();
if r.r().is_nan() || r.g().is_nan() || r.b().is_nan() {
eprintln!("NAN x: {:?}, y: {:?}, r: {:?}", x, y, r);
} else {
c[0] += r.r();
c[1] += r.g();
c[2] += r.b();
}
}
});
println!("Rendered \"{}\" in {:?}", name.as_ref(), start.elapsed());