Following some documents on internet, I divide my ray tracing result by PDF. Then it seem the D and G terms disappeared. Only F term is still visible, it looks like Fresnel only.

color = D(wh) * G(wo, wi) * F / (4 * wi.z * wo.z);

pdf = D(wi) * G1(wo) * abs(dot(wo, wi)) / (abs(wo.z) * 4 * dot(wo, wh))

color / pdf looks very similar to F term. That's strange, I don't know what's wrong.

IMO, the pdf also has D and G term. If I divide the result by PDF, it's likely to neutralized the effect of D and G. But that's obviously wrong.

So, how to use the PDF in correct way. Do I have the correct form of PDF?

  • 1
    $\begingroup$ That's the point of a map with this density - to cancel out terms which may result in variance. The D and G are implicitly in the mapping function (i.e. how you sample the hemisphere). $\endgroup$ – lightxbulb Jun 10 at 13:06
  • $\begingroup$ You divide by the PDF when you are doing importance sampling, which means distributing your rays proportional to that PDF. If you just put in the division by the PDF without changing the distribution of rays to match, that wouldn't be right. $\endgroup$ – Nathan Reed Jun 10 at 21:49
  • $\begingroup$ Thanks, it's cos weighted sample. Although there are several lights, I didn't sample light directly right now. @lightxbulb $\endgroup$ – iaomw Jun 11 at 4:20
  • $\begingroup$ Why do you have G and D in the pdf if it is sampling with a cosine weighted density? You should have $\frac{\cos\theta}{\pi}$ as a pdf instead, in which case only the cosine cancels out. $\endgroup$ – lightxbulb Jun 11 at 9:02
  • $\begingroup$ Thx, I am using the TrowbridgeReitzDistribution from PBRT. It's also giving a PDF fucntion. So I tried it out. If I understand you correct, we only need to divide the PDF related to sample method(or bias), don't need to divide by the PDF from BXDF. That totally make sense. But when and how should I use the PDF from BXDF like TrowbridgeReitzDistribution. This is a bit confusing. PBRT is a bit too complex for me to finding this idea. @lightxbulb $\endgroup$ – iaomw Jun 11 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.