Monday, April 27, 2009

Behold a Pale Horse, Part 3

I've been working hard on this "horse" model, grabbing what little free time I have just to finish it. The rig isn't perfect, but the model will need only a few tweaks here and there to be done. I lack sleep and can hardly write coherently, so I'll let my screenshots do all the talking. Together, they should be worth a couple of thousand words, more or less.

Tuesday, April 21, 2009

Behold a Pale Horse, Part 2

I’ve finally added barding to the creature that I showcased in my last blog post. With armor on, this model looks a lot more like a horse than a greyhound sort of thingy. Much of the detail work that I did on the creature’s body is now lost under its barding. I don’t know if this monster looks scarier naked or armored. I’m tempted to have both versions of the creature in the module, but I don’t know if the monster in the buff has a place in the story. We shall see.

My next blog post will feature a playable version of this creature. I hope it won’t take me long to create so I can move on to my next 3D model.

Friday, April 17, 2009

Behold a Pale Horse, Part 1

I can’t seem to get myself out of creature modeling. I tried making a placeable object for the first time and wound up turning it into a creature. Currently, I’m building critters of the four-legged variety once again. The concept sketch shown on the right is of a horse. At least I think it’s a horse. It’s either that or a really large, armored greyhound. Let’s call it a horse for now. Anyway, this is what’s been keeping me busy lately. (That and a certain video game babe that I’ve been modeling on and off.)

The screenshot shown on the left is of my current work in progress with the high-poly horse model. I’m supposed to give this creature barding, which I will add later. I felt that its present appearance is interesting enough to blog about, which is why I’m posting this picture here.

More to come in my next blog post.

Thursday, April 9, 2009

Super-Simple Skeleton Building and Animation Tutorial

Author's Note, 29 May 2012: Looking for an animation tutorial? This one is next to useless. It was intended to show how statues can be made into enemy creatures without having them move. For a full-blown animation tutorial, check out my blog post here.

In my last blog post, I showcased my latest 3D model, a statue of an elven warrior. It’s perfectly fine as a placeable, but Dirtywick wanted me to make it a creature. The statue is supposed to be some kind of magical defense against intruders, but there seem to be problems with trying to get placeables to be targeted by NPCs and to fire visual effects without resorting to a bunch of workarounds. Dirtywick wanted to keep things simple for the area designers on our team, which leaves me with the burden of providing a solution. In this particular case, one solution is for the statues to be implemented as creatures that can shoot spells from the crystals they are holding. None of the existing skeletons and animations in NWN2 is suitable for our needs, however, so I took this as an opportunity to teach myself how to make skeletons and animations from scratch. As usual, I’m documenting the things that I’ve learned in a tutorial.

Its title notwithstanding, this blog post is not a super-simple tutorial on skeleton building and animation. This is a tutorial on building and animating a super-simple skeleton. The skeleton will consist of only one bone and a few attachment points. It will have only one idle animation that does absolutely nothing. The animation is for a statue after all. It’s not supposed to fidget while it stands in place. Nevertheless, the statue will be able to shoot spells from the crystal it is holding, and because it is effectively a creature, NPCs will be able to target it for destruction without any changes to their AI.


It is assumed that you have 3DS Max version 6, 7, or 8 as well as the Expotron plug-in that Obsidian Entertainment used in developing NWN2. This plug-in will not work with any other version of Max, nor will it work with other 3D modeling software. (The Expotron plug-in used to be available at the Vault but has since been removed because of legal issues. If you happened to download it before it was removed, lucky you.) It is also assumed that you’ve already constructed and textured the main skin mesh of your model as well as its two lower level-of-detail meshes. The third and final assumption is that you know how to rig the mesh with the new skeleton that you’ll be creating.

It’s important to name your meshes properly. For creature models that are neither PCs nor NPCs, the main mesh should be named C_name_ar_BODYxx, where name is a unique identifier for your model, ar is the type of armor your model is wearing (CL if the model is unarmored), and xx is a two-digit number from 01 to 99. Mesh names are not case-sensitive.

If, like me, you’ve been using Tazpn’s plug-in to import MDB models as a reference for setting the scale of your models, the Expotron will export them at a very tiny scale. You should resize your meshes at 10,000% of the scale that Tazpn’s plug-in works with. After rescaling, you should make sure that the base of each mesh is at world coordinate (0, 0, 0).

