An Introduction to this Lesson

If you’ve paid any attention to increasing technology in video games as of 2005, odds are you’ve heard the term ‘normal mapping’ thrown around like nobodies business. Games like Doom 3, Half-Life 2, and F.E.A.R. all snatched up this great technique in order to shove as much detail down our throats possible without causing our computers to burst into flames from overload. In this lesson you will learn all about the basics of normal mapping and its upcoming debut in the Torque Shader Engine. So before we get started, it’s important for us to know and understand: What is normal mapping?

Normal Mapping in a Nut Shell

Assuming you have completed all of the previous tutorials here on the TDN, you should be quite familiar with the feel for 3D space by now. Vertices in this 3D space are each given a specific coordinate along an X,Y, and a Z axis. When you apply a 2D texture to your 3D model, you've given it a UVW coordinate. UVW coordinates are based per polygon, where U and V are the most important as they represent X and Y, while W represents how the texture will wrap around multiple polygons on the model in 3D space.

With normal mapping, an RGB bitmap image is encoded to have both XYZ and UVW coordinates. It will hold the placement of the textures where you've unwrapped them in UVW, but each pixel represents XYZ cooridinates by its color. Any red pixels will translate into an X coordiante, green a Y, and blue a Z. The result will be come out to be a trippy blend of these three colors, so take some time to stare at this example of a normal map to get a feel of how it will translate.

With this, you can take a very high polygon model and actually apply it's XYZ coordinates onto a lower polygon model. Both lighting and depth of the high polygon model will remain intact, so as you reach the end of this tutorial, be sure to create a simple light and rotate it around your low geometry mesh with the normal map applied. Alright, enough theory, let's get this tutorial started!

Let's get Started

Since this is not a modeling tutorial, it will be assumed that you already have your high and low polygon mesh and be ready to normal map it up. Once again, this tutorial is geared towards 3D Studio Max, but can be easily applied to most all other modeling applications. For this lesson, I've built a very simple wall panel for tiling and importing to TGEA. You want to make sure you keep your models centered from the start for the least amount of pain when creating your normal maps. Also, one thing you need to remember is NAME YOUR OBJECTS! I can't stress enough how much easier all the sorting will be if you have everything properly named. So here I have a basic layout of the the high polygon model right next to the low polygon one (this is just to show you both of these, in reality they are to be stacked ontop of eachother, which you will see in later shots).


You first task upon completing the models is to unwrap your low poygon model. There are other tutorials that cover that here on the TDN, so I will skip right over that part. Ok, so you have both models and the lower polygon one unwrapped: Now what? With the low polygon model selected, press 0 or click Rendering-> Render to Texture. The next few screens are much better shown that described, so try to follow the screenshots as accuratly as possible or your results may not come out the same.

Click 'Setup' in 'Render Settings'

In the 'Renderer' tab, 'Enable Global Supersampler'

Close out the 'Render Settings' and pan down to the 'Projection Mapping' section. Click to enable Projection Mapping and then click 'Pick' to pick the high polygon model.

Pick the high polygon model and click 'Add'.

Pan farther down the 'Render to Texture' windo and click 'Add' in the 'Output' section. Then, click 'NormalsMap' and 'Add Elements'.

Pan even farther and you will see that you can name and chose your output settings of your normal map. Also, choose a size you want the normal map to render to (keep in mind that larger maps create a larger hit on performance, and never go above 1024).

Clicking out of the 'Render to Texture' tab, go back over to the 'Modify' tab and drop the 'Projection' stack to select the cage. What you will be doing is using the vertex selection to grab the cage surounding your low polygon object and scale it so that it consumes both the high polygon model and itself.

Here is what the cage should look like when finished; completely boxing in both meshes.

Finally, open back up the 'Render to Texture' tab and pan all the way to the bottom. Make sure you're in the proper viewport to render out the front of the mesh. Hit 'Render' to render your normal map.

A dialog window will come up like so; Continue anyways.

WTF Kovac?! It's only a render of your stupid mesh! That doesn't look anything like the normal map you showed earlier! Well that's because it isn't the normal map. Hop into your '3dsmax' folder and jump into the 'Images' folder. And ah, there it is in all its glory. A perfectly normal mapped...thing.

Hide your high resolution mesh. In the material editor create a new Standard material and apply it to the low resolution mesh. Click on the Bumpmap field in the Maps section and select Normal Bump. Under the Normal field select Bitmap and pick the texture that you just rendered out.

Place an Omni light in the scene and you should see results something along the lines of this:

So what you're trying to say is...

Well that's about it. You now have a normal mapped texture that you can apply along with a texture to anything your little hearts desire. In later tutorials, you will find out how to import the normal maps onto .DIF objects via a CS file, which you can then drop it into TGEA's Mission Editor. Also, another later tutorial will show how to export a model in .DTS format and apply it to get those working with normal maps in TGEA as well. Good luck!