Skip to content

Commit

Permalink
Fix edge case in CorrectShadingNormal().
Browse files Browse the repository at this point in the history
  • Loading branch information
mmp committed Nov 17, 2016
1 parent d4b7a98 commit 494a9c2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/integrators/bdpt.cpp
Expand Up @@ -56,10 +56,10 @@ Float CorrectShadingNormal(const SurfaceInteraction &isect, const Vector3f &wo,
if (mode == TransportMode::Importance) {
Float num = AbsDot(wo, isect.shading.n) * AbsDot(wi, isect.n);
Float denom = AbsDot(wo, isect.n) * AbsDot(wi, isect.shading.n);
if (denom == 0) {
Assert(num == 0);
return 0;
}
// wi is occasionally perpendicular to isect.shading.n; this is
// fine, but we don't want to return an infinite or NaN value in
// that case.
if (denom == 0) return 0;
return num / denom;
}
else
Expand Down

0 comments on commit 494a9c2

Please sign in to comment.