pouët.net

Go to bottom

storing alpha with PNG

category: gfx [glöplog]
 
ok, this drives me grrr. options via google don't work, but i'm sure others dealt with this somehow.

32 bits PNG does support RGBA. but, apparently you cannot save PNGs with photoshop in 32 bits mode. In 16 bits mode, you can create an image with RGBA channels, but when saving to PNG, this alpha map is just ignored. I want it for making a texture less opaque... Obviously this all works fine when using TGA or DDS.

apparently PNG alpha is calculated from transparency (like no pixel data on layers) and not based on an editable alpha map.

any idea how to embed a custom/editable alpha channel in PNG with photoshop?

workarounds are: saving a grayscale texture_a.png or switch to
... an other format. (happy trigger finger)
like, the exact problem is.
fill a 512x512 texture with e.g. orange.
now if i want to have that texture 80% opaque in a demo, i need an alpha map, because there's RGB data so the transparency thing is irrelevant then and you want an alpha map that contains a light gray color.
You mean "32-bit per channel" or "32-bit per pixel"?
added on the 2015-06-11 13:36:00 by Gargaj Gargaj
32 bit colour (i.e. 128 bits per pixel) or 32 bit per pixel (i.e. 8 bit per colour channel)? I'm pretty sure photoshop supports the latter, the former isn't well supported although it's a few years since i looked at this..
added on the 2015-06-11 13:37:38 by psonice psonice
there seem to be people doing it this way but i think you must need something more complex than this.
added on the 2015-06-11 13:40:37 by Defiance Defiance
Quote:
apparently PNG alpha is calculated from transparency (like no pixel data on layers) and not based on an editable alpha map.
What ?

You can add a layer mask, ALT+click on it in the Layers palette well thingy, and edit the mask like any other componennt. Or you can go to the Channels palette well thingy and select only the Alpha channel, and edit it.
added on the 2015-06-11 13:42:41 by p01 p01
maali: a good png loader will read the alpha channel from the layer opacity you have in photoshop..
added on the 2015-06-11 13:46:59 by smash smash
this was a common problem back in the day when I worked in games.. we just switched to TGAs and all was well ;-)
added on the 2015-06-11 13:47:43 by farfar farfar
You are doing it wrong. Photoshop has the ability to do this. You should look at p01's suggestion..
added on the 2015-06-11 13:52:27 by rudi rudi
poi+smash: aaah, right, layer masks. i was totally staring blind on getting an editable alpha channel that i totally forgot about those. thanks! and kinda stupid that this obvious answer is hard to find with google. :)
BB Image \o/
Maali: Actually Photoshop 8 (or 8.01? it was one specific version) did it right (save alpha channel directly, not use transparency as alpha). You might want to get ahold of that version's PNG plugin and use it instead. We did so for years at the last company :)
added on the 2015-06-11 17:17:20 by kb_ kb_
yeah, so basically it's just Photoshop being modern about it. i'm getting old that it managed to fool me! ;)
RW Paint supports transparecy, didn't test about alpha.
added on the 2015-06-11 18:21:56 by g0blinish g0blinish
Photoshop being modern since .. what.. 2000? :)
added on the 2015-06-11 20:59:34 by farfar farfar
sure thing, MISTER TARGA! ;)
Quote:
maali: a good png loader will read the alpha channel from the layer opacity you have in photoshop..


Can confirm this works fine in Love2D
added on the 2015-06-11 22:54:35 by ___ ___
Not sure about Photoshop, but GIMP supports 32bpp RGBA PNGs just fine. Made some today at work for some live video keying experiments
added on the 2015-06-12 00:06:19 by Tjoppen Tjoppen

login

Go to top