I’d like to ask what connection exists between frustum culling and the depth buffer.
I seem to be encountering a Unity bug, but it’s really hard to pin down.
As my camera rotates, huge chunks of transparent objects suddenly disappear. Fences disappear behind more distant hills, grass and dirt decals dissapear below the opaque terrain, but only beyond a certain distance.
What is strange is that it seems to be related to culling. Turn left a few degrees, and everything is visible, rotate slightly to the right and it all goes nuts. I have to assume this is because of large areas of terrain being culled. Does Unity do some internal depth stretching to compensate for the decreased resolution. My near and far planes are appropriately set (near not too small, far not too big).
It is surely related to the decreased resolution of Android depth buffer, but it seems to make no sense. It’s almost as if everything in the transparent queue is being rendered with different camera/depth buffer settings.
I am interested to know what is different in Unity between Android and iOS, other than simple depth precision.
Please help
Okay, for anyone that is interested, here is that solution to my problem that I found eventually.
It seems there is a bug in Unity where Offset parameters are not being reset.
So any shader used that doesnt explicitly set offset will use the previously rendered shader’s parameters.
I have submitted a bug report but I thought people might like to be aware of it.
As of writing, Unity 4.2 is the latest version and still has this bug.
I discovered that Unity on Android goes not use glPolygonOffset internally because of buggy drivers from vendors, so they manipulate the vertex shader. That is why it only happens on Android.
Hope this information helps someone.