diff --git a/src/lib.rs b/src/lib.rs index 7376d38..d3713d7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -373,17 +373,20 @@ impl Core { total_cd * args.accum_scale } }; + let colormap = |light: f32| { + let brightness = 3. * (1. - (1. + light).recip()); + vec3(brightness, brightness - 1., brightness - 2.) + .clamp(Vec3::splat(0.), Vec3::splat(1.)) + }; let mut camera_ray_display: Vec = Vec::with_capacity(camera_rays.len()); if args.show_light { + let r = args.accum_sigma; for ray in camera_rays { let Some(hit) = scene.trace_ray(ray) else { continue; }; let light = light_at(hit); - let brightness = 3. * (1. - (1. + light).recip()); - let r = args.accum_sigma; - let color = vec3(brightness, brightness - 1., brightness - 2.) - .clamp(Vec3::splat(0.), Vec3::splat(1.)); + let color = colormap(light); let vertex = |off: Vec3| Vertex { pos: hit.incident.base + r * off, color,