Creating Transparent Windows in a Locomotive (using TSM)
by Brian Piotrowski


In this tutorial, we will learn how to create MSTS models that have transparent windows. As most of you know, MSTS has the ability to make the windows on a model transparent by just changing the properties of the part. However, that is only half the solution, since you still have to make MSTS aware of which parts are transparent, and which parts are to remain opaque.

For this tutorial, I will be using a simple locomotive from scratch. Let's assume that you've come this far. You have built your locomotive, and now you want to add transparent windows. Let's get at it!

This tutorial will be broken down into two parts. The first part will be the creation/modifcations required in Paint Shop Pro to bring transparencies into the model. The second half will be the modification of the model itself in Train Sim Modeler.


Part One - Paint Shop Pro Functions

Let's start by firing up Paint Shop Pro. The same principles will apply to any paint program you use, but I would highly recommend Paintshop Pro 7.x, for it is an extremely easy program with which to work, and it is fairly inexpensive compared to products such as Photoshop.

To make life easier, I would highly recommend changing your transparent background to something other than white and grey. You can do this by selecting FILE -> PREFERENCES -> GENERAL. Select the TRANSPARENCY tab and change the colours.

Load your textures that contain your exterior windows. When you load it, you will likely not have an alpha channel in the texture file. If you do, keep in mind that you can only save one alpha channel. So if there are any other transparencies, you'll need to add them as well.

Once you have the texture loaded, click on MASKS -> NEW -> SHOW ALL. Nothing will appear to have happened. This is good - the only change you should see is that the texture file will show as unsaved (An asterisk beside the name). Next, click on MASKS -> EDIT. You will see the palette on the right change from the rainbow palette to varying shades of grey, from black to white.

We are now in edit mode for the alpha channel. Select the paint tool (or any other tool you would like to use to remove the colours from the windows), and then select a shade of grey. Note - as you move towards the darker end of the spectrum on the palette, it will make the windows more transparent. Conversely, moving towards the lighter end will make the windows darker. Thus, solid black would represent an empty pane, while solid white is completely opaque.

For this example, let's assume you want a window with some glass to it. Select the grey with the RGB value of 162,162,162. Then, begin by removing the colour from the areas where you would like glass to appear.

You will notice that the colour you selected does not actually appear on the screen. Rather, it will be a lighter shade of the transparent background you selected. Although it is not obvious, it is actually creating the transparencies for your model. In this image, I have taken a lighter and darker shade to show you the difference.

As you can see, the lighter shade on the left is closer to white [glass], while the darker shade represents a colour closer to black [empty glass].

Continue removing the glass until you have finished all of the windows. Once you are done, you should have a texture file similar to the one shown:

Next, we need to save the windows to an alpha channel. From the menu, select MASKS -> SAVE TO ALPHA CHANNEL. Once you do this, you should see a screen that shows a representation of the windows. The image will appear black and white. This is the alpha channel of the image, and will be the final location of the windows on the model.

On the alpha channel dialog box, select OK, then give the alpha channel a name. For my models, I just give it the name "ALPHA CHANNEL", but you are welcome to give it whatever you want. Finally, save this image as a .TGA file. You must save it as a .TGA file because it must be a 32bit texture file - 24bits are assigned to the texture and 8bits are assigned to the alpha channel (hence the reason there are only 256 levels available for window colours)

The next thing you might want to do is make a copy of this file. You will need to create an interior for your locomotive, and if you use the external texture it might look strange. The easiest thing to do in Paintshop is to simply select all (CTRL-A), copy (CTRL-C), and then finally paste as a new image (CTRL-V). Then, take a lighter colour (mint green seems to be the norm for cab interiors), and repaint the exterior portions of the cab. When complete, you should have a new cab interior along with the cab exterior:

The advantage to doing this is that you don't need to reassign the alpha channel to the image, since it is copied over from the original. Save this texture, and you're done!

We have now completed the Paintshop Pro phase of this project. Next, we will move on to creating the windows in Train Sim Modeler.


