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

I'm confused at some codes,again. #170

Closed zq317157782 closed 6 years ago

zq317157782 commented 6 years ago

I'm reading the VolPathIntegrator and around line 79: if (ray.medium) beta *= ray.medium->Sample(ray, sampler, arena, &mi); but I found there is no PhaseFunc's value and it's PDF here ,is it implicitly included here?Just because PhaseFunc div PDF equals one? I'm confused at here. Thanks.

Immocat commented 6 years ago

I think there is no problem with the code. I suggest going into the details on page 891-894 and also page 901-903, pbrt v3.

When a ray hits a surface and the ray is in a medium, we need to sample a MediumInteraction. In medium->Sample, we only account for sample the distance. If we successfully sample a MediumInteraction(mi.IsValid() is true), the direct illumination, including phase function and pdf, are handled mainly by UniformSampleOneLight() in at page 902, pbrt v3.

zq317157782 commented 6 years ago

Thanks!