Page 1 of 2

Need help with SetPNG and true colour alpha PNGs

Posted: Wed Jan 25, 2006 5:19
by Nash
I have a Doom 2 logo replacement (replaces M_DOOM).

The original graphic is a true colour PNG. Why true colour? Because I need the transparency information for a smooth gradient fade out effect that my graphic uses. If I convert the PNG to 8-bit, Photoshop discards the transparency.

Anyway, all works well but then comes the problem of setting the offset.

I know how to use SetPNG to set offset for PNGs, but for some reason SetPNG refuses to work for my graphic. I did a test and converted it to 8-bit (and lost the transparency) and suddenly SetPNG works (successfully saves the offsets). Tried it again with true colour and it doesn't work.

I'm stumped. Are there any workarounds?

Posted: Wed Jan 25, 2006 7:38
by Shinjanji
hmm... IIRC, PNG files have various bits of extra header information in them. SetPNG probably writes information into these headers that ZDoom/GZDoom looks for. If you found out what it wrote (you could find out with a test graphic or look through the source code) then you might be able to manually add the information to your PNG.

Though well-knowing of the limits of my ability to troubleshoot, there is either a much easier solution, or I have all of my information totally wrong. TRY IT AT YOUR OWN RISK! XD

Posted: Wed Jan 25, 2006 11:21
by Graf Zahl
8 bit formats fully support translucency. I think it's time to look for better tools. Photoshop is utter crap when it comes to PNG support. Google for PNGQUANT. It is a small command line tool that should help you convert your picture to 8 bit while retaining the alpha channel.

But since you are replacing an original patch your best way of action is to use the 'remap' function of HIRESTEX. At this moment GZDoom does not read offset information from hires PNGs.

Posted: Wed Jan 25, 2006 20:11
by DaniJ
Graf Zahl wrote:8 bit formats fully support translucency. I think it's time to look for better tools. Photoshop is utter crap when it comes to PNG support.
Your clearly using it incorrectly if thats what you think ;)
At this moment GZDoom does not read offset information from hires PNGs.
Nor should it IMO.

Posted: Wed Jan 25, 2006 20:34
by Enjay
DaniJ wrote:Nor should it IMO.
Why not?

Posted: Wed Jan 25, 2006 21:21
by Nash
Graf: Do model skins support alpha channel translucency?

PNGs with one transparent colour works (holes will appear on the model) but I can't seem to create smooth gradient skins that fade out.

Or is it another "Photoshop is crap" issue?

Posted: Wed Jan 25, 2006 21:41
by DaniJ
Enjay wrote:
DaniJ wrote:Nor should it IMO.
Why not?
IMO that offset info is NOT metadata, as such it doesn't belong in the resources.
PNGs with one transparent colour works (holes will appear on the model) but I can't seem to create smooth gradient skins that fade out.

Or is it another "Photoshop is crap" issue?
At a guess I would say this is due to GZDoom converting the PNGs to the DOOM palette. Please don't blame Photoshop as it certainly does handle this very well indeed. The problem with PNG is that there isn't a seperate alpha channel (as there is in TGA for example), this means that alpha must be applied to the base layer in a "destructive manner".

The way to best use Photoshop when alpha is required is use the native PSD format as your "master", with a "layer mask" for your alpha channel. When you save as PNG Photoshop will convert the alpha channel down to the base layer as required for PNG.

Posted: Wed Jan 25, 2006 22:15
by Graf Zahl
Nash wrote:Graf: Do model skins support alpha channel translucency?
You will get weird results. Translucent polygons have to be sorted and with models this will cause problems. Right now I am forcing all models to be rendered completely opaque.

Posted: Wed Jan 25, 2006 22:21
by Nash
Any plans for alpha skins to be supported for models?

Posted: Wed Jan 25, 2006 23:13
by Graf Zahl
No. As I said, the polygons need to be sorted and with models that have a lot of them it can become very tricky. And model explosions aren't worth the effort IMO. For that sprites look better.

Posted: Thu Jan 26, 2006 0:03
by DaniJ
And model explosions aren't worth the effort IMO
True but these arn't nearly the only reason to sort model polys.

Most models use alpha to create details that can't be modelled due to the massive number of extra polys it would require.

For example monsters, might be modelled so that hair is made up of several layers of alpha'd polygons. Other examples would be a Wizards' tattered robes or the 3D spinning plasma shots, muzzle flashes etc etc in the jDRP 1.1 alpha.

Not supporting texture alpha for models severely limits what the artist can create.

However if you can't sort them in GZDoom at present, Graf is right to force model textures to be opaque, as the results would look awful otherwise.

Posted: Thu Jan 26, 2006 7:51
by Nash
EDIT: PNGQUANT works like a charm. :D The picture appears screwed in Photoshop but looks good in GZDoom.

Thanks Graf!

Regarding no alpha skin model support: oh well. Looks like I can't create smooth hair textures then.

Posted: Thu Jan 26, 2006 10:46
by Graf Zahl
Nash wrote:The picture appears screwed in Photoshop.

As I said: Crap PNG support! :P

Posted: Thu Jan 26, 2006 11:42
by DaniJ
The picture appears screwed in Photoshop.
Why are you working in PNG anyway!? Use PSD for everything and only convert to PNG when you HAVE to (getting it in the game).

Posted: Thu Jan 26, 2006 12:07
by Nash
Dani, any person in their rightful mind wouldn't work with PNG alone.

I never work without keeping the PSD master (or source as I like to call them) files.

But I just wanted to preview my image that was ran through pngquant to see if the transparency information is kept and was surprised to see a bunch of red mess.

It displays fine in GZDoom, so (unfortunately) I'm gonna have to agree on Graf with this one (despite me being a Photoshop fanboy) - PS is crap at that area!

Don't get me wrong though, I still love PS. PS 4eVa :rock: