Methods for Creating Normal Maps
In the first tutorial, I outlined two methods for creating normal maps. On page 4 of the first tutorial I discussed converting a bump map to a normal map in Photoshop. On page 5 of the tutorial I explained how to generate a normal map from a high and low detail model using ATi's NormalMapper program. In this section I'll explain some additional (and better!) methods for creating normal maps.
Normal Mapping Tools in 3DS Max 7
3ds Max 7 ships with some pretty impressive tools for creating normal maps of all types. Since I got the beta version of Max 7, I haven't used NormalMapper anymore. Max's tools are just very good and very easy to use. (There are some bugs in Max 7's shaders for displaying normal maps though. I'll discuss those on page five of the tutorial.) Ben Mathis has written a great tutorial for creating normal maps using the tools in Max 7. You can find it here. Thanks Ben!
Normal Mapping Tools in Maya 6
Maya 6 has some great tools for creating normal maps. Jeff Parrott has a simple tutorial on his web site that shows how easy it is to use the normal mapping tools in Maya. You can find his tutorial here.
Normal Mapping Tools in Softimage XSI
I think that XSI was the first major 3D authoring app to feature tools for creating normal maps. Bartek Dabkowski has created a tutorial that shows how to use these tools. You can find it here.
Normal Mapping Tools in Lightwave
While Lightwave doesn't have any "built-in" tools for generating normal maps, it has a very flexible plug-in system. Marvin Landis has taken ATi's NormalMapper and turned it into a plug-in for Lightwave's Modeler. He even wrote a nice interface for it! You can get his plug-ins here.
Nvidia has created a tool called MeLODy that can create normal maps. It also automates the process of creating LODs. You can get it here. To create a normal map for your model using MeLODy, install it and follow the steps below:
If you don't get the results you were hoping for, MeLODy has a host of settings for tweeking the way the normal map is created. You can find a detailed description of the settings and how to use them in the User Guide that comes with the MeLODy installation.
- Create a high and a low res version of your model. The low res version needs UV coords.
- MeLODy supports OBJ or 3DS format so export both of your models in one of those two formats.
- Open MeLODy and click the "Normal Map Settings" button.
- By defualt, MeLODy is set to create its own set of texture coordinates for your low res model. You can leave it that way if you want, but most artists prefer to use their own texture coordinates. You can use use your own coordinates by choosing "Use Existing Normal Map Texture Coordinates." Click the "Close" button at the bottom of the panel.
- Now you're going to load in your models. In MeLODy, the low res model is called the "Working Model" and the high res model is called the "Reference Model." Click the "Load Working Model" button and browse to the location of your low res OBJ or 3DS file. Now that the low res model is loaded it will appear on the right side of the viewport.
- Click the "Load Reference Model" button to load the high res version. Browse to the location of your high res OBJ or 3DS file. The high res model will appear on the left side of the viewport.
- Now you're ready to generate your normal map. Just click the "Generate Normal Map" button and MeLODy will create a normal map for your low res model using the normals of your high res model.
- Once the normal map is finished, you can see where it has been saved by clicking on the "Console..." button.
Creating A Normal Map Right In Your 3D App
Did you know that you can create a normal map in ANY 3D program? You don't need any special plug-ins or exporters or extra tools at all when you create a normal map with this technique! I'll explain how to do it, but first there are a few limitations:
This technique is really good for environment normal maps like bumpy ground, rock walls, bricks, metal panels, etc. I'll explain the steps to set it up for 3DS Max, but you can do the same thing in ANY other 3D program. Here's how to do it:
- Your low res model must be a flat plain.
- The low res model must have a planar UV projection (flat texture coordinates).
- You can't use this for characters that have specific unwrapped texture coordinates.
Here's what the scene looks like when it's all set up:
- Open 3DS Max and create a directional light. Rotate it in world space to 0,-90,0. Set the light's color to 255,0,0 (red). Set the multiplier to -0.5.
- Create another directional light. Rotate it in world space to -180,-90,0. Set the light's color to 255,0,0 (red). Set the multiplier to 0.5.
- Create a third directional light. Rotate it in world space to 90,-90,0. Set the light's color to 0,255,0 (green). Set the multiplier to -0.5.
- Create a forth directional light. Rotate it in world space to -90,-90,0. Set the light's color to 0,255,0 (green). Set the multiplier to 0.5.
- Create one more directional light. Rotate it in world space to 0,0,0. Set the light's color to 0,0,255 (blue). Set the multiplier to 0.5.
- Select each of your lights and check the "Overshoot" box under Directional Parameters so they'll light things that are outside of their cone.
- Choose "Rendering->Environment..." In the Environment panel set the Ambient color to 127,127,127.
- Create a free camera. Set the camera rotation to 0,0,0 in world space. Click the "Orthographic Projection" check box so that the camera becomes orthographic (so it has no perspective).
- Now you create a high resolution model. Apply a material to the model that has a white diffuse color. When you render your model from the point of view of the camera, you'll get a normal map!
I like creating normal maps this way because they render much faster and I don't have to use any external software. I got the idea for this technique from this web page:
If you're having a hard time setting it up, you can download a sample file for Maya, Max, or Lightwave at the bottom of that page.
Using My Normal Map Shader In 3DS Max 6 and 7
When you boil it down, a normal map is just an image of your high res model where every pixel is colored to represent surface direction instead of surface color and lighting. With this in mind, all you really need to create a normal map is a material or shader on your high res model that gives you normal colors instead of surface colors. I've written a shader in HLSL FX format that does exactly that. You can grab it here. When you apply that shader to your model in 3ds Max 6 or 7 (follow these instructions to apply it) you get an instant normal map. Just take a screen shot of your model, open it in an image editing program, crop it, and save it out. You're all done!
The main draw back to this method (and the previous one also) is that you can't make a normal map that wraps around a 3d character. This technique is best for creating tilable normal maps that you're planning to apply to the environment.
Normal Map Formats
Since a normal map is a way to use color data to represent surface normals, there are several ways that the color data can be used - or several normal map "formats." In order for your normal map to give you the correct results, the program that generates the normal map and the program (or shader) that uses the normal map must use the same format.
Tangent Space vs Object Space vs World Space
The main way in which normal map formats differ is in what "space" they use. "Space" refers to the point of reference for the X,Y, and Z values (the R,G, and B of the normal map). All of the info that I've been discussing in my tutorials so far has been covering normal maps created in "Tangent Space."
Tangent Space normal maps use texture coordinate space, so X and Y are the U and V of the texture coordinates and Z is the surface normal. Tangent space normal maps appear mostly light blue (127,127,255) because the Blue channel represents the direction that the underlaying model surface is facing. The red (X) and green (Y) channels are for offseting that direction. Tangent Space normal maps are best used on characters that deform and when tilable normal maps need to be applied to curved surfaces in the environment.
Object Space normal maps use the orientation of the model as their X, Y, and Z. Y is most commonly in the direction of the top of the model while X is to the left of the model and Z in the direction the model is facing. Object Space normal maps usually appear rainbow colored because they represent normals that face in every direction instead of just a 180 degree hemisphere like Tangent Space normal maps. Object Space normal maps can be used on rigid objects that need to rotate and have a unique set of texture coordinates (not a tiled texture).
World Space normal maps are very similar to Object Space normal maps - except they use the X, Y, and Z of the world as their coordinates. They also appear rainbow colored. Because they depend on the world coordinates, you can't rotate a model with a World Space normal map and have the lighting still appear correctly. For that reason, World Space normal maps can only be used on static objects that have a unique set of texture coordinates.
In my opinion, Tangent Space normal maps are the best. They can be used for everything. You can apply them to deformable characters, rigid objects, and world geometry. Unlike Object Space or World Space normal maps, Tangent Space normal maps can be created to be tilable and then applied anywhere - on the walls, ceilings, floors, etc. They are a bit more expensive computationally, but this extra expense is insignificant on today's graphics hardware.
Positive or Negative Y
When using Tangent Space normal maps, the most common difference in formats is the direction that the green channel is lit. Some programs light the green channel from the left (postive Y) and others light the green channel from the right (negative Y). Some programs give you the option to choose positive or negative Y. If your normal map isn't being lit correctly, the first thing that you should try is to flip the green channel. Just open the normal map in Photoshop, select the green channel, and choose "Invert." That will give you the same result as if you had rendered the normal map in the other format.
So there you have it: A bunch of extra stuff about generating normal maps! Now I bet you're asking yourself, "If my normal map has problems, can't I just open it in Photoshop and paint out the errors?" The answer is a most definite and totally confident "sort of." :0) There are a few things that you should know about editing your normal map in a paint program. I'll discuss those on the next page.
Page 1: Introduction
Page 2: Tips for Creating Models
Page 3: Methods for Creating Normal Maps
Page 4: Tips for Editing Normal Maps
Page 5: Tips for Applying and Using Normal Maps