Wrong Z Order

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Wrong Z Order

Post by Auria »

Hi,

I believe this is a known issue, but...
1) I potentially have new information to add
2) I'd like to bump it up, since I was told that mentioning "this is for SuperTuxKart" might help prioritise the issue ;) (yeah, I'm shamelessly using that ^^)

for reference, I think ticket https://sourceforge.net/tracker/?func=d ... tid=540676 is relevant.

See attached screenshots; we used to have a transparent parachute that could be attached behind karts ( now in our latest SVN it was replaced by a non-transparent one, which happens to look better so in the end we don't care very hard for that particular one, but still it's a bug :D )
The 0.6 version was using plib and displaying transparency properly. On the 0.7 development trunk, using irrLicht, there are however obvious ordering issues.

In 0.6 : Image

In 0.7 : Image


There is another spot which becomes quite problematic. We have a track with shifting sand. Z sorting issues seem to happen randomly; in my case, it seems that it's correct when I build STK in debug mode, but messed up when I build STK in release mode (no idea why).

Image

Hope this is not too painful to correct,

-- Auria
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

I have the same problem with transparent textures. Is it running in OpenGL or D3D9, it only happens for me in D3D.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Frank Dodd
Posts: 208
Joined: Sun Apr 02, 2006 9:20 pm

Post by Frank Dodd »

Have you tried it with: -

Code: Select all

smgr->getParameters()->setAttribute(scene::ALLOW_ZWRITE_ON_TRANSPARENT, true);
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Do the karts happen to be transparent as well. This might even be true only for the material setting, without actually having a transparent element. Otherwise, the rendering should usually be ok. Because solid meshes are rendered first.
Inn case both are transparent, the mentioned bug could fix the issue. But we're still testing the patch, so I cannot tell if it works any better, and when we can apply it to the library. But, also the mentioned scene parameter could help. This heavily depends on the actual mesh geometries.
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Post by Auria »

Good question Hybrid; materials are left to their default type unless we flag them as having textures with alpha; and karts in the screenshots above are mostly flat (untextured) and as such are explicitely set to solid materials type.

3DModelerMan: OpenGL, we don't use DirectX

About z buffer writes, I believe we tried both options
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

About the sand problem: Could you please post a correct screenshot as well? It's hard to tell which part is missing. However, it looks like the shadow is also clipped in this case, which means that it's not just an ordering problem. Which shaodw technique do you use?
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Post by Auria »

Correct screenshot here
Image

About shadow technique : a plane with a PNG texture on it ;)

But you're right, for this particular case it seems to be something more than Z sorting
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It looks like parts of the kart are clipped. Do you have several separate meshes for one kart? Make sure that the bboxes are correct (enable debug render and check in these cases) and that you're using Irrlicht 1.7.1
Also, do you use octree anywhere? And how do the "sandbox" and the kart meshes intersect?
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Post by Auria »

hybrid wrote:Do you have several separate meshes for one kart?
Yes, one for body, 4 for wheels, one for shadow
hybrid wrote: Make sure that the bboxes are correct (enable debug render and check in these cases)
I'll need to check that further; Joerg, who generally does the 3D parts, is currently on leave so I can't ask him whether we have debug render support for irrlicht - i'll need to check.
hybrid wrote: and that you're using Irrlicht 1.7.1
we are
hybrid wrote:
Also, do you use octree anywhere?
yes, the static bits of the track are an octree ( m_scene_manager->addOctreeSceneNode(mesh); ), others are regular scene nodes
hybrid wrote: And how do the "sandbox" and the kart meshes intersect?
Im sorry, I don't understand what you mean
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

What I meant is that the transparent sand is probably a separate mesh/meshbuffer, which is pretty huge. The kart might be completely inside the sand mesh, or intersects with it only partially. You could also play around with automatic culling setting and zbuffer settings to check why it really looks this strange.
Auria
Competition winner
Posts: 120
Joined: Wed Feb 18, 2009 1:11 am
Contact:

Post by Auria »

Indeed the shifting sand is one huge mesh; so I realize this could give trouble to the z ordering code. However, since you tell me all opaque stuff is rendered first and then the transparent ones last, this still shouldn't happen; *puzzled*
Post Reply