Game Development Community

Sprites with alpha masks?

by Vern Jensen · in Torque Game Builder · 06/20/2006 (7:10 pm) · 2 replies

I'm wondering if TGB supports images with alpha masks. That is, rather than all pixels of the image either being drawn 100% or not drawn at all, the alpha mask has various shades of gray that indicate the percentage of *each pixel* in the image. Whie means it's not drawn at all, black means it's drawn at full opacity, and each value inbetween is a different translucency level.

And yes, I know Torque currently supports drawing the *entire sprite* using a given drawing mode (source blend, dest blend, etc.) But what I'm talking about is loading an alpha mask that specifies on a per-pixel basis the translucency for that pixel. That way, you can have smooth edges that fade away gradually, or other nice effects.

Is this supported by TGB?

-Vern

#1
06/20/2006 (7:13 pm)
Yes. You can use the PNG format to include the alpha channel in the image map, or you can use two JPG images, one for the color and one for the alpha. I believe the jpg method is something like mainFile.jpg and mainFile.alpha.jpg.
#2
06/20/2006 (10:20 pm)
Sweet! The more I use Torque, the cooler it seems to get. :-)

If any Torque developers are reading this, you might want to mention in one of the tutorials that PNG supports alpha masks. I'm sure I read about this long ago, but it got buried the dark crevices of my mind... and I'm probably not the only one who needs a little reminder about the PNG format. :-)