Z-fighting on ARM device + Depth Buffer question

Started by Aisaaax, March 03, 2020, 04:47:07

Previous topic - Next topic

Aisaaax

So the way my scene goes is that I have a large "infinite" plane, and a car driving over it. The car "drags" polygons behind itself, that are supposed to kind of paint over the ground.

Now the way I approached it initially is offsetting the polygons slightly, so they are painted "above" the main surface. I should add that there're multiple layers to that.

It works fine on PC. On ARM device, they start to Z-fight unless I offset them even further. Which is actually rather strange, because when creating the context I make sure that Depth buffer of a chosen FrameBuffer config is the same - 24 bits on both PC and ARM. But they are still fighting for some reason.

This got me thinking, maybe I'm doing it wrong to begin with? Maybe instead of offsetting them and relying on the Z-buffer, I can instead to somehow tell the GPU to first paint the "top" level polygon, then paint the level below it, ignoring the already covered fragments, etc?

I don't have a good grasp on how this works, could anyone help me please?