Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling the flickering of overlapping planes

Tags:

scenekit

You know, when there are for example two planes in the same position, in different colors, they will start kind of battling against each other so some parts are another texture and some parts other.

I think that Scenekit's renderingOrder should fix this, but i couldn't get it to work. I gave planeA 0 for renderingOrder and planeB 1, but nothing happened.

So basically i want to have two planes in the same position, but i want another to be "dominative" so that the dominative plane will be rendered, and not the other.

like image 218
dasputin Avatar asked Jun 06 '17 08:06

dasputin


1 Answers

This is commonly referred to as Z-fighting, and has been an issue in 3D for as long as 3D has existed.

There are two basic, and not ideal, ways to deal with this, for what I currently understand of your situation:

1. Remove the plane you don't want to be seeing, until you need it, probably when the camera goes around the other side, or some other condition changes, at which point you'll need to add the plane you need, and remove the other.

2. Ever so slightly separate them in "Z space", or whatever space makes sense to push them just so slightly apart. This can be an incredibly small amount, so small that it's impossible for the viewer to perceive that the planes are not in exactly the same space.

like image 163
Confused Avatar answered Oct 13 '22 21:10

Confused