Skeleton Building

  1. Step 1Hide the two lower level-of-detail meshes so that only the main mesh is visible. With the main mesh selected, go to the Display panel at the right of the screen and click the “See-Through” box to put a check mark in it. This will make it easier to position bones and attachment points in relation to the mesh.
  2. Step 2aGo to the Create panel and click the Systems button, which is the rightmost button just below the panels’ tabs. Under “Object Type,” click the Bones button.

    Step 2bClick successive points in one of the viewports to create bones. We only want to create one bone, so press the [Esc] key after clicking two points. This will actually create two bones, so select the longer bone and delete it. Rename the remaining bone using the following convention: C_name_SKEL, where name is the unique identifier of your model. This bone will be the root node of your skeleton hierarchy, which includes not only bones but also attachment points and collision spheres.
  3. Step 3Move the bone you created to the desired position. This is almost always the center of the pelvic area.
  4. We’re going to create and position a few attachment points, which are sort of like invisible hooks to which other external objects can attach themselves. All attachment points are prefixed with “ap_”. In NWN2, there is a standard set of attachment points with specific names. The ones that we’re going to use are the following:

    Attachment Point NameUsual PositionExample Attachment Objects
    ap_cameraInside the headThe camera’s focal point during cutscenes when the creature is the active speaker
    ap_haloAbove the headEffect icons, spell conjuration effects
    ap_hand_rightRight handPrimary weapons, spell conjuration effects
    ap_torsoCenter of and just behind the chest Spell conjuration effects

    I chose these attachment points because they are the ones most likely to be used for spellcasting and cutscenes. For the statue model, I want to change the position of ap_halo to just above the crystal and ap_hand_right to inside the crystal. Both of these attachment points are involved in spell conjuration and casting, and I want to make the statue’s spells seem to emanate from the crystal.

    Step 4aIn 3DS Max, attachment points are implemented as dummy objects. In the Create panel, click the Helpers button then click the Dummy button.

    Step 4bClick and drag the mouse icon over a tiny area of a viewport to create a dummy object. Change the name of the object to one of the standard attachment point names and set its desired position. Do this for all attachment points before moving to the next step.
  5. Step 5Nearly all creature models have one or more collision spheres, and this statue is no exception. Collision spheres are for determining if two objects are in contact with each other or if there is a straight line of sight toward an object. In NWN2, only creature objects make use of collision spheres. (Placeables make use of collision boxes.) Each collision sphere is attached to a single bone and moves with that bone. Generally, a collision sphere encompasses the bone to which it is attached.

    To create a collision sphere, click the Geometry button in the Create panel. Click the Sphere button and click-and-drag the mouse cursor in any of the viewports to create a sphere of the desired size. Adjust the position of each sphere if necessary. The first collision sphere should always be named “COLS00.” Subsequent spheres are named “COLS01” to “COLS99.”
  6. Step 6Select each sphere in turn and edit its Object Properties. Make sure that the “See-Through” box is checked and that the Renderable box is not checked. When you’re done, click the OK button to close the Object Properties window.
  7. Having created all the bones, attachment points, and collision spheres that we need, our next step is to arrange them in a skeleton hierarchy. In this example, the process is very easy because we have only one bone, one collision sphere, and four attachment points to connect. All of the attachments points as well as the collision sphere are connected to the bone, which is the root node by default. Hence, in our hierarchy, the bone is the lone parent object, and the attachment points and the collision sphere are its direct child objects.

    Step 7aSelect a child object then click the “Select and Link” button, which is the third button at the bottom of the main menu.

    Step 7bMove the cursor to the chosen child object then click the mouse button without releasing it. Drag the cursor to the parent object, which in this case is the only bone in this model. A dotted line should stretch out as you drag the cursor. With the cursor over the parent object, release the mouse button. The white outline of a square will flash briefly around the parent object to indicate that a link was created between the two objects. Repeat this process for all the other child objects.

    Step 7cSometimes, it’s difficult to link objects in this manner, especially if one object encompasses or is very near the other. If that is the case, first make sure that the “Select and Link” button is not pressed then select the child object that you want to connect. Now click the “Select and Link” button and press the [H] key. This will bring up the “Select Parent” dialog box. Click the name of the object that you want to set as the parent then click the Link button at the bottom of the dialog box. This will cause the two objects to be linked.
  8. Step 8Optional step: If you want to make sure that you linked the objects correctly, press the “Schematic View” button, which is one of the rightmost buttons just under the main menu bar. This will open a Schematic View window. You should see a hierarchical view with the root bone at the top and the child objects below it. The three skin meshes are independent of this hierarchy and are not connected to it. Close the Schematic View window when you’re done.
  9. Rig each of the skin meshes with the bones that you created. I won’t go into detail in this step, having already explained this process elsewhere in my blog.

