Question

I'm writing an augmented reality app based on Vuforia and I'm mainly testing on a Galaxy S3, which is xhdpi (320ppi). It's been going very well, but we've just started testing on an HTC One and a Galaxy S4 (both xxhdpi--the HTC is 469ppi and the Samsung is similar). The augmentation is a fairly complex set of meshes with some lattice like elements. It seems some of the meshes are z fighting with others, but only on these very high density devices.

We've observed that the z fighting stops when we get closer to the model.

My conjecture is that the surfaces are very close together, close enough that at larger distances, the depth function's least significant bit is higher in value than the depth differential, causing the fighting. However, I can't see why this would only happen on xxhdpi devices.

Is my conjecture correct? Can I increase the precision to fix it if so, or is that a hardware constraint? Given the polygons shouldn't actually be coincident, and don't seem to be exhibiting this behaviour on other devices, would something like glPolygonOffset help with this? Are there other methods I could use?

Was it helpful?

Solution

Setting the depth buffer from 16 bits to 24 bits fixed this.

The relevant method for Android is GLSurfaceView#setEGLConfigChooser(int, int, int, int, int, int)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top