Yandros
08-13-2006, 05:59 AM
I don't know how many of you use TGAs for textures, but if you ever want to and use PSP, or anything other than a pre-Adobe version of Photoshop, then you should read this.
First of all, for those who are asking, "Why use TGA? I can get transparency using a GIF and palette index 0." Well, that's true, but GIF transparency is binary, meaning a pixel is either completely opaque or completely transparent. Of course by combining that with the Renderer > transparency (alpha) value you can have an object or AI texture which has both completely and partially transparent areas, but you're still limited to only two levels of transparency. Using TGAs allows you to have 256 levels of transparency on every pixel in the texture, so you can have gradual fades from opaque to transparent, for example. I'm not going into how to do that in this post, but it's possible and not too hard to do by making a mask using gradient fills and whatnot.
All that being said, as you may guess I've been working with TGA textures lately. The iron gates which I posted at TTLG recently (still being polished up by Vigil, available very soon) use TGA textures, and in developing them with Vigil, we discovered that all the TGAs I saved through my graphics editor, PSP 7.04, had problems. The completely transparent areas were fine, but in the partially transparent areas (areas where the mask is grey rather than black or white), the base texture was lightened and became whitish. This manifests as a greyish fringe on the borders of the opaque parts, where it's supposed to be partially transparent to suggest depth and smoothness.
After doing some research, I discovered this post (http://adam.wincustomize.com/Articles.aspx?SID=59&AID=74756), titled "How dare you touch my alpha channel!" by Adam Najmanowicz. He was upset by the fact that Adobe farked this up in the recent versions of Photoshop, and so he wrote this handy tool (http://www.najmanowicz.com/temp/AlphaConv.zip) which allows you to convert from PNG to TGA. Since PSP handles transparency properly in PNG files (so long as you setup your prefs correctly), it provides a solution for those of us who use PSP and other editors that mangle TGA transparency.
Here's what you need to do once you have the AlphaConv tool:
When you have your TGA ready to go, make sure you've saved the mask to an alpha channel. Then, save it as a PNG file, making sure the alpha channel is saved too.
To do that in PSP7, Save As..., choose PNG, and then click Run Optimizer from the Save As dialog. On the Transparency tab, make sure to select Alpha channel transparency, and Existing image or layer transparency.
Then just launch the AlphaConv tool and drag the PNG file onto its window, and it will spit out a TGA file in the same directory as the PNG file.
First of all, for those who are asking, "Why use TGA? I can get transparency using a GIF and palette index 0." Well, that's true, but GIF transparency is binary, meaning a pixel is either completely opaque or completely transparent. Of course by combining that with the Renderer > transparency (alpha) value you can have an object or AI texture which has both completely and partially transparent areas, but you're still limited to only two levels of transparency. Using TGAs allows you to have 256 levels of transparency on every pixel in the texture, so you can have gradual fades from opaque to transparent, for example. I'm not going into how to do that in this post, but it's possible and not too hard to do by making a mask using gradient fills and whatnot.
All that being said, as you may guess I've been working with TGA textures lately. The iron gates which I posted at TTLG recently (still being polished up by Vigil, available very soon) use TGA textures, and in developing them with Vigil, we discovered that all the TGAs I saved through my graphics editor, PSP 7.04, had problems. The completely transparent areas were fine, but in the partially transparent areas (areas where the mask is grey rather than black or white), the base texture was lightened and became whitish. This manifests as a greyish fringe on the borders of the opaque parts, where it's supposed to be partially transparent to suggest depth and smoothness.
After doing some research, I discovered this post (http://adam.wincustomize.com/Articles.aspx?SID=59&AID=74756), titled "How dare you touch my alpha channel!" by Adam Najmanowicz. He was upset by the fact that Adobe farked this up in the recent versions of Photoshop, and so he wrote this handy tool (http://www.najmanowicz.com/temp/AlphaConv.zip) which allows you to convert from PNG to TGA. Since PSP handles transparency properly in PNG files (so long as you setup your prefs correctly), it provides a solution for those of us who use PSP and other editors that mangle TGA transparency.
Here's what you need to do once you have the AlphaConv tool:
When you have your TGA ready to go, make sure you've saved the mask to an alpha channel. Then, save it as a PNG file, making sure the alpha channel is saved too.
To do that in PSP7, Save As..., choose PNG, and then click Run Optimizer from the Save As dialog. On the Transparency tab, make sure to select Alpha channel transparency, and Existing image or layer transparency.
Then just launch the AlphaConv tool and drag the PNG file onto its window, and it will spit out a TGA file in the same directory as the PNG file.