Part Two - Train Sim Modeler Modifications

Here we have the finished locomotive, sans transparent windows. As mentioned previously, the windows are nothing more than a white tint to conceal in interior.

We now have to modify the cab to allow us to see through it. Start by pulling up the project, and selecting the cab.

We need to make an exact copy of the cab. Why? When we assign a material to the model, we can really only assign one material at once. If we were to assign a transparency to the cab without creating a cab interior, when we looked through the cab, you would notice that the opposite sides would be transparent too.

Once we have the cab selected, hit CTRL-C on the keyboard to copy the cab. Then hit CTRL-V to paste a new copy of the cab. Then hit F2 to get to the cab's properties. You will see the cab has been assigned the name CAB.1 (or whatever your cab was originally named). It is suggested that you rename the cab to something more meaningful, such as CAB INTERIOR. Once you have done that, click OK to return to the edit screen.

The next thing we need to do is to make the cab interior slightly smaller than the exterior cab. We do this so that the textures do not interfere with one another. Hit S on the keyboard to start the scale mode. Next, drag the mouse so that the cab will begin to shrink. Shrink it so that it is only a few pixels smaller than the exterior cab. In this image, we have shrunk the cab slightly:

Now that the cab has been reduced, we now need to flip all of the polygon faces so that they are pointing inward. This needs to be done because the material is not double-sided, and you wouldn't see the opposite side of the cab if you left the faces pointing outward. With the cab selected, click on the FACES icon on the toolbar. It is the icon that is shaped like a triangle.

If you are in a single view mode, it might be a good idea to go back to the quad-window view. It makes it easier to keep track of where you are in the part, and which way the face is flipped.

Looking at the front view, you will see that this face is flipped outwards. You can tell which way the face is facing based on the white line leading out from the face itself:

Flip each face by hitting F on the keyboard, and then either N for the next face or the arrow keys. Do this until all of the faces have been flipped inward. When complete, go back into part mode (the 3d cube on the toolbar).

Once all of the faces have been flipped, we have to re-apply the textures. Remember when I recommended to copy the texture and just change the colours? There is another reason why this should be done. When you go to map the faces (by hitting F4), all you need to do is change the name of the file to obtain the map. Copying makes it easier, because the co-ordinates are already mapped.

I pulled out the cab interior to show something important. Take a look at this picture:

Notice anything strange in the picture? If you look closely, you'll see that the front windows are actually in the back of the cab. This happened because when you flipped the faces, it also flips the orientation! This is important to note because if you where to run the locomotive in MSTS with the orientation in this position, your outside and inside windows would not line up properly!

There is an easy way to fix this. While you are in Part mode (the 3d square on the toolbar), select TRANSFORM -> FLIP -> Flip Z. This will reverse the textures, and should orient everything properly.

We are in the home stretch for the transparent windows! The final step is to assign a transparency level to the interior and exterior cab. Since we have the interior cab selected, let's fix this one first. With the cab selected, hit F2. This will bring up the part properties. On this dialog box is a button marked MATERIAL. This is how you control your translucency on the model. Click this button, and a whole host of options will appear.

The materials you should use for the interior all have the minus sign (-) at the end of them. If you wish to have the cab lit up at night (it looks pretty neat), select ALPHAHLFBRT-. You could select ALPHABRT-, but that would make the cab too lit up. Click OK to select this material, then click OK to close the parts dialog box. You have just assigned tranlucency to the interior!

Finally, let's change the exterior cab to match. Select the exterior cab, hit F2 and select the Material button again. Because this is the external texture, we need to assign a positive alpha to it (any property with a plus sign (+) beside it). For this example, we will select ALPHANORM+. There isn't much point to selecting anything with a light to it, since it would cause your cab to glow (unless its a radioactive train, then be my guest!). Click OK to close the material window, and OK again to close the Part dialog box.

WE'RE DONE! That's all there is to creating windows! Build this locomotive, then run it in MSTS - you'll be happily rewarded with transparent windows on your locomotive!