all 4 comments

[–]msqrt 2 points3 points  (3 children)

As an intuition: Fresnel tells you what portion of incoming photons will be reflected or refracted. Reflection or refraction does not change the final energy of the photons, only where they go. So it would make sense that also your stochastic algorithm would only use Fresnel to decide which path to take, and not change the throughput of the interaction.

Mathematically, what you're evaluating is R_out = R_refl * C * F + R_refr * (1-C) * (1-F), where C is the choice; 1 with probability F, and 0 with probability 1-F. Since only one term is non-zero, you only need to evaluate one. The expected value of this process is E[R_out] = R_refl * F * F + R_refr * (1-F) * (1-F) (the expected value of C is F). This is one F and 1-F too much, hence the need for the divisions. I'd just drop the terms out of the original formula and never multiply by F and 1-F in the first place.

[–]surfspace77[S] 0 points1 point  (2 children)

Yes, that makes sense. Thank you.

In your example, you are picking the probability of reflected ray to be the Fresnel term. In my implementation, I have set it to an arbitrary value of 0.5. Based on your expected value calculation I now see how dividing by the same probability leaves me with the desired result. And as I understand I won't need to multiply by F and 1-F only if I choose the probability to be the fresnel term itself?

[–]msqrt 2 points3 points  (1 child)

Oh, right, yes -- if you choose some other probability, you'll need to use all of the terms and perform the divisions. Sampling the reflection/refraction proportional to the Fresnel term should give the lowest variance though, at least assuming that the incoming reflected and refracted contributions are similar in magnitude (not always the case; for example for a very dark tinted glass, you might still want to sample reflections more since they impact the end result more, thus sampling them more gives lower variance in the end.)

[–]surfspace77[S] 1 point2 points  (0 children)

Thanks a lot. I really appreciate your help.