Thursday, January 15, 2009

Creature Modeling, Part 6: Painting Diffuse and Glow Maps

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.

So far, we’ve created a skin mesh, rigged it to a skeleton, mapped its UVW coordinates, and given it a normal map. The color of the creature we’re modeling has been gray this whole time, however. As we shall see, adding a diffuse map to the model can make it much better looking. Subtle use of a glow map can boost its creepiness as well. Here, we discuss how to create and apply a diffuse map and a glow map to the model.

Rendering the UVW Template

When painting the diffuse map, you may need to start with your model’s UVW template, which shows which parts of the texture maps are rendered on which polygons. Here’s how to render the UVW template.

  1. Step 1In 3DS Max, load your model and click its Unwrap UVW modifier. Click the “Edit” button, which is under the “Parameters” rollout of the modifier. This will cause the “Edit UVWs” window to appear. Click the “Tools” menu and select “Render UVW Template.” The “Render UVs” dialog box will then appear.

  2. Step 2Input the width and height in pixels of the image to be generated. These must correspond to the dimensions of your texture maps. The width and height must always be equal, and this number must be generated from powers of two; e.g., 256, 512, or 1024. Click the “Render UV Template” button to bring up the “Render Map” window.

  3. Step 3.aIn the “Render Map” window, click the icon that looks like a floppy disk. (It’s the leftmost icon at the top of the window.)

    The “Browse Images for Output” dialog box should then appear. Save the template in a format that can be read by your image editing software.

    Step 3.b

Painting the Diffuse Map

  1. Load either the UVW template or the normal map in your image editing software. You’ll need one of them as a reference for the placement of features such as eyes, nostrils, wounds, tattoos, piercings, etc. If you need both of them, put them in separate layers in the same file.

    Step 4

  2. Step 5Paint over the image to establish the placement of the main features of the model. Don’t try to paint any details yet. At this point, you just want to get the main features blocked in.

  3. Output the image as a DDS (DXT5) file with nine mipmaps and put the file in your NWN2 override folder. You may either save it under the same name as the diffuse map that your model already uses, or you may edit your model to use the new diffuse map. If you choose the latter, you’ll have to store the revised MDB file in the override folder as well.

  4. Step 7Run the NWN2 toolset and view the model in it. Make sure that the colors of the main features are not displaced. If they are, correct your image file and try again.

  5. Step 8Paint more details over the diffuse map. If you’re striving for realism, you may want to manipulate photos over the image to make them fit over the main features.

    Creating textures is an art in itself. Not all 3D artists are good at painting textures, and not all texture artists can construct 3D models. If you need to bone up on this skill, you may want to search the Web or read books for more information.

  6. Step 9Check out your model in the toolset again. Make corrections as needed. At the end of this process, you should have a diffuse map that you’re happy with.

Creating a Glow Map

  1. Step 10If you need a glow map, you can base it on your diffuse map. My glow map is basically the diffuse map with the addition of an alpha channel that indicates which parts of the texture are supposed to glow. If your image doesn’t have an alpha channel, add one. In Photoshop, you can do this by clicking the “Channels” tab at the right side of the screen and clicking the “Create New Channel” icon at the bottom.

  2. Step 11In the alpha channel of any glow map, the regions that should be glowing are painted in white. Everything else is black. For my model, I wanted the eyes of the model to glow, so I painted a couple of white circles where the irises should be. If you’re using Photoshop, you may want to make the RGB channel visible so you’ll know where the eyes are.

  3. Save the image as another DDS file (same parameters as before) and put it in your NWN2 override folder.

  4. Edit your model in 3DS Max and press the [M] key to bring up the Material Editor. Add the glow map to your model under “Self-Illumination.” Export the model as an MDB file and put it in your NWN2 override folder.

  5. View your model in the toolset to make sure that the glow effect is done to your liking. If you find that the glow is too bright, you may need to darken the color of the glowing region. (In terms of defining a color as a combination of hue, saturation, and brightness, you’ll have to lower the brightness of the color.) Correct the glow map if necessary until you’re satisfied with the results.

Like makeup on a person’s face, diffuse maps (and optionally, glow maps) can do much to alter a creature’s appearance. It takes skill and patience to paint a good diffuse map, however. Just as makeup can make a woman look elegant or cheap depending on how it is applied, diffuse maps can make models look great or amateurish. It’s well worth the effort to spend time on perfecting this art.

We’ve covered a lot of ground, but we’re not done yet. There are still a few issues to tackle, such as levels of detail and 2DA entries. We’ll discuss these issues in my concluding write-up.


E.C.Patterson said...

Seeing the evolution of the model, and yours too, is interesting in its own right. Getting to see it in action in game for real eventually will be quite a kick.

Anonymous said...

A most excellent Animation Tutorial you've been posting during these latest months! Liksewise I hope will encounter some new creatures in your promising campaign , Also will you shed some light on how the campaign itself is progressing? I'm sure you have a big part of the NWN fans eagerly awaiting your campaign. Good luck and God's speed.

Nidal Telin

Jclef said...

This is looking excellent, man - great job on the texture. And thanks for the ongoing tutorials as well! :)

Frank Perez said...

Glad you like this stuff I'm making, guys - both the tutorial and the model. :D As E.C. mentioned, both the model and my skills are evolving simultaneously. When I'm done with this creature, there'll be other models with which I can hone my craft.

@Nidal Telin,

I will certainly blog about the module we're making as the weeks go by, though I can't reveal anything vital concerning the storyline. I hope a lot of players enjoy it once we release it at the Vault.

Anonymous said...

The thing I had in mind was some information about how much of the module that is completed or close to complete or something like that , giving us a clue about how close to release it might be :) once again Good luck and God's speed.

Nidal Telin

Frank Perez said...

@Nidal Telin,

I think I can post an occasional progress report, although it's not likely to be very accurate. Target deadlines have a nasty habit of moving forward when you're not watching. We're targeting something like an April release maybe, but that's still tentative. We'll keep our fingers crossed. :)

Anonymous said...

i am working on a drow hand x-bow and having some issues getting it in-game with the tapzn exporter.
can you tell me what this means:
"If you haven’t set the normal and diffuse map of your model as a material, do so now."

specifically, how do i do that?

when i use the tapzn exporter to export my model i get a .mdb file but no associated texture files as i would expect...


Frank Perez said...


It looks like you got that quote from my blog post on creating a rusty metal texture. Anyway, you assign the normal and diffuse map through the Material Editor in the bump and diffuse color slot, respectively. From our recent exchange of posts at the Bioware forum, I know you've already figured it out. ;)