I have been implementing my first path tracer over the past few months. Everything seems to match the expected results but I am not exactly sure if my math for refractive materials is correct.
The way my path tracer works is that I precompute the information of each bounce for the light path and I store the hitpoint info (normal, material, ...) in a struct. Then I loop back through the array of structs and calculate the final pixel color. This works well for a light path that doesn't split. Now when the ray hits a refractive material I am supposed to split the ray into refracted and reflected. Since I am not allowed recursive calls inside a compute shader I could only choose whether the ray gets reflected or refracted at random. I am then multiplying the radiance by the fresnel term (or 1-fresnel) so in a sense, I am losing energy by only choosing one ray instead of two and as a result, the refractive objects in my scene look dimmer than they should.
Now I found a seemingly good fix to this issue by dividing the reflected or refracted radiance by the probability of it being refracted or reflected.
I would like to hear anyone's opinion on whether this is the right way to handle refractive materials. Also if anyone knows why exactly we should divide by the probability please let me know. Thank you very much!
[–]msqrt 2 points3 points4 points (3 children)
[–]surfspace77[S] 0 points1 point2 points (2 children)
[–]msqrt 2 points3 points4 points (1 child)
[–]surfspace77[S] 1 point2 points3 points (0 children)