Support>Tutorials>Graphics

Normal Maps and How to Make Them

RailWorks supports the use of normal maps. That sounds pretty good, I guess, but just what is a normal map? Is it ordinary? ..average? ..conventional? No, none of those. The "normal" in normal maps is used in the mathematical sense. In mathematics, normal refers to the direction perpendicular to a surface. In computer graphics, normal maps are used to affect the way light is used to make a plain, flat surface appear to have more detail than it really has. For example, we can make a model appear to be festooned with three-dimensional rivets, when in reality there's nothing physically there. If we tried to make all those rivets in our 3D modeling program, you can well imagine that our polygon count would go sky high!

Take a look at these two screen shots. They were snapped at different times of the day. Notice how the highlights and shadow effects vary depending on the sun angle.

Berk rivets 1 Berk rivets 2

The rivets, panels, smokestack rim, the cast steel texture of the smokebox and the "lumpy" sheet metal parts below the feedwater heater were all made using a normal map. The underlying modelwork is the usual, simple flat triangles.

Normal maps are a type of bump map. A bump map is a grayscale (black-gray-white) image in which the lighter shades represent detail that we want to appear to project outward from the base surface. A normal map is a three-channel (red-green-blue) image. As with a bump map, the lighter the color, the more the detail appears to project out from the surface. The advantage of using a three-channel map is that each channel affects the detail in the x, y, and z directions, corresponding to each of the three color channels.

Let's make a normal map. You'll need three things: a paint program, a normal map plug-in, and a conversion utility. A normal map plug-in is available from NVIDIA. There are be other ones around, but you'll have to hunt for them. NVIDIA supplies plugins that work with Adobe Photoshop, GIMP, and Paint Shop Pro prior to version 9. Download a copy of the NVIDIA plug-in here.

We'll start with our base texture map.

base image

Here we see a circular array of rivet images representing, perhaps, the end of a cylindrical tank or heat exchanger. First we need to make a grayscale bump map. Add another layer, then use a brush to paint white dots over each rivet.

white dots

Now add another layer between the base layer(s) and the white-dot layer. Fill it completely with black.

black and white

That's your first bump map! Save your work. Then save it again, this time as a BMP image. You can close the original texture file now. Open the BMP image that you just made. Hopefully you've installed the NVIDIA plug-in. It should appear in one of the menus. In Photoshop you'll see it in the Filter menu as NVIDIA Tools. To convert the bump map to a normal map, run the plug-in. This is what you'll see.

NVIDIA plug-in

You can the default settings, shown here, or you can increase the Scale factor to enhance the effect. Notice the thumbnail at the upper left showing what the converted image will look like. If you see white or transparent areas there it means you're probably using a layered format such as a non-flattened PSD. Your artwork should be in BMP format.

Click OK on the NVIDIA plug-in. Your bump map has now been converted to a normal map and it should look like this.

normal map

Save the resulting image as a RailWorks ACE file, with MIPS turned on. Make sure you follow the recommended naming convention, appending the file name with _nm. For example, if your texture map is named MyTexture.ace, the corresponding normal map would be named MyTexture_nm.ace. The _nm suffix tells the Asset Editor exporter not to compress the normal map file since doing so would cause a certain amount of information in the file to be lost. That's it!

[Home]