Exporting the Skeleton

You are now ready to use the Expotron. The first thing to do is to export the skeleton.

  1. Step 10Select all the bones and attachment points of the model. The easiest way to do this is to press the [H] key to bring up the Select Objects dialog box and press [Ctrl]+mouse click on each object that you want to select. Click the Select button at the bottom of the dialog window when you’ve selected all the bones and attachment points.
  2. Step 11In the File menu, select the “Export Selected…” option. This will bring up a dialog box for you to enter the name and type of the file to export. Under “Save as Type,” choose “Granny Run-Time (*.GR2)”. The name of the file that you enter should be the same as the name of the root bone node. Click the Save button.
  3. In the Granny Export Settings window, click Models. Make sure that the box beside “Include reference in export” is checked and that the box beside “Move to Origin” is not checked. Click the Export button at the bottom of the window.

Exporting an Animation

Every skeleton needs at least one animation – the idle animation. Since our statue model will not move a muscle while it is idle, this section is going to be easy.

  1. Step 13Press the Auto Key button near the bottom of the screen.

    Normally, at this stage, you would be setting frames and moving and rotating bones into position at each frame. Nevertheless, our model will be as lifeless as a rock, so we’re done with making its idle animation.
  2. Step 14Select all the bones and attachment points of the model. In the File menu, select the “Export Selected…” option. This will bring up a dialog box for you to enter the name and type of the file to export. Under “Save as Type,” choose “Granny Run-Time (*.GR2)”. Name the file to export C_name_IDLE, where name is the unique identifier of the model. Press the Save button to continue.
  3. In the Granny Export Settings window, click Animations. Make sure that the box beside “Include reference in export” is checked and that the box beside “Move to Origin” is not checked. Slide the Oversampling button all the way to the right then set “orientation curve tolerance” to 0.15.  Click the Export button at the bottom of the window.  When the animation has been exported, click the Close button.
  4. If there are other animations you wish to make, you may repeat steps 13 to 15 for each animation file. Release the Auto Key button when you’re done. My advice, however, is to defer creating anything other than the idle animation until you’ve checked your model in the toolset. This is because you may have to correct the coordinates of ap_camera and ap_halo first.

Exporting the Model

  1. Step 17We’re now about to export the model to an MDB file. If the main mesh is see-through, uncheck the see-through display option. Unhide all the lower level-of-detail meshes if they are hidden. Now select all the skin meshes.
  2. Step 18Go to the Utilities panel. If you don’t see Expotron among the list of utilities, click the More button and select “Expotron Utility” from the list that appears.
  3. Step 19Under “NWN2 Types,” click the button beside “Character (skin).” If your mesh will be using transparencies, click the button beside “Transparency Mask” under “NWN2 Flags.” Otherwise, make sure that the button beside “No Transparency” is selected.
  4. Step 20Under “Skeleton Name,” type the name of the skeleton file that you created for your model.
  5. Step 21Add all collision spheres to the list of currently selected objects.
  6. Step 22In the File menu, select the “Export Selected…” option. This will bring up a dialog box for you to enter the name and type of the file to export. Under “Save as Type,” choose “Neverwinter Nights 2 (*.MDB)”. Under “File Name,” type the name of your main mesh then click the Save button. In the Expotron Export Options window, make sure that all the boxes are checked then click the OK button.

Testing Your Model

  1. Step 23Copy your MDB and two GR2 files to the folder “My Documents\Neverwinter Nights 2\override”. Copy the appearance.2DA file to your override folder and add an entry for your model. Create a new module in the toolset and add a creature blueprint for your model. Add an area to the module, and put your creature on it. Make sure that the Skeletons button, which is below the main menu bar of the toolset, is pressed. Now examine the creature and its skeleton. Notice any problems?

    If you find that ap_camera and ap_halo are in their proper positions, go ahead and create the rest of the animations that this creature will need, if any. Otherwise, you’ll have to change the coordinates of these two attachment points. The Expotron does not seem to export the position of ap_camera and ap_halo correctly. To the best of my knowledge, this problem was first reported by Schazzwozzer at the NWN2 forums on December 3, 2007. At the time that he reported the problem, no one came up with a solution. I believe I have found a solution to this problem, which I will explain below.
  2. We’re going to work with the creature model in 3DS Max again. Select ap_camera and ap_halo in turn and write down their exact x, y, and z coordinates.

    Now for these two attachment points, exchange the x-coordinate with the z-coordinate. You may have to add a number to the three coordinates of each attachment point as well. I can’t say for sure what those numbers should be for any given model. I had to go through a process of trial-and-error to find the numbers that I needed to add for the model I made. The following are the formulas I used to derive the new coordinates:

    New X-ValueNew Y-ValueNew Z-Value
    ap_cameraOld_Z + 115Old_Y + 20Old_X + 5
    ap_haloOld_Z + 50Old_Y + 10Old_X

    Step 24Each time you change the coordinates of either or both these attachment points, you’ll have to re-export the skeleton and possibly the idle animation of your model to your override folder. You’ll be able to check out your model in the toolset to see if ap_camera and ap_halo are in their proper positions. If the above formulas don’t work for you, you’ll have to experiment with the values to add to each coordinate. If all goes well, you’ll see that ap_camera and ap_halo are in the exact position that you want them to be.
  3. The iron test for any creature model is to check it out in the game. Bake the area of your test module and prepare for a few encounters with your creature.

