Twinklebear/ChameleonRT

Total internal reflections appear black

natevm opened this issue · 3 comments

With the current Disney BRDF implementation, invalid refractions are terminated.

if (all_zero(w_i)) {

However, I believe these events should instead be interpreted as reflections. I’ve found that by reflecting at invalid refractions, and by setting the pdf value to 1 instead of 0 and by returning a color of 1 instead of 0, this causes total internal reflection areas within my objects to become lit instead of just dark.

Some before vs after:

1CDCC2AA-FD1F-488F-931A-9FB1C7A8AC65

7CDC564E-6FC4-4749-BB82-4614B57B3E08

Note that for transmissive objects, there are a couple bugs I’ve found. This one should be a pretty easy fix though.

In the above images, I’ve hard coded the PDF associated with transmission to 1, and have also hard coded the transmissive BRDF to return the mat.base_color, without D, G, 1-F or c being multiplied. I’m not sure why, but none of these values seem to return plausible values. Once I figure those out, I can open some more issues.

Interesting, I think I did at one point have it change to reflection for total internal refraction, but was getting some odd fireflies as a result. Maybe due to some other bugs in computing D, G, F, c that you've tweaked there