Alpha Channels

Creating decals with alpha channels

Photoshop and alpha channels

In a TGA file, there is a bit flag that tells whether the image is stored as normal alpha or as premultiplied alpha image. But Photoshop does not allow us to specify the status of this flag. It always stores the image with this flag set to "normal alpha image".

Consequently, when producing an image with alpha channel in Photoshop. it must be produced with the "normal alpha image" rules in mind. This means that all pixels under which the alpha value is not 0 should have their full color. In other words, the pixel colors should not fade to black nor fade to white.

Not following this rule will produce composited images where halos are visible. Why? Because when you fade your bitmap to white, you are actually already compositing your image with a white background and this white background component will show through when the image is composited over another background image later.

For example, suppose that at a given pixel, the alpha is 50%. With a white background, the resulting pixel value will be 50% image color + 50% white. When further composited over another background image, the result will be 25% image color + 25% white + 50% background image. This 25% white component will produce a whitish halo. Choosing black as background will produce a blackish halo. The right thing to do is to use a background color that is consistent with the foreground color. This is what is explained below.

Producing A:M decals with an alpha channel in photoshop

Paint your image on a new layer with all antialiased effects you want. You may use as many layers as required by your design.

Note that painting on the Photoshop "background" layer will not work since it is opaque. The "background" layer must be either removed or converted to a normal layer before begining to paint the decal.

You may use as many layers as needed but if you made your image with multiple layers, then merge all the image layers together but always leave the background layer unmerged.

Ctrl-Click the image layer to select its content. Ctrl-Click the layer actually copies the layer transparency channel with all its transparency values into the current selection.

Note: the accompanying illustrations are enlarged to 400%.

Switch the "Layers" list view to "Channels" list view and create a new channel named Alpha. And while the selection from the previous step is still visible, fill the new channel with White (menu "Edit", "fill"). This creates your alpha channel mask.

Note: For the next step, you might have to install the Filter Factory which you will find in the "Goodies" folder on your Photoshop CD-ROM. Or if you use Windows version of Photoshop, you might download the Photoshop d-xparen plugin I prepared with Filter Factory. Simply drop the file in your Photoshop "Filters" folder. The filter will appear in a new "Alpha Channel" option in your "Filter" menu.

We will next, modify the painted decal layer so that we get the correct opaque background colors.

Reselect the RGB channel and get back to "Layers" list view and select the image layer. Select menu "FIlter", "Alpha Channel", "De-Transparent".

Alternatively, select menu "Filter", Synthetic" and then "Filter Factory ...". Enter "255" next to the "A:" field and click "OK". You should get something like the illustration to the right.

Note that the black fill comes from the current background color I chose in Photoshop. This background color can be any color. It does not need to be black since the alpha channel is completely opaque in those image areas.

The result is not pretty but remember that all the transparency fade information is now stored in the alpha channel and that in the end, when composited, you will get the expected results.

This is important to do when using Photoshop to produce alpha images intended to be used as decals in A:M because otherwise, A:M will think the image is not premultiplied as is indicated in the TGA files by Photoshop.