Below are screenshots that demonstrate that the statue’s spells do shoot out from its crystal. In each picture, one of the statues is a placeable, and the other is a creature. It's easy to guess which is which.


This blog post is based in part on the document Exporting Animated Creatures by Jay Bakke of Obsidian Entertainment. Even if you've already read this document, my blog post has some important information that you won't find there.

The screenshot shown at the beginning of this blog post was made by E.C. Patterson, aka ciViLiZed. I emailed him a copy of my placeable statue model, and he sent me back this picture. I love the way he lit the area in the screenshot. It highlighted the etching on the statue's breastplate very well.

Edit, 30 March 2012. Thanks also to Eguintir Eligard for pointing out some errors in the text on exporting animations. I have since corrected the text.

Edit, 3 May 2012. I removed the dead link to the Expotron and added some explanatory text on why it disappeared from the Vault.

Saturday, April 4, 2009

My First Placeable Model

I assume that most people who try to learn 3D modeling start with something inanimate such as a box. My first 3D model, on the other hand, was a monster. I could never focus my attention on anything as banal as a box, so I jumped right into creature modeling. Took me over a month to figure out.

For Shattered Dreams, Dirtywick told me that he needed a custom model – something like a tripod, a little taller than a human, topped with a crystal. Since all the other 3D artists on the project were still busy with their current assignments, I decided to try making my very first placeable.

Looking for picture references on which to base my design, I searched the Internet for tripods, preferably those that looked arcane, but the ones I found were either too plain or too modern. I eventually decided to search for candleholders because some of them can be pretty fancy, and their design can conceivably be tweaked for holding crystals instead. It didn’t take me long to find some beautiful ones. The ones I liked were small metal sculptures of women lifting up receptacles into which candles may be placed. Some of those receptacles were shaped like flowers. (Hmm, candles inserted into flowers held by women – could there be something Freudian going on with those designs?)

I liked the idea of making the crystal holder a sculpture of a woman, a fierce but beautiful one caparisoned for war. Because I was running short on time, I decided to forego producing concept art and just create a 3D model on the fly. I thought of making the woman a warrior wizard of some sort, so I had her dressed in a robe. With her hairstyle, however, she looked like a school teacher from the 19th century, so I gave her a breastplate to wear over her clothing. I then decided that the long sleeves weren’t sexy, so I sculpted away the sleeves. That left her arms looking too bare, so I added a pair of bracers.

With all the tweaking I did on the model, maybe I should have drawn some concept art first.

From the beginning, I had planned on posing the high and low poly models symmetrically. I intended to adjust the pose of the low poly model after creating its UV, diffuse, and normal maps. That way, I could create a mirrored UV map without much difficulty. If I had set an asymmetrical pose on the model at the start, producing a mirrored UV map would have been impossible. It was a brilliant plan, I thought to myself.

UV mapping was a breeze. So was texturing. The next task was to pose the model. In ZBrush, I masked off all but the model’s right arm and attempted to rotate it into position. The arm and shoulder twisted out of shape. I adjusted the masking and tried again. Portions of the model’s back collapsed in an inhuman manner. Try as I might, I could not get the arm to rotate convincingly at the shoulder socket.

Yeah, brilliant plan, I thought to myself.

Since that didn’t work out well, I decided to return to my modeling roots and rig the whole mesh in 3DS Max as if it were character model. I then moved and rotated the bones to get the model into the pose that I wanted. Because my rigging was hastily done, a number of vertices wound up a little off position, so I tweaked them into place in ZBrush.

As can be seen from the in-game screenshot below, the model didn’t turn out so badly after all.