mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.89k stars 454 forks source link

Feel confused about PDF evaluation of layered material #453

Open ckf104 opened 4 weeks ago

ckf104 commented 4 weeks ago

Equation 14.36 Gives mathematical expression of pdf value of layered material given $w_i$, $w_o$. But I can't understand why using brdf $p_r^+$ or btdf $p_t^+$ in equation, instead of using bsdf $p_s^+$.

And maybe it will be more clear to explain by code. Following code comes from PDF function of LayeredBxDF

        Float pdfSum = 0;
        if (SameHemisphere(wo, wi)) {
            auto reflFlag = BxDFReflTransFlags::Reflection;
            pdfSum += enteredTop ? nSamples * top.PDF(wo, wi, mode, reflFlag)
                                 : nSamples * bottom.PDF(wo, wi, mode, reflFlag);
        }

I feel confused why using BxDFReflTransFlags::Reflection as sampleFlags. Maybe BxDFReflTransFlags::All should be used? Since not only reflection, transmission will also be considered later.

I'd appreciate any help.