Setting photoshop's alpha channel bit depth

Started by
32 comments, last by Numsgil 15 years, 8 months ago
When I say "alpha channel", I mean transparency specifically. As in the "a" component of the RGBA 32 bit DDS format. Which is what we're using right now. DXT1 uses a single bit for that transparency component, and since our textures are supposed to be cutouts anyway, it seems like a good format.

But when photoshop tries to save that 8 bit transparency channel in to a 1 bit channel, it makes some suboptimal decisions that result in jagged edges. So my ultimate goal here is to force photoshop to use 1 bit for its transparency so we can examine and correct any jagged edges before exporting.
[size=2]Darwinbots - [size=2]Artificial life simulation
Advertisement
Quote:Original post by Numsgil
When I say "alpha channel", I mean transparency specifically. As in the "a" component of the RGBA 32 bit DDS format. Which is what we're using right now. DXT1 uses a single bit for that transparency component, and since our textures are supposed to be cutouts anyway, it seems like a good format.

But when photoshop tries to save that 8 bit transparency channel in to a 1 bit channel, it makes some suboptimal decisions that result in jagged edges. So my ultimate goal here is to force photoshop to use 1 bit for its transparency so we can examine and correct any jagged edges before exporting.

I'm not sure if you're following me.
If i understand your problem correctly, refer to the link i posted above on how to disable the brush anti-aliasing. This will prevent any type of "in-between" pixels and allow you to paint a 100% white or black pixel range, aka, 1 bit color range. Which should work for the 1 bit alpha testing (transparency).
-------------------------Only a fool claims himself an expert
Yes, I'm aware of that trick, but it doesn't help with existing images. What I want to be able to do is take an existing psd which has various levels of transparency, and "flatten" that transparency to 1 bit.

Basically I'm trying to get photoshop to be as close to WYSIWYG for DTX1s as I can.
[size=2]Darwinbots - [size=2]Artificial life simulation
Quote:Original post by Numsgil
Yes, I'm aware of that trick, but it doesn't help with existing images. What I want to be able to do is take an existing psd which has various levels of transparency, and "flatten" that transparency to 1 bit.

Basically I'm trying to get photoshop to be as close to WYSIWYG for DTX1s as I can.

Then just go to the alpha channel and crank up the contrast to 100%, as stated above. That will force all pixels to be either 100% blank or white, aka, 1 bit color range.
-------------------------Only a fool claims himself an expert
Yes, that is the part I do not know how to do... I can create a new channel, and it will name itself alpha1, but it will just be an arbitrary data channel. It won't actually be the transparency channel. Here is the view I have when I open one of the psds and go to the channels tab (click for better res versions:)

Free Image Hosting at www.ImageShack.us

Then, if I create a new channel, it calls it "Alpha 1", but as you can see it does not actually store transparency information. It's just treated as an extra data channel:

Free Image Hosting at www.ImageShack.us

So forgive me if I'm just being exceptionally obtuse (I'm a programmer by trade, and we seem to have different vocabulary from artists), but is there a way to get the channel tab to display the transparency information as a separate channel?
[size=2]Darwinbots - [size=2]Artificial life simulation
Oh i see. Your artist is utilizing photoshops built in "transparency", where you erase part of the image to reveal the checkered pattern underneath.
While this may be recognized by .dds, it generally is not the correct way to produce transparency in games.
After a quick google i found a tutorial that explains alpha channel transparency quite well:
Hair alpha Tutorial

You can use basic/simple transparency, like that found in .gif and what you're doing. But you generally want to use the alpha channel for finer control, and more advanced 8 bit transparency.
The alpha channel generally provides an 8 bit grayscale map to define what pixels will be transparent. Black will be transparent while white will be visible.
I would recommend using 1 bit alpha, as the fill rate penalty is less, and only use 8 bit for things thta may require it like hair (if your engine supports 8 bit alpha).
-------------------------Only a fool claims himself an expert
Heh, okay, I think we're on the same page now.

Now, I created a new alpha channel, calling it "alpha", and copied it from the red channel. Then I went in and contrasted it so that it was black and white only. I can shift+click on the alpha channel and the rgb channel and have them overlay at the same time, so I can see where the alpha channel is in relation to the underlying rgb channels. And I can even double click on my alpha channel and toggle between masked/selected.

How do I now export that alpha channel and eventually get it as the transparency in a DDS? We use the NVidia Photoshop DDS plugin to export textures, but it refuses to even try when there's an alpha channel (Error: too many channels to export (5)). Saving it as PNG just causes the extra alpha channel to get stripped out. If I could even export just that channel as it's own texture, I could probably rig up an automated merge step that combined an rgb texture and an alpha texture into a single dds.
[size=2]Darwinbots - [size=2]Artificial life simulation
Try flattening the image first.

Also, if you want to copy photoshops built-in transparency data from a regular layer into an actual alpha channel, you can ctrl+click on the layer to use, and then click the 'Save selection as channel' button (circle in a rectangle) on the channels toolbar.
Quote:Original post by Hodgman
Try flattening the image first.


Flatten lets me save it as DDS, but it seems the actual alpha channel is just ignored.

Quote:
Also, if you want to copy photoshops built-in transparency data from a regular layer into an actual alpha channel, you can ctrl+click on the layer to use, and then click the 'Save selection as channel' button (circle in a rectangle) on the channels toolbar.


As near as I can tell, this does not actually copy the built in transparency. It instead selects everything that satisfies some magic-wand type tolerance and copies that? Close enough for most cases, but not quite the same thing.
[size=2]Darwinbots - [size=2]Artificial life simulation
Quote:Original post by Numsgil
As near as I can tell, this does not actually copy the built in transparency. It instead selects everything that satisfies some magic-wand type tolerance and copies that? Close enough for most cases, but not quite the same thing.
No it does. The selection outline may not look quite correct, but it really does respect any semi-transparent pixels - they will be written into the alpha channel as the correct value of grey.

We've been using this technique at work to get images from non-technical artists into production games for years ;)

If you want to copy multiple layers to an alpha channel, then ctrl+shift+click on each of them in turn, then press the 'Save selection as channel' button.

[EDIT]
Just to clarify, in your Channels toolbar, you've only got Red, Green, Blue and Alpha?

This topic is closed to new replies.

Advertisement