Author
Topic: Object/ Polygon draw order (Read 2134 times)

Think of a plane used for the ground with a texture on it. I'm adding a 2D object on top of the ground - for example a puddle. Currently there is a lot of 'flickering' of the two objects during rendering. I'm guessing the GPU (?) can't decide what should be on top of what.

No, you can't...at least not for opaque objects. And there's no point in doing this anyway, because it won't solve your problem. The rendering order of opaque objects doesn't matter. What is in front and what is behind is determined by the zbuffer regardless of the order in which objects are being rendered. In your case, the depth buffer's accuracy isn't sufficient, which leads to common problem called z-fighting. To avoid this, you can move the two objects further apart or split rendering of the plane and the puddle by moving them into different worlds and clear the depth buffer between rendering both worlds. However, this can cause others problems if the plane is supposed to hide some objects or parts of them.Another option is to check if your depth buffer's accuracy can be increased. This is possible on Tegra and Adreno gpus. Are you using one of these?Btw: This only applies if at least one object is opaque. If the plane and the puddle are both transparent, then it's another story.

Well, then maybe it just doesn't help in this case. It helps most on far away objects, which might not apply here. If your map stays flat, it might be feasible to split rendering into two world that are using the same camera and clear the depth buffer between both world render as i suggested above.