| Home Page | Recent Changes | Preferences

Adding Alpha Channel To TGA Files

About the .TGA file format

  • It is designed for high quality, 24-bit colour graphics.
  • Unlike .JPGs, the file is not compressed.
  • TGAs support greyscale transparency, and so store the mask within the .TGA.
  • When you mask a pixel, the brighter the colour you mask with (remember, greyscale means from black to white), the more opague that part of the image is (opaque means that you can't see through it), and vice-versa.
  • Therefore a pixel with a grey (halfway in the greyscale, 50% white and 50% black) colour is half as translucent as a white pixel; you will see 50% of what is behind the texture, and 50% of the texture itself.
  • The transparency of a pixel does not affect the colour of the pixel.

How To

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.

Now you should see the masking in effect; just two more steps left to do.

Select Masks→Save to Alpha channel from the menu. Just agree with the next two windows (hit 'OK'), and save your new masked image. Ensure you choose .TGA file format (it will be listed as Truevision TARGA (.TGA)).

Violator: I've found a slightly quicker method of editing the mask texture using PSP 5 (saves having to select multiple areas with the Wand). Working with the image copy -

  • Select the Flood Fill tool.
  • Set the Tolerance to something high (64 works well)
  • Set the flood colour to pure white.
  • On the cloned image, fill in the areas you DON'T want to be masked. They should fill to pure white (if some bits remain around the edges, up the tolerance setting).
  • Set the flood colour to pure black
  • Fill in the areas you DO want to be masked. They should fill to pure black.

Adobe Photoshop

OK doing this in Photoshop is very simple. 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

Anyway after you made your slection go to the chanels tab (next where the layers tab is usualy). Press the button "Save selection as chanel" A chanel named Alpha1 should apear. Now check if what you want to be visible is WHITE. If it's the oposite click on the Alpha1 channel (should be under the blue)deselect (Ctrl+D) and invert (Ctrl+I). There you have it!

  • Note that in PS 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.


Make sure you follow the instructions given there.

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.

Foxpaw: Is there a way to make a add a mask to a texture within UnrealEd? IE Set a texture as the alpha mask for another material?

Wormbo: I'm sure this is possible through extensive use of texture modifiers, e.g. you can use a Combiner to combine the colors of one texture with the alpha map of a different texture. With a FinalBlend modifier you can create an alpha channel based on a texture's brightness (like the render style STY_Translucent in UT) and use it in a Combiner to combine texture 1 and alpha channel of that FinalBlend. In both cases you have to apply another FinalBlend to the Combiner to make it actually use its alpha channel.

Foxpaw: I haven't been successful in using the finalblend to make an alpha channel like that, but that is basically what I was aiming for.. can you explain the process in greater detail, or maybe make a tutorial page on how to do it?

Category To Do

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands


Mapping Topics

Mapping Lessons

UnrealEd Interface


Scripting Topics

Scripting Lessons

Making Mods

Class Tree


Modeling Topics


Log In