iDevGames Forums
Transparent textures - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: Transparent textures (/thread-3071.html)

Transparent textures - kordeul - Aug 27, 2007 12:37 AM


At the moment I'm stuck with getting transparent textures applied over a quad. What I want to do is to compose my object from various quads/polygons and use transparent textures for simulating complex layouts (I want to avoid complex polygons). Specifically - I have to parallel quads representing two wings for a biplane, both with transparent textures representing the actual wing shapes.

By using proper blend mode, I can apply textures to the quads and they are transparent. Since I need to freely rotate my object in space, I enabled depth testing. This preserves the layout of the object, but transparency depends on the order of drawing the primitives (I need to do it bottom-up to get it correct). Turning depth testing off makes the transparency work, but then my object is not properly drawn - again I need to change the order of drawing to get it correct.

I've read that transparency is not supported during depth testing, but is there a simple solution for my problem?

Transparent textures - arekkusu - Aug 27, 2007 01:15 AM

Yes. Draw your objects from back to front.

This means you need to figure out which object is in front before you draw. Since you're passing in the xyz of each object, and also the projection matrix, you've got all the info you need.

Transparent textures - kordeul - Aug 27, 2007 01:38 AM

This could be done very easily for different game objects (airplanes in my case), but it would present more problem for individual polygons representing the airplanes (wings, tail, fuselage...) - each airplane could be rotating in 3 dimensions, so it would add quite some complexity to my drawing routines - sometimes I have to draw the airplane from top, then from sides, bottom etc.

The only other way I know of is to make the polygons representing the lines more complex and applying texture without transparency over that. But in my case I'm not doing a full 3D game, just 2D with 3D airplanes, so I so complex rotations and other stuff, so I would prefer transparent bitmaps if possible?