mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.86k stars 1.18k forks source link

Non-zero function with zero sampling probability #281

Open joshbainbridge opened 4 years ago

joshbainbridge commented 4 years ago

I've just been having a quick look at pbrt v3, specifically how it handles shading normals with respect to light leaks. It's a very elegant solution, looks a lot like what Eric Veach describes in chapter 5 of his thesis. (I'm sure you probably mention that somewhere in the book)

It looks like to me the importance sampling does not take into account that a BxDF can have a positive value in some hemisphere, purely as a result of shading normals, which otherwise would not be the case. I'm also presuming that there is a requirement for the sampling probability to always be positive where the function is also positive.

Interested to hear if this is intentional, or if there is some detail I've overlooked. An alternative would be a mapping of any directions in the spherical wedges formed by the cross section of both normals, to the opposing wedge prior to evaluation or sampling. Although this could introduce a visible discontinuity.