Alpha Channel
Alpha channels, also sometimes called masks, are images that control the transparency of an image. In programs like Lightwave and 3D Studio, the image and its alpha channel can be separate image files. In Unreal, it's best to use 32 bit TGA files that store the image color information with the transparency information in a single file.
Alpha channels use black for transparent areas, and white for opaque areas. Files that are only black and white are sometimes called masks. An example might be an image of a tree where the trunk, branches, and leaves are visible but everything else is "invisible" or transparent.
They can also be used to make gradual shifts in transparency such as with the simulated glow of coronas and particles. Since black is transparent, a dark grey (eg, RGB 10,10,10) is mostly transparent but not completely.
Alpha channels are used to simulate 3D geometry without increasing the number of physical polygons. For example, a picket fence would require modeling individual boards and nails while an alpha channel image fence would simply contain and image of a fence and its alpha channel; transparent areas around the top and between individual fence boards.
About the .TGA file format
- It is designed for high quality, raster images
- They can be very large files because 1 byte is used for each color
- TGAs support greyscale transparency, and so store the mask within the TGA
- A TGA with an alpha channel (transparency information) are typically 32 bit files
- TGA files can be run length encoded to save space; RLE compression is directly proportional to the complexity of the image. "Noisy" images don't compress well, while bands of the same color do compress well.
- TGAs are sometimes called Targas or Targavision, or Truevision Targa
How To Create An Alpha Channel
Adobe Photo-shop
- Using the various laso tools, magic wand and the pen tool make your selection. If you dont already know how great the pen tool can be for making your selections try this : http://www.gurusnetwork.com/tutorials/photoshop/pen1intro.html
- After you've made your selection go to the channels tab (next where the layers tab is usualy).
- Press the button "Save selection as channel" and a channel named Alpha1 should apear.
- Now check if what you want to be visible is WHITE. If it's the opposite click on the Alpha1 channel (should be under the blue) deselect (Ctrl+D) and invert (Ctrl+I). There you have it!
Note: that in Photoshop 7.0 there is a bug that makes it imposible to save alphas in Targas. To fix this either update to 7.01 or download a small fix for the adobe web site.
http://www.adobe.com/support/downloads/detail.jsp?ftpID=1544
Make sure you follow the instructions given there.
Paint Shop Pro
- Load your image that you wish to make transparent.
- In the menu, click on 'Selections→Select All', and press CTRL-C to copy the image to the clipboard.
- Press CTRL-V to paste it as a new image (you will be working on the cloned image first).
- Pick a selection tool (the 'Wand' is normally a good choice) and click on the area you want to add transparency to. If you have multiple areas of the same image you wish to make transparent, hold down the shift key while clicking on the image.
- Whatever you do want transparent will be selected. Take your floodfill tool and select a dark colour (the darker the colour, the more transparent the pixel will be). Floodfill within the selected areas.
- In the menu, click on 'Selections→Invert' - this will invert your selection.
- Whatever you do not want transparent will be selected. Take your floodfill tool and select a light colour (the lighter the colour, the less transparent the pixel will be). Floodfill within the selected areas.
- In the menu, click on 'Layers→Load/Save Mask→Save Mask to Disk'. Type in a File Name and hit Save.
- In the menu, click on 'Selections→Select None' to deselect everything.
- Reopen your original texture.
- In the menu, click on 'Selections→Select All'.
- In the menu, click on 'Layers→Load/Save Mask→Load Mask from Disk'and look in the menu bar at the top of screen for Mask. Select Mask→New→From Image. In this dialogue box, for the source window, the pulldown box, 'blank' and select your masked texture's filename, and press ok.
- Select Masks→Save to Alpha channel from the menu. Just agree with the next two windows (hit 'OK'), and save your new masked image. Make sure you choose .TGA file format (it will be listed as Truevision TARGA (.TGA)).
DJPaul: Did some more work on this. Fell through when I released the Beta 8 of PSP menu-wise is much different from PSP7, so i'm stuck. Plus my art sk1lls about suitable for MS Paint. I will try find someone who knows to finish it.
The GIMP
You can simply save the image with an alpha channel to TGA format. Make sure you don't have a layermask selected though, or it might save only the mask.
The best way to create transparency is using a layer mask. Right click the layer in the layers window and select "Add layer mask...". The layermask is actually just a grayscale image; black means fully transparent and white fully opaque.
The other way to do it is to add an alpha channel to each layer. Usually the only layer without an alpha channel is the background layer. Right click the layer again and select "Add alpha channel". Now you can clear parts of the layer using the eraser or select tools. They'll become transparent instead of getting filled with the background color.
Before you can safe the image to TGA with an alpha channel you need to merge the layers. GIMP will automagically do this for you just before saving (after you confirmed it, ofcourse). Note however that only the visible layers will be saved. So first make sure the layers you want to save are visible.
Resources
Kerlin: I'm in the middle of refactoring Creating Textures/Alpha Channels and Adding Alpha Channel To TGA Files. Watch your step. Work in progress.
Kerlin: Think I'm done. Someone wanna check my work so I don't jack something up? Just throw Delete Me on the two pages above if you think this is sufficient. Otherwise, fix this page.