split colormap
This commit is contained in:
parent
722e5d4b6e
commit
41579bbb5d
11
src/lib.rs
11
src/lib.rs
|
|
@ -373,17 +373,20 @@ impl Core {
|
||||||
total_cd * args.accum_scale
|
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<Vertex> = Vec::with_capacity(camera_rays.len());
|
let mut camera_ray_display: Vec<Vertex> = Vec::with_capacity(camera_rays.len());
|
||||||
if args.show_light {
|
if args.show_light {
|
||||||
|
let r = args.accum_sigma;
|
||||||
for ray in camera_rays {
|
for ray in camera_rays {
|
||||||
let Some(hit) = scene.trace_ray(ray) else {
|
let Some(hit) = scene.trace_ray(ray) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let light = light_at(hit);
|
let light = light_at(hit);
|
||||||
let brightness = 3. * (1. - (1. + light).recip());
|
let color = colormap(light);
|
||||||
let r = args.accum_sigma;
|
|
||||||
let color = vec3(brightness, brightness - 1., brightness - 2.)
|
|
||||||
.clamp(Vec3::splat(0.), Vec3::splat(1.));
|
|
||||||
let vertex = |off: Vec3| Vertex {
|
let vertex = |off: Vec3| Vertex {
|
||||||
pos: hit.incident.base + r * off,
|
pos: hit.incident.base + r * off,
|
||||||
color,
|
color,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user