gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Inverted depth test with alpha textures?

#96953 - 0xtob - Mon Aug 07, 2006 12:01 am

While fooling around with 3D, I stumbled upon a rather nasty problem with transparent textures:

I'm using the GL_RGB32_A3 texture format that has a 5-bit paletted color + a 3-bit alpha value. I have two objects, which are just quads with a semi-transparent texture.

The problem I encounter now is that the depth test seems to be inverted for semi-transparent textures. That means if object A is before object B, object B is still in the foreground. And when object A is behind object B, object A is still in the foreground. I switched the order in which the objects are drawn, which had no effect at all.

When using a texture with non-transparent, as well as semi-transparent and fully-transparent texels, then only the semi-transparent texels show this strange behaviour.

What could be causing this? Am I getting something wrong about the DS's alpha blending?

Thanks in advance!
Tob

#96960 - omaremad - Mon Aug 07, 2006 12:16 am

The ds handles transparency diffrent from normal graphics cards

the polygonal "priority"(think of it like bg's) depends on the POLYID in the POLYFRMT

#96963 - 0xtob - Mon Aug 07, 2006 12:42 am

Cool, thanks very much, using poly-ids fixed it!

But I'm not quite sure what they are for yet. The object to which they are assigned (i.e. object A = 0 and B = 1, or A=1 and B=0) does not seem to have an effect, as long as both objects have different ids. Is that correct?

Anyway, thanks for the quick reply. This kept me figuring for hours.

#96964 - omaremad - Mon Aug 07, 2006 12:51 am

hehe no problem, i rembered this fact from an interview with the creators of resident evil deadly scilence.

I guess reading interview is useful.