Two quads, same position, which one is seen ahead?

Hi all, lets say I have two quads at the same position with a sprite in them as texture. Is there any way you can identify which one will be seen on top of the other from an orthographic camera?

No, because if they have the same position you will experience something called z-fighting. This happens because the GPU uses a depth-buffer in which it stores a depth value for each pixel. Due to floating point inaccuracy two objects that are at the same point (or almost at the same) will be “fighting” for each pixel. Some will belong to the one some to the other.


If you use a shader that doesn’t write to the depth buffer (like most transparent shaders) the order is given simply by the render order. The Render order might depend on the shader you use on each object and by the internal render order which can’t be changed directly. Shaders can define a (Render)Queue tag value to partially control the order in which they are drawn.

If the two quads are part of the same mesh, it only depends on the order of the triangles within the Mesh itself. Again, keep in mind that’s only true for shaders that don’t use the depth buffer. All other shaders are based on the depth buffer.