#### Archived

This topic is now archived and is closed to further replies.

# Touching surface problem in raytracer.

This topic is 5278 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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!

##### Share on other sites
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.

##### Share on other sites
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

##### Share on other sites
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*.

##### Share on other sites
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.

1. 1
2. 2
Rutin
21
3. 3
4. 4
frob
15
5. 5

• 9
• 13
• 9
• 33
• 13
• ### Forum Statistics

• Total Topics
632593
• Total Posts
3007281

×