Monday, January 12, 2009

Creature Modeling, Part 5: Normal Mapping

This is a continuation of my series on building creature models for NWN2. Those who haven’t read the start of the series may want to refer to my previous blog posts.

Having created a UVW map for our model, we can now texture it. The NWN2 engine uses four kinds of texture maps for its models:

  • Diffuse – Diffuse maps, along with tint maps, set the colors of an object. In the absence of a tint map, the diffuse map will completely determine what colors an object has.

  • Normal – Normal maps are used for making low-poly objects look more high-poly. Normal maps seem to raise or lower the surface of an object like carvings on a bas relief. This is done without straining the graphics engine the way a high-poly model would.

  • Glow – Glow maps identify what parts of an object glow and how intensely they glow.

  • Tint – Tint maps identify which parts of an object may be tinted. Tint maps will not be discussed in this tutorial because the creature I’m making doesn’t need one. Those who want to know more about this topic may read what Heed has to say.

Of these four types, only the Diffuse and Normal maps are required for all models. This blog post will show how a normal map may be created. In broad terms, the steps to be done are the following:

  1. Create a detailed, high-poly version of the model.

  2. Map the high-poly model to the low-poly model.

  3. Check the low-poly model in the toolset for any problems the normal map may have.

A. Creating a High-Poly Model

You can use any modeling software to create a high-poly version of your low-poly mesh. Here, I’ll explain how to do it with ZBrush.

  1. Run 3DS Max and load the MAX file that you worked on during your last session. Click the head mesh to select it then go to the “File” menu and click “Export Selected…” Export the mesh as a Wavefront Object.

  2. Run ZBrush and import the OBJ file that you had saved.

  3. Step 3We’re about to subdivide the mesh, but before we do, we need to “crease” it. In the “Tool” menu, click “Geometry” then click the “Crease” button. This will prevent ZBrush from creating wavy edges around parts of the mesh that have holes in them.

  4. Subdivide the mesh by pressing [Ctrl]+D three or four times. This will add more polygons to the mesh.

    Step 4

  5. Embellish the high-poly model with as many details as you like.

    Step 5

  6. Export the mesh as a Wavefront Object.

B. Mapping the High-Poly to the Low-Poly Model

  1. If you aren’t running 3DS Max anymore, run it and load the MAX file you’ve been working on.

  2. Import your high-poly model. Make sure that the low and high-poly models overlap as closely as possible. Note that loading the high-poly model may take a while. The one shown here took 17 minutes to load on my computer.

    Step 8

  3. Step 9Select the low-poly model then press the [0] key. This will cause the “Render to Texture” dialog box to appear with the low-poly model already selected.

  4. Step 10Click the box under “Projection Mapping” beside “Enabled” to put a checkmark in it. Under “Mapping Coordinates,” click the button beside “Use Existing Channel” for both “Object” and “Sub-Objects.”

  5. Step 11Click the button labeled “Pick…,” which is under “Projection Mapping.” This will cause the “Add Targets” dialog box to appear. From the list on the left side of the window, click the name of the high-poly mesh you had imported then click the “Add” button. The “Add Targets” window will then close. Note that a “Projection” modifier is automatically added to your low-poly model. We’ll deal with this modifier later.

  6. Click the button labeled “Options…” This will bring up the “Projection Options” dialog box. Under “Filtering Options,” click the “Setup…” button to bring up a new dialog box.

    Step 12

  7. Step 13In the new dialog box, look under “Global SuperSampling” and click the box beside “Enable Global Supersampler” to put a checkmark in it. Close the dialog box then close the “Projection Options” window.

  8. Scroll down the window until you see the “Add” button under “Output.” Click the button. In the dialog box that appears, click “NormalsMap” then click the “Add Elements” button. This will cause the dialog box to close.

    Step 15

  9. Step 14Scroll further down the “Render to Texture” window until you see six buttons under “Use Automatic Map Size.” Click the button that corresponds to the size in pixels of the normal map to be generated. For my model, I chose 512, which is good enough for run-of-the-mill monsters. While you’re at it, set the list box labeled “Target Map Slot” to “Bump.”

  10. Step 16Go to the Modifier panel. (You don’t have to close the “Render to Texture” window just yet.) Click the “+” sign beside the “Projection” modifier to expand it then click “Cage.”

  11. Step 17.aScroll all the way down the Modifier panel then click the “+” sign beside the “Cage” rollout to expand it. Now click the “Reset” button. Under “Push,” click the button with the upward-pointing arrowhead beside “Amount” until the blue “cage” completely surrounds the model as seen in the viewports.

    Step 17.b

  12. Click the “Render” button at the bottom of the “Render to Texture” window. (If you closed it earlier, press the [0] key to bring it back.) This will cause a normal map in TGA format to be output to the Image folder in your Autodesk\3dsMax installation.

    Step 18

  13. Because the way NWN2 interprets normal maps is slightly different from that of 3DS Max, we need to invert the red channel of the normal map. Edit your normal map in your preferred image editor. If you are using Photoshop, click the Channels tab on the right of the screen then click the channel labeled "Red" and press [Ctrl]+I to invert it. Click the channel marked "RGB" to return to RGB mode and save your normal map.

  14. You may convert your normal map to a DDS file (DXT5) with 9 mipmaps using an image converter program. (The first part of my tutorial series mentions a couple of free ones that you may download.) 3DS Max also has an option to output the normal map directly as a DDS file, but to the best of my knowledge, you won’t have any control over the number of mipmaps generated.

    When you’re done, move the DDS file to the NWN2 override folder. You may now close the “Render to Texture” window.

