Friday, July 15, 2016

I do have a bug

I questioned whether this was right:



I was concerned about the bright bottom and thought maybe there was a light tunnel effect.   I looked through my stuff and found a dented cube, and its bottom seemed to show total internal reflection:
The light tunnel effect might be happening and there is a little glow under the cube, but you cant see it thought the cube.   Elevating it a little does show that:

Digging out some old code and adding a cube yielded:
This is for debugging so the noise was just because I didn't run to convergence.   That does look like total internal reflection on the bottom of the cube, but the back wall is similar to the floor.   Adding a sphere makes it more obvious:
Is this right?   Probably.



4 comments:

Laura Lediaev said...

I have the same bug in my renderer, and I think I know what is happening, but I don't know the best way to fix it. A ray that enters the glass and then hits to ground will scatter as if it hit the ground coming from air. If I raise the glass box off the ground a small distance I get the correct result, so the incoming ray will then scatter as if hitting a glass to air interface. What is the best way to deal with glass-to-solid interfaces? It seems the material of the ground should have "some kind" of effect on the behavior of the scattering rays when there is no space between the glass and the ground. I'll see if I can find a physics explanation. I definitely don't want to have to adjust my scene geometry to avoid this problem.

Laura Lediaev said...

I'm now guessing that we treat the glass/ground interface as a layered material. I'll take a look at Wenzel Jokob's paper "A Comprehensive Framework for Rendering Layered Materials."

Matt said...

The "best" way I've found to counteract this issue (without doing complex volume storage as in Lux) is to store relative IOR for each hit/ray generation. It helps alleviate cases like this and glass/liquid boundaries, but adds a bit of complexity to the code.

Laura Lediaev said...

Matt, can you explain more? My program is fully aware of interfaces since I keep track overlapping and adjacent geometry (I use priority values to disambiguate). The problem is, what do I do now that I know "I am at an interface between glass and diffuse", or "glass and water". It seems that we want to simulate a very thin layer of air between the glass and the ground, but we don't when we have water and glass?