Fixed bug that was causing spurious NaN pixels.
It was because sometimes the PDF's for a sample could be zero, leading to a divide by zero. PDF = 0.0 is now checked for.
This commit is contained in:
parent
567b658b6c
commit
993ba719d7
|
@ -392,6 +392,8 @@ impl LightPath {
|
||||||
self.wavelength,
|
self.wavelength,
|
||||||
self.time,
|
self.time,
|
||||||
isect) {
|
isect) {
|
||||||
|
// Check if pdf is zero, to avoid NaN's.
|
||||||
|
if light_pdf > 0.0 {
|
||||||
// Calculate and store the light that will be contributed
|
// Calculate and store the light that will be contributed
|
||||||
// to the film plane if the light is not in shadow.
|
// to the film plane if the light is not in shadow.
|
||||||
self.pending_color_addition = {
|
self.pending_color_addition = {
|
||||||
|
@ -419,6 +421,9 @@ impl LightPath {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
};
|
};
|
||||||
|
|
||||||
// Prepare bounce ray
|
// Prepare bounce ray
|
||||||
|
@ -433,6 +438,8 @@ impl LightPath {
|
||||||
material.sample(idata.incoming, idata.nor, (u, v), self.wavelength)
|
material.sample(idata.incoming, idata.nor, (u, v), self.wavelength)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check if pdf is zero, to avoid NaN's.
|
||||||
|
if pdf > 0.0 {
|
||||||
// Account for the additional light attenuation from
|
// Account for the additional light attenuation from
|
||||||
// this bounce
|
// this bounce
|
||||||
self.next_attentuation_fac = filter.e / pdf;
|
self.next_attentuation_fac = filter.e / pdf;
|
||||||
|
@ -445,6 +452,9 @@ impl LightPath {
|
||||||
false));
|
false));
|
||||||
|
|
||||||
true
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.next_bounce_ray = None;
|
self.next_bounce_ray = None;
|
||||||
false
|
false
|
||||||
|
|
Loading…
Reference in New Issue
Block a user