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.time,
|
||||
isect) {
|
||||
// Check if pdf is zero, to avoid NaN's.
|
||||
if light_pdf > 0.0 {
|
||||
// Calculate and store the light that will be contributed
|
||||
// to the film plane if the light is not in shadow.
|
||||
self.pending_color_addition = {
|
||||
|
@ -419,6 +421,9 @@ impl LightPath {
|
|||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
// Prepare bounce ray
|
||||
|
@ -433,6 +438,8 @@ impl LightPath {
|
|||
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
|
||||
// this bounce
|
||||
self.next_attentuation_fac = filter.e / pdf;
|
||||
|
@ -445,6 +452,9 @@ impl LightPath {
|
|||
false));
|
||||
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} else {
|
||||
self.next_bounce_ray = None;
|
||||
false
|
||||
|
|
Loading…
Reference in New Issue
Block a user