ChameleonRT icon indicating copy to clipboard operation
ChameleonRT copied to clipboard

Total internal reflections appear black

Open natevm opened this issue 5 years ago • 3 comments
trafficstars

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

https://github.com/Twinklebear/ChameleonRT/blob/19f0c0949e555866c01d5ec0d0fd32ff4e2209ab/optix/disney_bsdf.h#L421

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.

natevm avatar Jun 21 '20 01:06 natevm

Some before vs after:

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

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

natevm avatar Jun 21 '20 01:06 natevm

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.

natevm avatar Jun 21 '20 02:06 natevm

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

Twinklebear avatar Jun 21 '20 15:06 Twinklebear