Principled BSDF sampling #441
-
Hi, I am trying to understand how the principled BSDF sampling code works and I have some questions:
mitsuba3/src/bsdfs/principled.cpp Lines 378 to 387 in f3ac81b
PS: My understanding maybe incorrect as I'm trying to figure things out :) Please feel free to correct me. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
For all of your questions, I would tend to agree. But I haven't looked deep enough into the implementation/literature to be fully confident in my answer. @efylmzr off the top of your head, does this sound reasonable to you? |
Beta Was this translation helpful? Give feedback.
-
Hi @PotatoPot6676 |
Beta Was this translation helpful? Give feedback.
-
Thank you very much @njroussel and @efylmzr for the very detailed answer. Your explanation about the fact that the normalization constant should be independent of the Fresnel term helped me fix my lobe sampling probabilities :) I have some follow up questions though: How did you validate that the sampling probabilities that you used get the correct results? I went back and validated my implementation by setting all lobes to the same probability and manually comparing results against Fresnel weighted probabilities. Is there a better way to test this? Also, a question not related to sampling but the clearcoat evaluation: I'm unable to figure out where Clearcoat: mitsuba3/src/bsdfs/principled.cpp Line 640 in 8ebf3af Specular Reflection: mitsuba3/src/bsdfs/principled.cpp Line 601 in 8ebf3af |
Beta Was this translation helpful? Give feedback.
-
Hi, @PotatoPot6676 , |
Beta Was this translation helpful? Give feedback.
-
@efylmzr: Ah I see. I had assumed clearcoat to include the Thanks a lot for taking time out to respond and for all your help :) |
Beta Was this translation helpful? Give feedback.
Hi @PotatoPot6676
1- Yes, you are right,
Pr(reflection)= 1 - Pr(transmission)
. The sampling probabilities can not depend on Fresnel term in order to keep the normalization constant independent of Fresnel term. Fresnel term is a value that we get after sampling the specular lobe. If you decide to sample the diffuse lobe, you do not have any Fresnel term to calculate the normalization constant. But if you both have a specular transmission and specular reflection lobe, you can decide to sample a halfway vector based on a probability which does not depend on the Fresnel coefficient. And then, you can utilize the Fresnel term to decide between transmission or reflection. So sum of selection pr…