Fixed bugs in global illumination.

It was a stupid thing in the Lambert closure.  It was returning
the wrong direction vector.
This commit is contained in:
Nathan Vegdahl 2016-07-04 11:54:46 -07:00
parent a8324669cc
commit 543f2719e4
2 changed files with 3 additions and 3 deletions

View File

@ -276,7 +276,7 @@ impl LightPath {
// in shadow or not.
// TODO: use proper ray offsets for avoiding self-shadowing
// rather than this hacky stupid stuff.
*ray = Ray::new(pos + shadow_vec.normalized() * 0.0001,
*ray = Ray::new(pos + shadow_vec.normalized() * 0.001,
shadow_vec,
self.time,
true);

View File

@ -185,7 +185,7 @@ impl SurfaceClosure for LambertClosure {
uv: (f32, f32),
wavelength: f32)
-> (Vector, SpectralSample, f32) {
let nn = if dot(nor.into_vector().normalized(), inc.normalized()) <= 0.0 {
let nn = if dot(nor.into_vector(), inc) <= 0.0 {
nor.normalized()
} else {
-nor.normalized()
@ -199,7 +199,7 @@ impl SurfaceClosure for LambertClosure {
let out = zup_to_vec(dir, nn);
let filter = self.evaluate(inc, out, nor, wavelength);
(dir, filter, pdf)
(out, filter, pdf)
}
fn evaluate(&self, inc: Vector, out: Vector, nor: Normal, wavelength: f32) -> SpectralSample {