Game Development Community

Having trouble getting transparency working properly

by Bryce · in Torque Game Engine · 12/24/2009 (3:06 pm) · 6 replies

Hello everyone,

I've created a nice looking ghillie suit sniper model in milkshape by adding cylinder shapes over the limbs and applying a "leaf" texture with an alpha channel. This is what I've got working in Milkshape:

img36.imageshack.us/img36/9559/alphacorrect.jpg
It displays properly there. However, when I exported it, it looks like this in-game:

img695.imageshack.us/img695/6247/alphaproblem.jpg
It doesn't correctly render the leaf texture in front, however, it renders it around the back edges...I'm not sure what's causing this, I also tried reversing the vertex order in Milkshape, but that didn't help.

Here's a link to the file, would somebody be willing to take a look?
www.mediafire.com/?zuolcmmx4mx

Thanks,
Bryce

#1
12/28/2009 (2:12 pm)
Yeah, that looks pretty weird... I remember having some similar problems with .tga type files with RGBa values but once I converted them to .png that problem stopped, I'm sure there is a thread about this problem somewhere.

Btw: awesome looking ghillie suit!
#2
12/28/2009 (2:35 pm)
I'm using GIMP...all I did was take the default grass1 foliage texture, clone it so it fills the edges, and set the alpha threshold so it would look more like leaves and less like smudges.

img27.imageshack.us/img27/3513/camopattern1.png
That's the texture I use. I can't tell if this is an engine issue or something wrong with the way PNGs are exported from GIMP...
#3
12/28/2009 (3:05 pm)
Ok. Based on this picture, what I've figured out is that the main body shape is being drawn over the transparent leaf texture.

img704.imageshack.us/img704/4900/twolegs.jpg
Somehow, the leaf texture needs to be drawn over the main body shape. Depth sorting rings a bell, but if I knew how it worked I'd be a bit better off...
#4
12/28/2009 (3:18 pm)
Ok, I've tried searching up some threads and trying some of the my own ideas but havnt had any success either...

Here's one of the more informative threads:
www.torquepowered.com/community/forums/viewthread/31187
#5
12/28/2009 (3:18 pm)
tdn.garagegames.com/wiki/DTS/3dsmax/Z_Sorting_Explained

this is mostly for 3ds max, but may help.
#6
12/28/2009 (3:37 pm)
This is a complex, animated shape, so sorting isn't an option...Sounds as simple as "draw the main body first, then draw the leaf shapes OVER it", but it never is. Or am I totally missing something here?