Wrong z-order of layers during 3d rendering

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
Post Reply
evg64
Gnoblar
Posts: 1
Joined: Tue Jun 03, 2014 2:36 pm

Wrong z-order of layers during 3d rendering

Post by evg64 »

Our android app, apart from other functionality, allows user to watch 3d. We use ogre3d to render 3d models. It works fine on Nexus 10, but doesnt work on Nexus 7.

What exactly is not ok? - Layers on 3d models are rendered in improper order (z-value of given layer is improper). Moreover, if I rotate the model, z-values of different layers change dynamically (thus, one layer overlays another at some moment and vice versa at the next moment).

I wonder what can be the problem. Is it hardware or software? Is it problem with ogre or Nexus 7 missing some video codecs? Or another problem I'm not aware of..
robert82h
Gnoblar
Posts: 23
Joined: Thu Jun 13, 2013 5:41 pm
x 7

Re: Wrong z-order of layers during 3d rendering

Post by robert82h »

Working on the same codebase as evg64, I was able to solve this issue. It's a problem with Z buffer precision. Initially, we had near and far clipping plane at 0.01 and 1e6. We already tried lowering far to 10, but that didn't help. After some more hours of debugging, discovering bug https://ogre3d.atlassian.net/browse/OGRE-417 on the way, I finally tried to *increase* the near plane from 0.01 to 1, which instantly resolved the issue.

I can even increase the far plane to insanely high values like 50.000 now without (serious) Z buffering issues. FAQ article 12.040 at http://www.opengl.org/archives/resource ... buffer.htm explains how having the near plane close to zero dramatically impacts depth buffer precision.
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Wrong z-order of layers during 3d rendering

Post by c6burns »

Interesting, OGRE-417 could explain the z buffer issues I have with later adreno series!
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Wrong z-order of layers during 3d rendering

Post by c6burns »

Robert, you rock for creating that JIRA. Even though I spent some time scratching my head before figuring it out ... it was a lot less time scratching than I would have spent. Thanks!
robert82h
Gnoblar
Posts: 23
Joined: Thu Jun 13, 2013 5:41 pm
x 7

Re: Wrong z-order of layers during 3d rendering

Post by robert82h »

Thanks :mrgreen:
Let's put the depth buffer precision calculator you posted on the bug tracker here as well for any fellows with Z buffer precision issues on Android devices: http://www.sjbaker.org/steve/omniv/love ... uffer.html
Post Reply