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

Question about AbsDot in the rendering #278

Closed deadmarston closed 4 years ago

deadmarston commented 4 years ago

Hi there,

In the rendering part, you use beta *= f * AbsDot(wi, isect.shading.n) / pdf; , I wonder why you don't use Dot since that seems to be correct value for cosTheta.

Thanks

mmp commented 4 years ago

The normal and wi may be on different sides of the surface, in which case Dot would give a negative value. (pbrt doesn't flip the normal to match wi's side, so that the normal orientation can still be used to determine if a ray is entering or exiting a surface, under the assumption that the normal points outside..)

deadmarston commented 4 years ago

Thanks:)