C. Testing the Normal Map

  1. Select your low-poly mesh and press the [M] key to bring up the Material Editor. Assign your new normal map to the Bump material of the model. Close the Material Editor when you’re done.

  2. Export the model as an MDB file. Make sure that the file name matches the name of the model. Copy the file to your NWN2 override folder.

  3. Step 21Run the toolset and create a small exterior area. Put a ghoul in the area and zoom in on it. Because we’re modifying the ghoul model as a quick way to test the creature we’re making, we should see the creature’s head on the ghoul body. Make sure that the new normal map displays properly on the creature’s head.

  4. If you notice any problems with the normal map, you may have to correct it in 3DS Max. Once the normal map meets your approval, delete the high poly mesh from your model and save it as a MAX file.

Is it worth the effort to make highly detailed normal maps for your models? Let your eyes be the judge.

BeforeAfter
BeforeAfter

Normal maps can make low-poly models look far more complex than they really are. Nevertheless, without properly applied color, even highly-detailed models will look drab at best. In my next blog post, I’ll show how to create diffuse and glow maps for the creature we’re building.

Edit, 3 May 2012. I edited this blog post to include a step on inverting the red channel of the normal map (step 19).

4 comments:

Lance Botelle (Bard of Althéa) said...

Frank,

These look like some great tutorials. I recognise now that you need to put aside a whole slot of time to do what you are doing though.

Once complete, have you thought about putting it into a manual and uploading it to the Vault?

This would have been very useful for when I was looking a while back.

Lance.

Frank Perez said...

Hi Lance, I am considering putting up this tutorial at the Vault, but I'd like to get a little more experience under my belt before I do. Astute readers may notice that the model shown at each blog post in this series is not the same model all throughout. That's because I've been revising the model as I learn more about this topic. I'm really a novice at 3D modeling. Truth to tell, I'm still learning new things as I write these posts. As you've guessed, this activity is very time-consuming, but it's also immensely fun. :)

Wyred said...

Necropost, but I'm following the directions for creating normals from a this thread and running into an issue. Any idea what I'm doing wrong here based on the output?

http://img208.imageshack.us/img208/237/phhmhead84n3ds.jpg

Frank Perez said...

I almost missed the above comment.

Anyhow, I can't access your pic. This is all I see.