Alpha channel creation with Photoshop

From FSDeveloper Wiki
Jump to: navigation, search


In this article I will describe how transparant textures for Flight Simulator can be made by using PhotoShop and ImageTool. If you use another graphical program, like Paint Shop Pro, the technique described in this article is still valid of course, but the names and locations of the different functions used might be different. Let's get started!

Base texture

The first step is to make the normal texture. The steps how to do this will not be discussed here, I assume you know how to make your own textures, based on photos for example.

In the figure below you will see the texture I am going to use for this tutorial. It is part of the Texel scenery I made and as you can see it contains three parts. The upper two are texture for a wall, each with transparant windows in it. The lower parts is a sign of the restaurant and the part that is shown in red here should become transparant in the end. In some older tools like BMP2000 the transparancy was linked to a certain color, that is not the case here. The only reason I made that part of the texture red is that it allowed me to select it easier later on, I could just as well have made it white to get the transparancy.


Adding the alpha channel

The next step is to add the alpha channel to the texture in PhotoShop. Normally PS will show the different layers that are available in your image, but in that same windows you can also select the tab channels to show the different channels that are available. In the figure below these two tabs are shown for our texture.

As you can see the texture has one layer, but it has four channels. There are the R(ed), G(reen) and B(lue) channels and also the RGB channels where all color are mixed correctly.

Alpha2.jpg Alpha3.jpg Alpha5.jpg

We need to create a new channel in the image, our alpha channel. To do this click on the Alpha4.jpg button at the bottom of the channel window. The new channel will automatically be called alpha channel.

Using the alpha channel

As you can see in the figure above the alpha channel is completely black by default. What does that mean?

With the color in the alpha channel you can determine the level of transparancy for each pixel of the image. In Flight Simulator there are two different texture formats, the DXT1 and DXT3 texture. The DXT1 texture has a 1-bit alpha channel, while the DXT3 texture has a 4-bit alpha channel.

This means the DXT1 alpha channel can only contain 2 color, black and white. All parts that have a black color in the alpha channel will become fully transparant, while all parts with a white color in the alpha channel will show as normal. This format can thus not be used to make parts semi-transparant.

In a DXT3 texture you can use up to 16 colors in the alpha channel, so you can also use different tones of grey. These tones of grey allow you to set parts as semi-transparant. The darker the grey color is, the more transparant it will become. Due to the larger size of the alpha channel, the size of the total texture is also bigger in the DXT3 format, so only use this format if you really need semi-transparancy.

Drawing the alpha channel

If you select the alpha channel in the channel window, you will see that the normal window of your texture also shows the alpha channel instead of the normal RGB channel. Now you can use the normal drawing tools to manipulate the alpha channel.

If you select both the RGB and the alpha channel in the channel window, so will notice that you see the alpha channel as red blended over the normal texture. This allows you to see if the alpha channel matches find with your texture. By selecting the RGB channel for example you can select a part of the normal texture as shown in the figure below.

Alpha7.jpg Alpha8.jpg

By switching to the alpha channel next, it is very easy to fill a part of the alpha channel, that exactly matches the normal texture, with a certain color. In this case I made everything in the alpha channel white, by simply inverting the selection and filling it with a white color. Only the parts there are red in the orgional texture are left black, as these should become fully transparant (see the figure below).

Alpha9.jpg Alpha10.jpg

Now let's turn back to the texture of this example. We had two walls and the sign. The two walls each have a stone part that should not become transparant of course, so these parts need to be white in the alpha channel. The glass parts of the walls should be semi transparant, so we need to use a grey tone there. For the sign we should make everything that is part of the sign white. All other parts of the texture must be fully transparant and thus black in the alpha channel.

When this all has been done the alpha channel should look something like the one showed in the figure below.


Saving the texture

Now we are ready with the texture in PhotoShop and there is one step left to be done. The texture must be saved in a format the ImageTool can read, but that can also store the alpha channel. The PSD format of PhotoShop is one of these formats, so we will save the texture in that format. Other options are the TGA format or 32 bit bitmaps.

Saving as DXT texture with ImageTool

The last step before we can use our texture is to save it as a DXT texture with ImageTool. You need to take the following steps in ImageTool:

  • Open the texture. Load the image that you saved from PhotoShop here. The figure below shows how it should look. The colors do not show correct, everything looks a bit too dark, but that is correct.


  • Select the correct format for your texture. Using Image -> Format -> DXT3 you can set the texture to DXT1 or DXT3 (see the figure below). In this case we want the format to be DXT3. Once you have set the format you will see that the colors of the texture also become correct.


  • The next step is to add the mipmaps to the texture. This can be done using the Image -> Create MipMaps (see the figure below). You will see that the small versions of your texture are shown as well.


  • The last step is to save the texture to the correct texture folder in Flight Simulator. You can do this using the File menu.

To check if the alpha channel is correct you can use View -> Alpha channel in ImageTool. This will show the alpha channel of the current image. The figure below shows that are alpha channel is correct. It has also been added nicely to the mipmaps.