- Home /
Leaks between planes with different material
Is there a way to avoid those small leaks between different objects in level geometry? Even if planes are snapped perfectly together, I can see some pixels displaying skybox at the edges of them. Usually it happens with objects with different materials(texture atlases). What is causing this? Any ideas?
Answer by Jesse Anders · Jun 17, 2011 at 05:50 PM
Also, keep in mind that objects that in theory should be snapped 'perfectly' together may in fact not match exactly at the seams. For example, if your planes are subject to arbitrary transforms, numerical error will likely result in 'sparklies' or other artifacts where the planes meet.
A reliable solution is to use a procedurally generated mesh (or multiple meshes), although that's a little more involved than using individual transformed game objects.
Answer by Bunny83 · Jun 17, 2011 at 11:29 AM
In most cases it's a problem with the depthbuffer resolution.
The resolution can be determined by dividing Camera.farClipPlane(1000) by Camera.nearClipPlane(0.3).
The endresult that is stored in the depthbuffer is mapped between 0..1 but the greater the viewingfrustum is the more inaccurate the depth value get. You could try to increase the near value and decrease the far value (to fit your needs).
Another way, which is not possible in a lot cases, would be to let the objects overlap a little bit. Something like 0.00001 should be enough.
Different materials shouldn't be a problem since it depends only on the geometry.
Your answer
![](https://koobas.hobune.stream/wayback/20220612110830im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Snapping models 3 Answers
Editor Script - Access the User's Snap Settings? 1 Answer
iOS - Save Screenshot, Load as Texture? 1 Answer
Snapping a picked up object into a slot/space 0 Answers
Rotational Surface Snap in Unity Editor? 0 Answers