I have a mesh separated by 0.0001 f to avoid z-fighting
in a windows build it works correctly and does not display z-fighting bugs
on an android build it displays z-fighting
if i change the distance to 0.001f, now it works on android correctly
unless i zoom out, then it starts z-fighting when i zoom out enough
to fix for that zoom lvl i have to adjust the distance again to 0.01f
is this just an inevitable floating point inaccuracy that happens on android or is there some other problem, or is there a more practical way to avoid this?
Pretty much. IIRC it was because the bitdepth of the z-buffer in Android was lower. Look in the Player settings (I think under Other Settings?) and there might be a checkmark to go to 32-bit depth buffers… it’s been years since I looked in there and this computer doesn’t have the Android toolchain on it so I can’t really check rn.
If you do check that box I’m sure there may be some associated penalty or cost, either trivial or substantial. If it is a problem, but the profiler to see what you might do about it, if anything.
As Kurt said on some devices the depth buffer may only have 16 bits. Also depth and stencil buffer usually share the same memory.
To improve the depth resolution you can also increase the camera’s near clipping plane as much as possible and reduce the far clipping plane as much as possible / feasible. The smaller the near clipping plane the less resolution you get. Note that even small changes in the near clipping plane distance can already have a huge effect because the depth buffer is not linear. You get most of the resolution close to the camera.