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.89k stars 1.19k forks source link

Sphere::Pdf does not return zero when wi points away from the sphere. #319

Open GaryHuan9 opened 2 years ago

GaryHuan9 commented 2 years ago

Thank you so much for the great book!

In chapter 14.2.2 Sampling Shapes, the second overload of Shape::Pdf returns 0 if wi does not intersect with the shape, which conceptually make sense. However, when Sphere::Pdf overrides this method, its implementation never returns 0 if the second (general sphere PDF) path is chosen, even if wi points away from the sphere. Is this a missed case in the code, or am I misunderstanding something here?