Game Development Community

Why TGEA does not support PNG

by ChenJian · in Torque Game Engine Advanced · 06/11/2007 (2:43 am) · 5 replies

I applied a tree in TGEA, as you know, I use png files as its leaves. However, after I loaded the model, I found the png did not work. I means that the transparent parts of the png file are not transparent in TGEA.
Anyone kindly to help me out, thanks.

#1
06/11/2007 (3:08 am)
First off, that doesn't mean TGEA doesn't support PNG as it's clearly loading the bitmap.
You need to actually search the forums and find how to set the material definitions to allow alpha.
#2
06/11/2007 (3:09 am)
In TGEA you need to add a script to get alpha channels working. Make a file called materials.cs in the same folder as your texture and add this text to it. Obviously adjust the script according to your texture name, which entails changing Sor_roach to your texture name.

Quote:
new Material(sor_roach_txr)
{
mapTo = "SoR_roach.png"; // .png needed here when exported from Maya, not max though
baseTex[0] = "SoR_roach";
translucent = true;
translucentBlendOp = AddAlpha; //AddAlphha can also be LerpAlpha for a a different blending mode
};
#3
06/11/2007 (3:57 am)
Oh, thanks for your quick answer. I wonder if it is too troublesome while there is too many png files and I have to do this for every file. Anyway, thank you and this really helped me out.
#4
06/11/2007 (7:53 am)
The thing is, if you don't specify it as translucent then the alpha channel is used as the specular map instead. In general, if your using TGEA you probably want to make custom material definitions for each texture. A little bit of work goes a long way visually.
#5
06/11/2007 (5:35 pm)
En,Yes, I finally see that effect : ). Thanks for your patient help.