Monday, July 03, 2006

More Refraction Goodness

Well friends I got totally worked up tonight because I spent a while trying to get Refraction correct in my Raytracer, and I have been very careful with CVS up until this point to make sure I check my files into my CVS directory when I get to a specific goal... hehe today I thought I had copied over the refraction code that I spent soooo long trying to fix. Ohhhh man!!

I flipped out for a while, changing negative signs back and forth, and couldn't for the life of me figure out how to fix it.

Anyhow, turns out I had just changed my scene file to have a different index of refraction and it WAS working all along. Crazy!!! :) Hehe I think this means I need to take a break from this. :)

So after all that commotion, things are back to where they were. Looks like an index of refraction of 1.0/1.33 (water) gives a lot of TIR (Total Internal Reflection)... note the black colour inside the sphere. But it looks like values more like 1.52 (for glass) give me a much nicer refraction. Good times. I still am not totally sure if this is correct (it sure is hard to tell) but hopefully this is much closer now that I am doing the "right stuff" when I enter and exit a surface. Booyah.


Refraction with lots of Total Internal Reflection going on


Refraction fixed with an index of 1.52


Refraction with a bit of reflection too

No comments: