Saturday, March 28, 2009

Reconstructing Arizona

A few of the areas in Shattered Dreams were inspired by the Arizona desert, of which we gathered several photo references. Anduraga was not happy with the cliff textures that come with the game, so he requested that some new ones be done based on the Grand Canyon. I took a break from 3D modeling to try my hand at creating terrain textures. It wasn’t easy for me to find information on the image files that comprise them, so Dirtywick passed me information that he found at the Rogue Dao website. When I was done, I quickly assembled a test module to see how my cliff textures look in the game. I rather like the way the textures turned out. I created two cliff textures that can actually be used together fairly seamlessly even at 100% pressure.

The landscape shown here won’t appear in Shattered Dreams, by the way. This area is strictly for testing purposes. Besides, this place is decidedly less grand than the canyon that inspired it. Hopefully, our area designers can make better use of the textures that I made.

The two rock columns shown here were modeled by Nytir and textured by Palafoxx. Shattered Dreams is brimming with lots of custom models, and more are in the works. I’m hoping that the other members of the team will take screenshots of actual in-game areas with the new models in place.

Wednesday, March 25, 2009

Rusty Metal: A 3D Modeling Tutorial

In my last blog post, I showcased a creature model wearing rusty metal armor. In the process of texturing the model, I figured out a few techniques for achieving the surface look that I wanted. In this blog post, I explain the process of creating the rusty metal look.

This tutorial assumes that you have the following software:

  • An image editor that can handle layers and channels such as Photoshop or Gimp as well as a plugin for converting image files to normal maps. I use Photoshop, but the operations explained here can also be done in Gimp, albeit with different commands.

  • 3D Modeling software that can import and export MDB files such as 3DS Max with Tazpn’s MDB plugin

The tutorial also assumes that you already know the basics of normal and diffuse mapping and that the model you’re working on already has a UV map in place. The tutorial also assumes that you know how to use your software. I won’t explain how to create alpha channels or how to set overlay layers.

When you’re ready, do the following steps.

  1. Step 1Create a normal texture representing the embossed and engraved patterns on the surface of your model. Note that the surface marks due to rusty metal are not yet accounted for in this normal texture. We’ll include those later.

  2. Download or create a rusty metal texture. Some excellent textures are available for download if you search well enough. Before using downloaded textures, make sure that you’re allowed to use it for whatever purpose you intend. Some textures are available for non-commercial use only, which is fine if you’re modding NWN2. Other sites may not be as generous regarding their terms of use.

  3. Step 3In your image editing software, tile your chosen texture so that the image is the desired size of your diffuse map. If these tiles are created from separate layers, merge them to form a single rusty metal layer.

  4. At this point, the diffuse map covers the entire model with a rusty metal texture. If there are other areas of your model that use different textures, create a new layer over the metal layer for each additional texture that your model needs and paint over them.

    Step 4aFor the texture I’m making, the new texture layer appears as shown here. Note that all areas not covered by the texture are transparent (which, in Photoshop, is indicated by a gray-and-white checker pattern).

    Step 4bWhen both layers are visible, the resulting image appears as shown here.

    We’re done with the diffuse map. You may now save it as a TGA or DDS file. (DDS files are smaller and should generally be the format of choice for your texture files.) You’ll have to refer to your original file with its separate metal layer as well, so you may want to save it in the native format of your image editing software just to be safe.

  5. Step 5From your original diffuse map file, duplicate the rusty metal layer to a new window. Now create a normal texture out of this image. This normal texture will show as pits, scars, and surface bumps on the metal surface. Rather than explaining how to do this, I’d like to refer the reader to this excellent tutorial. Continue to the next step when you’re done.

  6. Step 6Copy the new normal texture as a layer over the first normal texture that you created in Step 1. Set this layer as an Overlay layer so that the rusty metal surface is added to the design pattern of the first normal texture. Note that you may have to erase parts of the overlay layer that cover areas that are not of rusty metal.

  7. If the normal texture does not already have an alpha channel, create one. The alpha channel of a normal map controls how much light is reflected from each area of the model. White areas on the alpha channel reflect the most light in the corresponding surface of the model, and black areas on the alpha channel reflect the least light. How much light the shades of gray on the alpha channel will reflect depends on how dark they are. On the alpha channel, we want the rusty parts of the metal surface to be black and the non-corroded parts of the metal to be white. The non-metallic portions of the model may be represented by black, white, or shades of gray on the alpha channel depending on the type of material they are supposed to be made of.

    Don’t even think of painting the alpha channel by hand. The rusty texture is much too complex for that. Do the following steps instead to paint your alpha channel.

  8. Step 8From your original diffuse map file, duplicate the rusty metal layer to a separate window just as you did in Step 6. With the new window active, click the Channels tab at the right side of the screen. Select the Blue channel and copy the grayscale image to a new window.

    We choose the Blue channel because of the different color qualities of sheet iron and rust. Sheet iron that has not corroded is grayish, which means that it has a relatively even mix of red, green, and blue light. Rust, on the other hand, is orange, with variations across the range of red to yellow. Everyone knows that red and yellow, when mixed together, make orange. Not as many people realize that when you mix red and green light together, you get yellow. (Mixing red and green pigment, not light, results in a grayish color, but that’s neither here nor there.) In the blue channel, everything bluish appears lighter and everything with a predominance of red or green appears darker. Hence, in the Blue channel, rust will appear darker than iron that hasn’t corroded.

    What we want to do now is to darken the rusty areas to almost pure black and lighten the non-rusty areas to almost pure white.

  9. Step 9With the newest window active, duplicate the layer that has the grayscale image. Set the upper layer as an Overlay layer. Duplicate this Overlay layer several times to sharpen the contrast of the image. (In my case, I created nine copies of the overlay layer before deciding to stop.) Merge all the layers together.

  10. Step 10Adjust the image’s brightness and contrast by cranking both as high as you can.

  11. Step 11Add another layer on top of the image and paint over it so that the non-metallic sections of the normal map are represented. Whether to paint those sections black, white, or some shade of gray will depend on how much light you want to reflect off the non-metallic sections.

    Merge all layers when you are done.

  12. Copy the entire image to the alpha channel of your normal map. Save the resulting image as a TGA or DDS file (preferably the latter).

  13. Step 13Open your model in 3DS Max and access the Material Editor. If you haven’t set the normal and diffuse map of your model as a material, do so now. Make sure that this material is currently selected.

    Under “Blinn Basic Parameters,” set the Specular Level to a value between 40 and 50 inclusive. This will set a fairly strong highlight on the model. Set the Glossiness value to 100. This will concentrate the highlights over smaller areas of the model, which is good for simulating metallic shine. Assign the material to your model and export everything as an MDB file.

  14. Put your MDB and DDS or TGA files in your Neverwinter Nights 2 override folder. You may have to copy the Appearance.2DA file to the override folder and edit it to include your creature model. You may now view your creature model in the toolset or in the game. If all goes well, the rusty metal on your model should look fairly realistic.

Monday, March 23, 2009

A Hard Day’s Knight, Part 3

Three weeks. That’s how long I’ve been working on this armored creature model. I estimate that the model is about eighty percent done, which for all intents and purposes means that it’s completely done. Everything else amounts to patching flaws here and there that most players probably won’t even notice in the heat of battle. Discerning players may catch these flaws if they pause the game and scrutinize the creature in various stages of animation, but I’m hoping that most won’t bother.

When I envisioned this model, little did I realize what sort of hardships I’d undergo to create it. The entire mesh is composed of smaller meshes representing different armor parts – the breastplate, gardbrace, rerebrace, couter, tuille, and many other strange-sounding accessories that I won’t bother to list. The high-poly version of these armor parts are difficult to make because of the complex details in their design. Many of these components overlap other parts, so I have to make sure that no polygon pierces through any other polygon. This is hard enough to do when the model isn’t moving, but once it’s animated, it’s very frustrating to try to put polygons in their place.

This brings me to another problem: Rigging a model comprised of overlapping sub-meshes is very difficult. If there is a way in 3DS Max to make some elements invisible so I can easily weight the vertices underneath, I haven’t found it. I can make the entire mesh see-through, and I can switch to wireframe mode, but these are no substitute for selectively hiding polygons while rigging.

Another problem I experienced stemmed from the animations that I recycled from NWN2. These animations have a wider range of motion than one would expect from an armored humanoid. To make use of these animations, the 3D artists at Obsidian Entertainment created armor designs that are much more articulated than real armor. Blissfully unaware of this situation, I constructed armor based on a more traditional design. I now realize that I’ve created armor that is much suppler than sheet metal has any right to be.

This just goes to show that with only five months of experience in 3D modeling under my belt, I’m still just an amateur. On the other hand, I think I did some fairly good texture work on the armor. The metal is rusted and pitted in some parts, and it shows pretty realistically in game. Some fancy Photoshop techniques went into the making of this texture, some of which I figured out on my own. I ought to document my workflow for creating this texture before I forget it all. I hope to have it done in my next blog post.

Because I couldn’t decide what color to paint the armor, I made it fully tintable. (Well, it’s tintable in those areas that aren’t corroded.) This will give the other members of the Shattered Dreams team a chance to make this creature as scary or silly as they want it to be.

To the actual members of the team who happen to read this blog post: Disregard the part about making the model silly. Please. This dude is meant to be seriously intimidating. If you’re not convinced, check out the picture below.

“Look, a player character. Nab ‘em, boys.”

Saturday, March 14, 2009

A Hard Day’s Knight, Part 2

It’s actually been a hard two weeks for me. I’ve been busy constructing a highly detailed mesh of the knight that I featured in my last blog post. Along the way, I made several changes over its original concept art. This is especially evident in the creature’s helmet. The one that I initially designed looked rather prosaic to me. I wanted a helmet that was more intimidating. Since Chaos Wielder and I had emailed each other recently about our drawing inspiration from H.P. Lovecraft, I thought of giving the helmet that calamari look that’s so in vogue among eldritch horrors. When I showed my work in progress to Dirtywick, he suggested adding horns to the helmet. I was skeptical at first, thinking that horns might detract from the helm’s cephalopod look, but it looked quite nice when I stuck them on.

Of course, the helmet wasn’t the only thing I worked on. I’ve tweaked, enhanced, or replaced every part of the model except for its head, which is now barely visible behind the helmet. Below is the final high-poly mesh of the creature. I’m going to construct a fully rigged and textured low-poly version next.

Sunday, March 8, 2009

A Hard Day’s Knight

Having finished the “dog” model that I featured in my last blog post, I immediately proceeded to construct the knight depicted in the sketch to the right. I soon found that making a high-poly armor mesh takes tons of work. I feel that despite having paid a lot of attention to the details on the armor, they still aren’t good enough. In particular, the armor on the hips, limbs, and feet need more moving parts or decorative ridges. I also have to make a helmet for this dude. I could spend another week just improving the model.

On the other hand, this mesh is better than anything I’ve created previously. I told my wife as much, and she said that my subsequent meshes are bound to be better than the one I’m currently working on.

She’s right of course.