add basic interreflections
This commit is contained in:
parent
93c8652116
commit
a7746deec5
21
src/lib.rs
21
src/lib.rs
|
|
@ -242,6 +242,27 @@ impl Core {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
let mut hits2: Vec<Hit> = Vec::with_capacity(hits.len());
|
||||||
|
for hit in &hits {
|
||||||
|
let reflector = Lambertian;
|
||||||
|
let reflected = reflector.reflect(&mut prng, hit.normal, hit.incident.dir);
|
||||||
|
let ray = Ray::new(hit.incident.base, reflected);
|
||||||
|
let Some(hit2) = scene.trace_ray(ray) else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
hits2.push(hit2);
|
||||||
|
source_ray_display.extend([
|
||||||
|
Vertex {
|
||||||
|
pos: hit2.incident.base - 0.02 * hit2.incident.dir,
|
||||||
|
color: vec3(1., 0., 1.),
|
||||||
|
},
|
||||||
|
Vertex {
|
||||||
|
pos: hit2.incident.base,
|
||||||
|
color: vec3(1., 1., 1.),
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
hits.extend(hits2);
|
||||||
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());
|
||||||
let sigma2 = args.accum_sigma.powi(2);
|
let sigma2 = args.accum_sigma.powi(2);
|
||||||
let accum_normalizator = (2. * PI * sigma2).sqrt().recip();
|
let accum_normalizator = (2. * PI * sigma2).sqrt().recip();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user