Semi-Transparancy


Home Alpha Addition Semi-Transparancy

 

How to change the Transparency of an Alpha Channel Window

Using Paint Shop Pro and TGATool2

Copyright © 2004  Paul DeVerter

This is Chapter 3 in the series of tutorials having to do with “How to Make an Alpha Channel”.  It also constitutes an addition to the Dogwaffle tutorial by Bill Hall (see credits at the end of this tutorial), and shows how to change the transparency of the alpha window for use in MSTS.

After you have created a structure or piece of rolling stock in TSM, and have made the windows transparent by using Dogwaffle or PSP, you now have a tga file with an alpha channel.  You must convert this to an ace file to use in the Sim, and TSM will not change a tga file to an ace and produce an alpha channel.  Seems like it should, because, as Ted Ahner said, it uses the same makeace file as does TGATool.  Nonetheless, TSM will not do so.  {This statement is proven wrong; see the last paragraphs of this tutorial}.

So, crank up TGATool again, and open the tga file with the alpha in it. (Or you could also use the ace file you have already created, or have available, which includes the alpha).  It looks like this:

Now, in the menu at the top, click on Image, and then click the option to send the alpha channel to your drawing program.  Alternatively, you may right click on the Alpha Channel Texture on the right, and do the same thing.  I have the preferences set up so that it automatically goes to Paint Shop Pro 7.  Do not close TGATool.

As you know if the alpha is black, then it is transparent, and if white it is opaque, and will let the original texture color show through.  So, if we want to vary the transparency from clear glass (black) then we must turn the selected window glass from dead black to some gray color. 

PSP will open when you send the image, and here is what you will see:

Notice the only colors available to you are black to white, in the upper right.  What I decided to do was change the black to various shades of gray in the row of 4 windows where the marching ants are crawling around.

So, I used the Rectangular Selection Tool to draw a box around each window pane, and then used the Color Replacer to change the black to a different shade of gray in each of the 4 windows.  So, click on the lower Styles box, and up opens a new color window filled with a whole bunch of black to gray to white boxes.  Not knowing which to chose, I clicked on one, and it showed the gray to be 54, 54, 54.  So I used it first, and in Color Replacer (with a very low tolerance) double right clicked the mouse, which changed the black inside the marching ants to a shade of gray.  This is the left one in the group of 4.  Then I did the same process for the 2nd, and changed it to 102, 102, 102.  And the 3rd was changed to 134, 134, 134.  Finally the 4th one was changed to 182, 182, 182.  I think the alpha color has been picked and the area selected in the photo above, but the Replacement Tool has not yet been activated.

And here they are as changed, and you can see the 4 shades in top row, and the 4 black alphas in the bottom row.

Now, go to File and Save (not Save As) the file with your four changes.  Then close PSP.  And you are back in TGATool.

In TGATool, go to Export and export the tga file, as changed, as an "Ace (alpha) - not DXT", sending it to wherever you are keeping your copies of the ace file for the project, overwriting any earlier version.  Then, send a further copy to your Route|Textures folder if it is scenery.

Now, go into MSTS, and drive to the location of the scenery item, and here is what you have:

The 4 upper windows are no longer transparent, but are translucent, to varying degrees, while the 4 lower windows are still all transparent.  I think the 182 gray is too dark, and the 54 does not show much of anything.  So, if you want a window that is not fully transparent, pick a gray in the range of 102 – 134 or so, and see how you like it.

Now I have not figured out how to make the glass dirty, streaked, or speckled, but it probably involves spattering some white on the alpha for the individual windows.  I don't think it would matter what you did to the non-alpha portion of the texture.

 

In answer to a question on how to paint on the gray color:

I think the problem you are having is using the Color Replacer tool.  You do not paint on the gray, but instead replace the black with a gray color.

First I use the Selector to draw a marching ant box around the window of alpha I want to change.  You did that.

Then I change to the Color Replacer tool.  There it is necessary to set the tolerance, and I have it set at 1.  Next, you need to have the foreground color set to dead black, because this is the color you are trying to change, and yours is gray.  And the background color must be set to the gray color you want to be substituted for the dead black.  Then you use the mouse, and double right click the area within the marching ants, and presto change-o it goes from black to gray.

See if this helps:

 

Making the glass sort of dirty or splotched

I have been playing around again w/ the alpha thing. 

This time I did not use Dogwaffle, but instead did it all from PSP7.

The object was to try to get some noise in the glass, like dirt, or streaks.  So, in addition to using a gray color in the Styles foreground box, I also inserted some clouds in the Texture foreground box.

Here is what I ended up with in what I have called the Green Box.  There is only an outside, of 4 walls, all the same.  To me, the glass looks a little better than being just plain gray.  It is sort of mottled.  What do you think?

The second thing is - I simply generated this in TSM, using a tga file, and did not use TGATool to make the alpha in a separate ace file.  And to my surprise, the ace file that TSM generated seems to have the alpha channel in it.  At least you can see through the structure, so it must have an alpha?

 

Paul@paradesquare.ca              April – December 2004

 

Credits:

Bill Hall, Tim Muir, Ted Ahner  - all gave advise and tested the tutorial.

The excellent Dogwaffle tutorial mentioned in the first paragraph is found at the Port City Car Company site: http://www.paradesquare.ca/railway/dogwaffle_2_1.htm.  Dogwaffle comes as a free paint program in v1.1, and a more complicated v2.  Find it by searching with Google on the WWW.