Game Development Community

Photoshop + PNG + alpha = aaarrrrgh!

by Fenrir Wolf · in Artist Corner · 06/09/2004 (9:55 am) · 17 replies

Adobe, how I wish to kill thee...

Has anyone had any success in getting textures with alpha channels made with Photoshop to work in Torque?

Photoshop 7.0 seems to be really picky on how it handles alpha channels. 4-channel Targas work fine. I have an alpha channel, they export with this channel. I load up a TGA with an alpha channel, and magically it loads the alpha channel.

But PNGs...Oy! I can't even get SuperPNG to work. It only exports layer transparency. It completely ignores the alpha channel. This is useless to me, because I want to control effects in Torque using a seperate channel, NOT the general transparency of a layer. (If I load the Orc skin up, SuperPNG appearently merges the alpha map into the first layer, instead of leaving it as a seperate channel. So the only thing visible is his armor, but the rest is completely transparent.)

I keep hearing that PSP handles PNGs just fine, but I downloaded the demo for version 8 and half the time when I try to save a PNG it says, "Error writing the file." No other explanation of what's wrong, and I get a corrupt PNG.

I'm experimenting with using TGAs converted to PNGs via ImageMagick, but last night it didn't seem to work. I'll give it another go when I get home from work.

ARGH! Any clues?

#1
06/09/2004 (10:15 am)
Get the old Photoshop 5 PNG plugin that will work just fine in PS7 and will give you the right result
#2
06/09/2004 (10:46 am)
Actually the plugin that Pascal speaks of is called 'SuperPNG' it is a free plugin that can be found with a simple google search.

SuperPNG is saved as an option through the Photoshop Save or Save As command (ensure that you choose SuperPNG and not PNG as the file format option).

When you are loading a file into Photoshop that is a PNG with an alpha channel, you will need to load it as a SuperPNG format, not a PNG.

If you cannot do either of these correctly, I would check to ensure that you have placed the SuperPNG plugin correctly in your Photoshop plugins folder (it should go into the one marked File Formats) because the plugin does work and many of us have it it for many years already.

Logan

Edit: Added more info to my initial vague response.
#3
06/09/2004 (10:49 am)
...
#4
06/09/2004 (10:53 am)
@Logan: I've already got SuperPNG. Fourth paragraph of my post talks about my experiences with it, but to re-iterate: SuperPNG ignores the alpha channel when it exports a PNG, but when it imports it merges it into the image layer. The readme.txt mentions a "matte version" that will behave like Photoshop's TGA exporter, retaining the alpha channel without modification, but I do not see if under the download section on SuperPNG's website.

@Pascal: I've heard of people grabbing the older PNG 5.5 plugins and using them before because of this issue. I guess I can try that out, though I recall that PS versions before 6.0 had issues with PNGs and their gamma mapping.
#5
06/09/2004 (10:53 am)
Joesph, I caught that and expanded my response, sorry that I didn't update it fast enough for you to not catch it.
#6
06/09/2004 (10:55 am)
...
#7
06/09/2004 (11:21 am)
Try using pngcrush. Download it here, then run it using the following command-line options:

pngcrush -rem gAMA -rem sRGB -rem cHRM -rem iCCP .png .png

where is the image you want to fix, and is the name of the fixed image.

This will remove all the extraneous color and gamma profiles from the PNG & optimize its filesize, while leaving the alpha channels intact.

Given the clunkiness of typing out all those switches, you might want to make a simple batch file that automates it. I use this:

pngrem.bat
pngcrush -rem gAMA -rem sRGB -rem cHRM -rem iCCP %1 %2

so whenever I want to fix a png, I just need to type:

pngrem .png .png
#8
06/09/2004 (1:27 pm)
Quote:Has anyone had any success in getting textures with alpha channels made with Photoshop to work in Torque?
Quote:I've already got SuperPNG. Fourth paragraph of my post talks about my experiences with it, but to re-iterate: SuperPNG ignores the alpha channel when it exports a PNG

SuperPNG does come with a alpha version in the standard download, as of a couple weeks ago, at least. I have been using that version for TSE work and it does just fine. I am not sure about whether it gets alphas when re-opening a file as I always keep the original PSDs with all layers and work from those.
#9
06/09/2004 (1:48 pm)
@Logan: NP, don't worry about... As for my problem, I'm not sure why SuperPNG hasn't worked for me, when other people seem to have no issues with it at all.

@Alex: I checked my archive and it just had one Photoshop plugin in it. Maybe the author pulled it but didn't modify the readme.txt yet? I'll check it again later tonight when I get home, but if I can't find it would anyone be willing to send it to me?

@Walter: Hmmm, that might help me get around this for the short term if I can get rid of the broken gamma profiles. I'll try that out, too, thanks for the info!
#10
06/09/2004 (2:02 pm)
It works fine for me. You can't just have an alpha channel on the PNG, you physically have to use the alpha channel to make a selection and then delete the area your masking off and save it. I had the same problem a couple of weeks ago.
#11
06/09/2004 (3:28 pm)
Weird, I use an old photoshop PNG filter, it works just fine. Only Ps6 right now though, havent installed 8 yet.
#12
06/09/2004 (6:32 pm)
Update: Yeah, seems the author of the plugin must've forgot to include the alpha matte version with the archive. Big thanks to Logan Foster for providing me with a copy of the older version of SuperPNG.

It works perfectly now, just like I want it to!
#13
06/11/2004 (7:57 am)
Hey, I have the same problem as David, can anyone send me an older version of SuperPNG?
#14
06/11/2004 (9:16 am)
@Dreamstorm: A little birdy told me it could be found here. :)
#15
06/11/2004 (10:12 am)
SAINT BIRD!!!!!

The alpha channel works fine now.

Thanks a lot.
#16
06/11/2004 (10:27 am)
Oh, weird. It was part of the download from fnord a couple weeks ago. Seems like a pretty major oversight!
#17
06/11/2004 (10:41 am)
Yeah, not sure if the author decided to stop distributing that version of the plugin or if they just forgot to include it in the archive. Maybe I should email them and ask them about it.