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:
parent
a8324669cc
commit
543f2719e4
|
@ -276,7 +276,7 @@ impl LightPath {
|
||||||
// in shadow or not.
|
// in shadow or not.
|
||||||
// TODO: use proper ray offsets for avoiding self-shadowing
|
// TODO: use proper ray offsets for avoiding self-shadowing
|
||||||
// rather than this hacky stupid stuff.
|
// 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,
|
shadow_vec,
|
||||||
self.time,
|
self.time,
|
||||||
true);
|
true);
|
||||||
|
|
|
@ -185,7 +185,7 @@ impl SurfaceClosure for LambertClosure {
|
||||||
uv: (f32, f32),
|
uv: (f32, f32),
|
||||||
wavelength: f32)
|
wavelength: f32)
|
||||||
-> (Vector, SpectralSample, 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()
|
nor.normalized()
|
||||||
} else {
|
} else {
|
||||||
-nor.normalized()
|
-nor.normalized()
|
||||||
|
@ -199,7 +199,7 @@ impl SurfaceClosure for LambertClosure {
|
||||||
let out = zup_to_vec(dir, nn);
|
let out = zup_to_vec(dir, nn);
|
||||||
let filter = self.evaluate(inc, out, nor, wavelength);
|
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 {
|
fn evaluate(&self, inc: Vector, out: Vector, nor: Normal, wavelength: f32) -> SpectralSample {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user