Touching surface problem in raytracer.

Started by
3 comments, last by Hybrid 20 years ago
Got a little problem that I can''t get my head around at the moment, everytime I think I have a solution I can think of a case where it might screw up. Anyway, how do you deal with two surfaces that are touching in a raytracer, specifically when transparent objects are involved. Take this situation. You have a floor and on it is a transparent glass cube. Its sitting exactly on the floor - so the bottom of the cube is the same plane as the floor. Now a ray has entered the glass cube and is now heading towards the floor. In theory you want it to hit the bottom of the cube not the floor, and then you want it to hit the floor so you can get the colour from it. At the moment, there are many problems. Firstly the ray might hit the floor first as the floor may be stored in the world first. Even if you hit the glass cube, the next ray will start at the intersection point and due to ray/plane tests it may miss the floor simply due to floating point errors. There are some other situations that are worse... but bottom line is - how do you deal with two surfaces that are touching exactly in a raytracer with transparency. Any ideas, solutions, thoughts or anything are much appreciated. Cheers!
Advertisement
I don''t think there is a solution. The best I could think of was to have the ray hit both at the same time, and then just pretend the ray hit the object that''s closer to you, and in this case the glass cube object would be closer. It''s kind of a hack solution, but it would probably work well enough for more situations. Otherwise, I''d say just make sure no two surfaces are on the exact same plane.
In reality a cube and the floor wouldnt exist on the exact same plane so you should mimic that=)



Raymond Jacobs,

www.EDIGames.com

www.EtherealDarkness.com

Raymond Jacobs, Owner - Ethereal Darkness Interactive
www.EDIGames.com - EDIGamesCompany - @EDIGames

Aaah, the ol'' Coincident Surface Problem.

Just translate every object in your scene by a random vector of length 0.000001. That''ll fix it!

Otherwise - Bryce had this problem (as of version 3). POV has it. I don''t think anything *doesn''t*.
Thanks for the replies. I''ve thought about it loads, but as of a few hours ago, gave up on trying to solve it... Instead I shall simply make sure surfaces do not touch.

This topic is closed to new replies.

Advertisement