Game Development Community

Using PNG and TGA for transparency

by Andy Hawkins · in Technical Issues · 07/19/2005 (9:47 pm) · 18 replies

How do I set up an object with transparent sections using PNG's and TGA. I tried loaded the texture into the color change in Lightwave, exported as DTS and loaded into ShowToolPro and I can't see the transparent bits. I tried both PNG and TGA's with alpha channels.

Also, by doing this I'm trying to mask out parts to show through glowing windows. So the PNG / TGA masks a colour map, and underneath I want say a cube that is full-bright. The effect is a diffuse object with glowing windows underneath.

Having the problem of the PNG/ TGA not working is hampering my progress. Is there a better way?

#1
07/20/2005 (9:21 am)
Just out of curiosity what did you use to make the alpha mask? Photoshop does wierd things with alpha masks, I had no idea for the longest time I was outputting alpha blends instead of masks. :)

Just one idea.
#2
07/20/2005 (4:27 pm)
Yep I used Photoshop. Maybe that's the problem? I'll try again using GIMP
#3
07/20/2005 (4:47 pm)
Depending on what version of Photoshop you have, use the SuperPNG export plugin. It's free. I know Joe has it on his site, not sure what the link is, but it's called "SuperPNG"
#4
07/27/2005 (9:04 pm)
I found it better when using photoshop to use Save for the web feature, and set the PNG to 8bit or 24bit and check box the transparency, works everytime!
#5
07/27/2005 (9:08 pm)
Ummmmmmm, Easeyist way to make an Alpha in a PNG with photoshop......

Just make sure the areas you want to have an alpha, show the Grey and white checkord board(In PS), then save as PNG...done.
#6
07/28/2005 (9:14 am)
Pat is right. An older version of the SuperPNG plugin for Photoshop will allow you to properly export pngs with alpha channels. The plugin is available on Joe's site here. I don't believe newer versions of the plugin deal with alpha properly, unless this has changed recently.

One note... you will have a problem reloading the png back into Photoshop and retaining the alpha information unless you remove the default PNG file format module from Photoshop XX\Plug-Ins\Adobe Photoshop Only\File Formats. Otherwise that's the one Photoshop tries to use to open it, leaving you with no alpha channel, but transparency in your layer.

This was covered here.


Russell Fincher
Lead Artist | Co-owner
Sickhead Games
#7
07/28/2005 (2:37 pm)
I dont understand what you need a plugin for.
#8
07/28/2005 (2:42 pm)
Because not every version of Photoshop is handling PNG's the same way.

There was a discrepancy with the way the spec was being handled previously, so some newer versions of variuos software packages no longer deal with PNG the way they did previously.

For these users, certain aspects of how it was handled before are crucial to getting the proper effects in-game... thus the SuperPNG plugin.

IIRC> ~=\
#9
07/28/2005 (2:51 pm)
I have never seen, or heard about anything like this before. I have been using photoshop for years.. I now use CS.

Is it the case, that what your trying to say is. That its Torque that is expecting PNG to be a certain way, but Curent versions of photoshop are not creating the same type of PNG that its expecting (Becouse of old image libarys)?

It was my understanding that PNG format hasn't changed sence its creation, but *Shrug*, ok.

I guess ill see if CS also has this effect.
#10
07/28/2005 (3:39 pm)
Okay, how about if I don't have Photoshop? I use GIMP for photoshop type layered work at home.

Alright got it sorted. I found both 24 and 32 bit png's worked. But I forgot about / discovered that Lightwave has to have the same image (png) in the Transparency layer with at least 1% transparency for Torque to pick up the materal as Transclucent and do the right thing with the png.

Thanks for everyone's help.

So in short it wasn't the png that was the problem, it was Lightwave outputting the material incorrectly.

Andy H.
#11
07/28/2005 (6:10 pm)
Thats a good tip to know =) Thanks
#12
11/24/2006 (8:32 pm)
If you don't have Photoshop there are a number of alternate options, in fact sometimes better even if you do have the means to use and the time to learn PS.

the GIMP is free (www.gimp.org)
Artweaver is free (www.artweaver.de)
Project Dogwaffle comes in several forms, including a freeware version, and supports Targa with 32-bit and Alpha (www.thebest3d.com/dogwaffle/free)


Others that come to mind are PS Elements, PSP, Pixarra TwistedBrush. Find more at
www.thebest3d.com/dogwaffle/links
#13
11/26/2006 (8:34 am)
Hey All,
I am also having problems with Alpha transparency in Paint Shop Pro X :(
I cant seem to get the SuperPNG plugin to work...its in the directory, just PSP cant seem to find it....strange.
but anyway...

The problem is that the png doesnt save the Alpha channel when i reopen the image.
All other apps. like MS3D and Unwrap3d hold the transparency, but Show Tool Pro doesn't.
Any ideas?

you can find the screenies of my settings here and here.

And you can find a copy of the png here

Thanks for the help :)
#14
11/26/2006 (8:43 am)
I have used earlier versions of PSP, check the tutorial with PD Particles + PSP in here somewhere:
www.thebest3d.com/pdp/tutorials

hope it helps
#15
11/26/2006 (9:12 am)
@metalliandy: are you confusing PhotoShop with Paint Shop Pro?? I've run Paint Shop Pro for a bit and haven't had issues with transparency?? The SuperPNG plugin is a PhotoShop plugin...and wouldn't necessarily work in Paint Shop Pro...

I just run the file thru the Optimizer button and set the transparency thru Single Color transparency...choose the Areas that match this color...the Wizard I think only confuses the issue, wants to know Web based background... Or fiddle with Alpha layers and such if you need to.

HHHmm.....I just looked at a shape in ShowToolPro, textured with your supplied material. Worked fine, in fact a better masking than my method, looks like you used a true Alpha channel. I did have to let my exporter know about the material's translucent parameter...eh.
#16
11/26/2006 (9:50 am)
Hey again

thanks for the replys :)

@Philip Staiger

There is some good stuff there...I will be sure to check it out some more :)

@Rex
No im not confusing Photoshop with PSP..Ive been using psp since version 5...lol ;)
(I actually have Photoshop 6, but i dont like the interface that much.)
Most plugins do work with psp, as long as they are written before Adobe closed the SDK, which was around version 5.5 i think :S.
The problem was the exporter i was using didnt have a setting for transparency..so i used a different one and i found the setting :) (when you pointed out that you had to set the translucency, it clicked :) )
Thanks for the tip, i thought that the transparency would just be automatic...obviously not then..lol
Works great now :D
#17
11/26/2006 (11:17 am)
Quote:I have never seen, or heard about anything like this before. I have been using photoshop for years.. I now use CS.

Is it the case, that what your trying to say is. That its Torque that is expecting PNG to be a certain way, but Curent versions of photoshop are not creating the same type of PNG that its expecting (Becouse of old image libarys)?

TGE uses the alpha channel of the PNG for transparecny. Older versions of Photoshop allowed one to work with the alpha as a channel.. newer versions of photoshop used the transparency of a layer to determine transparency. The older super png plugin allows one to work with the alpha channel as a channel and not a layer transparency, which is much easier to work with.

it is more of a workflow issue.. I have been dealing with alpha channels for a long time (as have many others) and the workflow (and brainflow) of having this channel be the transparency channel just makes more sense.

using the current PNG in PS, you need to save it with transparency.. as in, the layer transparency will be treated as your alpha.
#18
11/26/2006 (1:32 pm)
Something for Photoshop that we do at work for PNG is using Save For Web and saving using 24bit option, this saves an extra 8bits of alpha of which Photoshop doesn't normally do.