Monday, May 28, 2012

Love Is a Many-Headed Thing, Part IX: Finished at Last

Finally, the hydra is finished and uploaded to the Neverwinter Vault and the Neverwinter Nexus. I made a tintable and non-tintable version of the model, as can be seen below.

I'll rig and upload the one-headed version soon. For now, I need sleep. Zzzzz.

Edit, 29 May 2012. Some time ago, I posted a thread regarding this creature in the NWN2 Custom Content forum at the Bioware Boards. When I announced the release of the hydra, a few people started trying it out. As of this writing, MokahTGS posted a test module with hydra variants in it for other players to try and contribute modifications to. Anyone interested may head over to my Big Snake thread to apprise themselves of the latest developments and perhaps contribute to improving the creature's blueprint.

Tuesday, May 22, 2012

Creating New Life with the Expotron and Max, Part 6: Animation

This is Part 6 of my tutorial on bringing new creatures to NWN2 using 3DS Max and the Expotron. Part 1 of this series may be found here.

This blog post is an introduction to animation of NWN2 creatures. To keep the tutorial as broad as possible, I won’t cover the use of intermediate techniques that involve IK solvers. Different creatures may need different solvers to animate them properly, and it would take separate tutorials to adequately tackle each of them. Animation is a deep and complex topic that goes well beyond the mechanics of using 3D software. Readers who want to advance their animation skills may use this blog post as a starting point but should seek deeper knowledge elsewhere, especially as I’m no expert on it.

Before proceeding, you should properly weight the vertices of your creature’s meshes.  I’ve already covered vertex weighting elsewhere in my blog, so read it first if you need to brush up on it.

Basic Concepts

The technique that we will discuss here is key frame animation. An animation sequence comprises a series of frames, which are like the images in a film strip. In NWN2 as well as many other videogames, each creature has a number of animation sequences that the game engine strings together to create the illusion of continuous motion. A creature can have one sequence for walking, another for running, and a third for standing in place.

It takes several images flashed in quick succession to create the illusion of movement in film, videos, and games. In motion pictures, the standard number of frames per second is twenty-four. When making our animation sequences in 3DS Max, we will use the default rate of thirty frames per second. Hence, a sequence lasting 1.5 seconds would consist of forty-five frames. When we export an animation sequence for NWN2, the Expotron will extrapolate seven additional frames for each frame in 3DS Max for a total of 240 frames per second. (By moving the Oversampling slider to its maximum value when we export an animation sequence, we are telling the Expotron to create eight frames for each one in 3DS Max.)

In 3D programs, instead of creating frames out of 2D images, we set the pose of our model in separate frames to represent the stages of its motion at different points in time. We don’t have to do this for all the frames in a sequence. Instead, we set the pose in a few frames that define the motion in a particular segment and let 3DS Max figure out the pose between those frames. The point where we set the model’s pose is called a key frame. In traditional 2D animation, key frames are drawn by key artists. The frames between them are drawn by assistant animators called “inbetweeners.” For our purposes, we will let 3DS Max do the inbetweening for us.

File Naming Conventions

The file naming conventions for animations must be strictly followed for the game engine to apply them properly. Many animation sequences are tied to the items that a creature has in its hands. For instance, the way a creature attacks with a sword in one hand and a shield in the other is different from how it attacks with a bow. Some sequences, such as spellcasting animations, are not tied to equipped items.

Each animation name must start with the name of the creature’s main skeleton without the “_skel” suffix, followed by an underscore. Animations that are tied to weapon stances must be followed by the code for the items wielded, followed by another underscore. All creatures must have animations for the unarmed stance. The rest of the stances are only for creatures that are capable of wielding weapons and shields.  The codes for each weapon stance are shown in the following table.

Weapon Stance
One-handed sword
One-handed sword and shield
Two-handed blade
Two-handed thrusting weapon (polearms, staves, spears)
Two-handed slashing weapon (axes)
Dual weapons, one in each hand
Short bow or longbow
Thrown weapon (sling or dart)

The final part of the animation name is an identifier for the animation sequence. Standard animations must be given their correct names for the game engine to recognize them. There are many such sequences. Making them all can take weeks or even months, depending on how much time you put into animation each day. Nevertheless, there is a minimum set of sequences that you can provide a creature whose sole purpose is to engage players in combat. These animations are listed in the following table. Note that the approximate durations provided are estimates that can vary significantly with each creature and with each set of wielded items. Treat the last column in the table below as a rough guide.

Approx. Duration
Looping animation of the creature standing in a relaxed manner
as long as it takes (e.g., 10 seconds)
Looping animation of the creature walking
1 second
Looping animation of the creature running
Less than 1 second
Looping animation of the creature in a combat stance
3 seconds
Looping animation of the creature fidgeting in combat. The starting and ending frame should be the same as that of idleM.
1 second
Looping animation of the creature making a single attack. The creature should have delivered its deepest strike at 0.33 seconds from the start of this sequence. The starting and ending frame should be the same as that of idleM. If you want to make variations of this sequence, name them 1attack02, 1attack03, etc.
1 second
Looping animation of the creature taking damage. The attack on the creature should reach its apex at 0.33 seconds from the start of this sequence. The starting and ending frame should be the same as that of idleM. If you want to make variations of this sequence, name them damage02, damage03, etc.
1 second
Looping animation of the creature dodging an attack. The creature should be farthest from the incoming attack at 0.33 seconds from the start of this sequence. The starting and ending frame should be the same as that of idleM. If you want to make variations of this sequence, name them dodge02, dodge03, etc.
1+ seconds
Non-looping animation of the creature being knocked down to a lying position. The starting frame is the same as that of the idleM animation, and the ending frame is the same as the start of the proneB animation. The creature should start falling within 0.33 seconds from the start of this sequence.
1+ seconds
Looping animation of the creature lying on the ground. Despite the name of this animation, not all creatures are necessarily prone. Bipeds, for instance, lie face up as if they had been knocked out in a boxing match.
1 to 2 seconds
Non-looping animation of the creature standing up from a lying position. The starting frame is the same as that of the proneB animation, and the ending frame is the same as that of the idleM animation.
2+ seconds
Non-looping animation of the creature taking damage and lying on the ground dead. The starting frame is the same as that of the idleM animation. At 0.33 seconds from the start of this sequence, the attack on the creature should have reached its apex. By the end, the creature should be lying dead on the ground. If you want to make variations of this sequence, name them death02, death03, etc.
1+ seconds

For example, the hydra creature I’m making has a skeleton named c_hydra_skel. The hydra does not use any weapons other than its fangs, so all its actions are considered unarmed. If I wanted to make one and only one animation of the hydra dodging an attack, I would name that sequence “c_hydra_una_dodge01.”

Other combat animations may be provided on a case-to-case basis. For instance, creatures capable of speech may taunt their opponents, but animals generally do not. All intelligent creatures, including animals, may attempt to intimidate their opponents, but mindless creatures such as zombies and most constructs should not be able to.

Spellcasting animations follow a different naming convention. They still start with the name of the skeleton for which they are intended (not including the suffix “_skel”), followed by an underscore. This is followed by a code for the cast animation type, an underscore, and the name of the spellcasting stage.

The following table lists the cast animation types and their descriptions.

Cast Animation
General, all-purpose spellcasting. Not all creatures can cast spells, but the ones that can should have this type of casting animation at the minimum. Like the ATK animations, GEN animations may have spellcasters hurling a spell at a target in front of them, but whether the spell is intended to harm or heal should be ambiguous.
Attack spellcasting intended to harm opponents
Defensive spellcasting, such as spells for buffing the spellcaster
Party spellcasting, which is like doing a short ritual without having to hurl eldritch energies at a specific target
Major, over-the-top spellcasting, powerful enough to levitate the spellcaster a few inches off the ground
Bard song without instruments
Bard song while playing a drum
Bard song while playing a flute
Bard song while playing a lute

Spellcasting always comes in three stages, which are described in the following table.

Non-looping animation marking the beginning of spellcasting. The first frame is the same as that of the idleM animation, and the last frame is the same as the first frame of the conjureloop animation.
1 second
Looping animation of the spellcaster weaving his spell
1 second
Non-looping animation that consummates the spellcasting. The first frame is the same as that of the conjureloop animation, and the last frame is the same as the start of the idleM animation.
2 seconds

Hence, if I wanted my hydra to do offensive spellcasting, I would create three animation sequences named “c_hydra_atk_conjure,” “c_hydra_atk_conjureloop,” and “c_hydra_atk_cast.”

Making and Exporting an Animation Sequence

Now we come to the tutorial proper on animating a creature model and exporting its animations for NWN2. If you want to save your animations as Max files, always save them in separate files. Your rigged, non-animated model should have its own file. If, while animating your creature, you find out that some of its vertices are not properly weighted, you don’t have to start everything from scratch. Just modify the vertex weights of your non-animated model and export it again as an MDB file, overwriting the old version if you have one.

Animation in 3DS Max generally involves rotating bones. For example, to move an arm up, we rotate the upper arm on the shoulder joint. The only time we will use the Select and Move tool on a bone is when changing the position of root bones. These are the only bones that you may move. In almost all instances (or at least in all instances I can think of), we will never use the Scale tool.

At no point will we rotate or move attachment points. If you want, you can hide all attachment points when doing your animation sequences. Just remember to unhide them before exporting your animations as GR2 files.

Below are the general steps for key frame animation. I will only discuss the mechanics of the process. The art of creating lifelike animations is beyond the scope of this tutorial.

  1. First, we need to set the duration of our animation sequence. Click the “Time Configuration” button to bring up the “Time Configuration” dialog box.

    Set the number of frames that the sequence will play then click the OK button. Remember that we are using the default rate of thirty frames per second.

  2. Make sure that the flame slider is at frame 0. Rotate the creature’s bones at the initial frame.

  3. Click the “Set Key” button. This will allow us to manually set keys on chosen frames.

    Press the [H] key and select all bones. Do not include any attachment points or meshes in your selection. Click the Select button when you’re done.

  4. Click the “Key Filters” button and make sure that only the Rotation checkbox and optionally the “IK Parameters” checkbox are ticked. Close the dialog box when you’re done.

    With the frame slider in the 0 position, click the “Set Keys” button, which has a key icon on it. Don’t confuse “Set Keys” with “Set Key,” the button of which should be red at this point, indicating that it is toggled on.

  5. We will now set the position of the root bones. Press the [H] button to bring up the “Select Objects” window. Select only the root bones of your creature then click the “Select” button.

  6. Click the “Key Filters” button again, but this time, tick the Position checkbox. Close the Key Filters dialog box.

    Now click the “Set Key” button (the one with the key icon) to set the position of the root bones.

  7. For looping animations, you will want the last frame of your sequence to be the same as the first frame. If so, select all the bones of your creature, not including its attachment points. Hold down the [Shift] button then click the first key and drag it to the last frame. This will clone the keys in the first frame to the last frame.

  8. We will now set other key frames to animate the creature. Click the “Auto Key” button.

    Move the frame slider to the frame you want to set a key for. Rotate bones to set the creature’s pose for that frame. You may move root bones if necessary.

  9. Move to a new frame and set the creature’s pose for that frame. Repeat until you’ve assigned all the key frames for your creature.

  10. Even if you set your key frames properly, you may find that the acceleration or deceleration of motion from one key frame to another isn’t quite right. If so, you will have to edit the curve of the motion. Select one or more bones whose motion acceleration you want to change.

    Click the “Graph Editor” menu and select “Track View – Curve Editor.” This will bring up the associated window.

    In the new window, you can select any set of two or more points on each line and change the curvature of the segment between those points by clicking any of the buttons on the toolbar that changes the segments’ tangents. This will affect how the rotation and position of the bones between your key frames will change.

  11. At any point, you may click the “Play Animation” button to see how it goes.

    When you are satisfied, export your animation as a GR2 file using the method that I discussed in my last blog post.

  12. Create a module for testing your creature model if you haven’t done so already. If you want to test the creature’s combat animations, be sure to set its faction to Hostile. Run the game as your chosen player character and interact with the creature, carefully observing its animation as you play. If you find that the animation needs some fine-tuning, adjust it in 3DS Max then export it as a GR2 file again. Repeat as often as necessary.

Saving and Loading Animations

While you may save your animated creature in a separate Max file for each animation, you can also store your animation sequences as XAF files. These are basically XML files that are specifically designed for animations.

You can only save animations for selected bones, so if you want to store an entire animation, select all the bones of your creature (not including its attachment points). If you only want to store the animation of certain bones, select only those. Click the File menu and select “Save Animation.”

In the dialog box that appears, enter the name of the animation sequence you want to save. This may be any name you like. If you want to store only a segment of your animation, tick the checkbox labeled “Segment” and indicate the starting and ending frame to save. Click the “Save Motion” button when you’re done.

To load an animation, select the bones that you want to load an animation sequence for. You may select all the creature’s bones if you like, but you may also select only a smaller set of bones if you want the rest to remain unaffected. Click the File menu and select the “Load Animation” option.

In the dialog box that appears, choose the name of the XAF file you want to load. If you want the loaded animation to be relative to the bones’ current position and rotation, you may keep the “Relative” radio button toggled. I usually click the “Absolute” radio button. You may choose to replace the key frames with the ones in the file, or you may insert the animation at a specific frame. Click the “Load Motion” button when you are done. This will load the animation sequence for your chosen bones.

I can’t begin to express what a powerful, time-saving feature this is. For instance, opening and closing the mouths of a hydra isn’t easy because the angle of each head affects the angle of its mouth, fangs, and tongue in the open and close positions. To save me a whole lot of effort, I set the key frame for the hydra at its open-mouth position and stored the bone states for the heads, jaws, fangs, and tongues as an XAF file. I then retracted each fang and tongue and closed each mouth with mechanical precision, a process that also involved temporarily changing the angle of all the necks to get the closed-mouth position right. I then set a key frame for this position and saved the states of the same bones in a separate XAF file. When doing different animation sequences later, I could choose which heads would open their mouths and at what frames they would do so. I could also choose whether to extend their fangs and/or tongues when they open their mouths. This would have been difficult to achieve with precision if I had to do this manually each time.

There were many other animation sequences that I re-used in part, such as the hydra’s slithering motion. I’ll leave you to discover other applications of this wonderful feature in your own animations.


This concludes my tutorial series on creating new creature models for NWN2. The content of this entire series is equivalent to a chapter of a thick textbook, but the topics discussed herein can span many such books if they were to be discussed thoroughly. Nevertheless, I hope that this tutorial will serve as a starting point for novices who want to get into 3D modeling and animation in general and NWN2 modding in particular. I wish I had this kind of information at my fingertips when I was starting out.

Wednesday, May 9, 2012

Creating New Life with the Expotron and Max, Part 5: Rigging and Exporting Creature Models

This is Part 5 of my tutorial on bringing new creatures to NWN2 using 3DS Max and the Expotron. Part 1 of this series may be found here.

With the preliminaries out of the way, we can now proceed with the tutorial proper. Fire up 3DS Max, load your creature model, and follow the instructions below.

  1. Make sure that the pivot of each mesh is centered at world coordinate (0,0,0). This pivot is what defines the creature’s center, which NWN2 uses to calculate distances between objects. Assuming you haven’t rigged the mesh yet, click the Hierarchy panel (the one whose icon looks like an organizational chart on the upper right side of the screen) then click the button “Affect Pivot Only.” Next, click  the Select and Move tool, and in the Absolute Mode Transform Type-In (the three input boxes at the bottom of the screen), set the X, Y, and Z values to 0,0,0. Toggle the “Affect Pivot Only” button when you’re done.
  2. To rig the mesh, we are first going to make its skeleton. If you have any LOD meshes, hide them for now. We will work only with the main meshes, but we’ll need them to be transparent so we can see the bones underneath. Select your meshes and right-click on them to bring up the context-sensitive menu. Click Properties to bring up the Object Properties window. Tick the check box beside “See-Through” then click the OK button.
  3. We will now make the root bone for the body mesh. We need it to be at the center along the left-right axis, so make either the Left or Right viewport active by selecting it. If you wish, you may toggle viewport maximization by pressing [Alt]+W after selecting the viewport you want to work in. On the Create panel, click the Systems icon, the one that looks like a couple of gears. Click the Bones button then click within the mesh not too far from where you want your root bone to be. Move the mouse to the desired position of the root bone then click the mouse again. This will create one bone. Now right-click the mouse to end bone construction. This will create a second bone, which is really just a small nub. It is this tiny bone that we want to make the root bone, not the first bone. Rename it in accordance with the skeleton naming convention explained earlier.
  4. We won’t need the first bone anymore, so select it and delete it. We should be left with only the root bone of this skeleton.
  5. We’re going to build up the rest of the skeleton for this mesh. Select the root bone and click the Bones button under the Create Systems panel. Click the root bone again to create a new bone that connects to it and click on the spot where the new bone ends. You can create another bone that connects to the last one that you made by clicking on the spot where the new bone ends. Continue in this manner until you’ve completed the bones for the body and head mesh. Make sure that you don’t make more than fifty-four bones. If you need to stop making a chain of bones to build a new chain in another part of the creature, right-click the mouse to end the bone creation process. This will create a nub bone at the end of the chain. If the creature you’re making will need more than one skeleton hierarchy (say, to bypass the fifty-four bone limit for each skeleton), don’t delete the nub bone at the juncture between the meshes. You should, however, delete the nub bones that are not intended for use as root bones in other skeletons.

    Remember to use the Left or Right viewport if you want to center the bones along the left-right axis. If you want to create arms or legs, however, you will have to switch to the Front or Back viewport. Start on just one side first so you can clone the bones for the other side later. For example, to build the right arm and shoulder, you may select the part of the spine where the right shoulder connects then click the Bones button to start creating new bones. Click the selected part of the spine again, which is where the right shoulder will begin, and then click the spot where the right shoulder ends. From there, create bones for the upper arm, lower arm, and fingers. When you’re done and have deleted any unnecessary nub bones, select all the bones from the shoulder to the fingers and clone them as a copy (not as an instance). Select the cloned shoulder and rotate it 180 degrees along the left-right axis. This will give you a set of bones from the left shoulder down to all the fingers on the left side.
  6. If your creature has another mesh that will need its own skeleton hierarchy, select the nub bone that you intend to make the root bone of the new skeleton. Clone this bone as a copy and change the name of this bone to correspond with the naming convention for the type of skeleton you’re making. Don’t delete the original nub bone. It should remain a part of its skeleton.

  7. With the cloned bone selected, click the “Unlink Selection” button, which is somewhere on the left side of the top toolbar just below the Group menu. This will separate the cloned bone from the hierarchy, thereby allowing you to make it the root of a new skeleton.
  8. Make sure that the new root bone is still selected then click the Bones button under the Create Systems panel. Click the root bone to start creating a new bone that is linked to it and click on the spot where the new bone ends. Keep building bones until you’ve completed the skeleton. Make sure that the skeleton hierarchy does not exceed fifty-four bones.
    Two completed skeletons, one for the body and one for the "wings" mesh, which is actually the hydra's five heads and necks
  9. If you have a third mesh that needs its own skeleton, repeat steps 5 to 7 for that skeleton until you’ve completed it. Remember that each creature may have no more than three skeletons.
  10. We will now add attachment points to the creature. In the Create panel, click the Helpers button, whose icon looks like a measuring tape. Click the Dummy button to start creating dummy objects. Position the mouse where you intend to make the first attachment point then click and drag the mouse to make a small square. This will make the dummy object. When it comes to exporting the skeleton later, it doesn’t really matter how big or small you make the dummy object, but try to make it as small as possible to give you a better idea of where its center point is. Rename the dummy object to correspond to the appropriate standard name for the attachment point you’re creating. If necessary, you can reposition a dummy object with the Move tool. If you need to stop creating dummy objects, you may right-click the mouse anywhere on the viewport. Keep making and renaming dummy objects until you’ve completed all the attachment points your creature needs.
  11. Next, we will link each attachment point to the appropriate bone. Select an attachment point then click the “Select and Link” button, which is on the top toolbar just below the Tools menu.

    Press [H] to bring up a list of objects to which you may link the dummy object. Click on the name of the bone you want to attach the dummy object to then click the Link button. Continue to select attachment points and link them to the appropriate bones until you’ve linked all of them.

    When you’re done, access the Object Properties of each mesh, un-tick the check box marked “See-Though,” and click the OK button to close the Object Properties window.
  12. Optional step: At any time, you may view your hierarchy of objects by clicking the “Schematic View” button on the top toolbar.

    This will bring up a window showing your object hierarchy. Review it to make sure that all root bones are at the top of their own hierarchy and that all bones and attachment points are linked correctly. None of your meshes should be linked to any object. When you’re done looking at the schematic view window, close it.
  13. Now we will add collision spheres. These objects are named COLSxx, where xx is a two-digit number that starts at 00 and increments sequentially. The game engine uses a creature’s collision spheres to determine if it is touching any other object. The only data stored in MDB files on collision spheres are their name, position, radius, and what bone they are linked to. Data on polygons and vertices are not stored, so it’s all right to create collision spheres with 32 segments. What we want to do is to cover the model with as few spheres as necessary without covering spaces that are too far beyond the surface of the mesh. We don’t want to use too many spheres as this may bog down the game engine with unnecessary computations. Hence, we may create spheres that are somewhat larger than they would be if we sized the spheres to be close to the mesh’s surface. On the other hand, we don’t want to make the spheres so big that the game engine will think that the creature is colliding with some other object when it is obvious to the human eye that nothing is brushing its surface but the ground. How big to make each sphere and where to put it will require a subjective judgment call on your part. Don’t fret too much about it. This isn’t rocket science. At any rate, by the time you’re done, your model will be covered with many candy-colored spheres. Enjoy the festive atmosphere that these spheres bring because all this is about to change in a minute.
  14. Press [H] to bring up the Select Objects window. Select all the collision spheres in the list by clicking on the first sphere then with the [Shift] key held down, clicking on the last sphere. Click the Select button to close the window.

    Right-click on any of the collision spheres to bring up a context-sensitive menu and click the Properties option. On the Object Properties window, tick the check box beside “See-Through” and un-tick the Renderable check box. Click the OK button when you’re done.

    This will cause all your colorful spheres to become transparent gray objects. Looks like the party’s over.
  15. Select each collision sphere in turn and link it to an appropriate bone by using the Select and Link tool, similar to the way it was done with the attachment points. The sphere should move with the part of the mesh that it is intended to cover, so choose which bone to link the sphere to accordingly. Usually, this will be the bone closest to the center of the sphere. By the time you’re done, all the collision spheres should be linked to a bone.
  16. Optional step: You may want to bring up the schematic view again to make sure that no collision sphere is left unlinked.
  17. At this point, we’ve created one or more skeletons complete with attachment points. We’ve also covered the creature with collision spheres and linked them to the appropriate bones. Next, we’ll rig each mesh to its skeleton.
    Click the Modify panel to access it. Select each mesh in turn and add a Skin modifier to it. For each mesh, click the Add button beside “Bones:” on the Modify panel and select all the bones from the skeleton hierarchy that is supposed to affect the mesh. You can select bones that are listed contiguously by clicking on the first bone that you want to select and with the [Shift] key pressed, clicking on the last bone.  You can also select bones that are not listed contiguously by pressing the [Ctrl] key and clicking the bones to add. If your model has more than one skeleton, be sure not to add bones from outside the hierarchy that is supposed to influence the mesh. For example, if your model has three skeletons, the tail mesh should only be affected by the tail skeleton, and the wings mesh should only be affected by the wings skeleton. Also, do not add any attachment points as these are not supposed to affect your mesh. When you’ve chosen the bones of the appropriate skeleton from the list, click the Select button to add them. At this point, each vertex of your meshes will be provisionally weighted to one or more bones, although these vertex weights will likely be inaccurate. Nevertheless, you now have a quick and dirty rig.
  18. If you have lower LOD meshes, unhide them if they are hidden and repeat the above step for each of them.
  19. Optional step: If you want, you can weight the vertices more accurately to the bones and create the creature’s unarmed idle animation. If you’re like me, however, you’ll be anxious to see if your new creature will appear in the game. If so, you may defer the actual rigging and animation for later.
  20. We will now export the skeleton of your creature’s body. Press [H] bring up the Select Objects window and select all the bones and attachment points that belong to the body’s skeleton. Click the Select button to close the window. Now click the File menu and click the “Export Selected…” option. This will bring up a dialog window for selecting the file to export to.  In the “Save as type” list box, select “Granny Run-Time (*.GR2).” Under File Name, type the name of the file you want to export the skeleton to. This file name should be the same as that of the skeleton’s root bone. Click the Save button.
  21. At this point, you should be looking at a dialog window named “Granny Export Settings.” Click the Models option under Settings. Make sure that the check box beside “Include reference in export” is ticked and the one beside “Move to Origin” is not ticked.

    Double-click the word Models under Settings and click the name of your root bone. Again, make sure that the check box beside “Include reference in export” is ticked and the one beside “Move to Origin” is not ticked. You have to do this especially on your first time to export the skeleton because the dialog box has a tendency to keep the check box labeled “Move to Origin” ticked even when you un-tick it earlier.

    Now, to be obsessively-compulsively sure that the check boxes are as they should be, double-click the name of the root bone and go through each bone in the hierarchy one by one, reviewing the state of both check boxes as you go along. When you’re done, click the Export button. If all goes well, you may then close the “Granny Export Settings” window.
  22. If you have other skeleton hierarchies, repeat steps 20 and 21 for each of them.
  23. Next, we’ll export the creature’s idle animation. If you skipped the optional step 19 above, your creature probably doesn’t have any kind of animation yet. That’s okay. We’ll export it anyway. When you view your creature in game, it will look as stiff as it does in 3DS Max, which is fine for our purposes.
    Select all the bones and attachment points of your model. That’s right. All of them. If your creature has more than one skeleton, all their bones and attachment points should be selected. Click the File menu and click the “Export Selected…” option again. In the dialog box that appears, make sure that the list box labeled “Save as type” is still set to “Granny Run-Time (*.GR2).” In the “File Name” box, type the name of the animation you want to export. Standard animations have a naming convention that must be adhered to strictly. The name of the file to export should be the name of the root bone of the creature’s body but without the “_skel” suffix followed by “_idle.” Click the Save button.
    In the “Granny Export Settings” window that appears, click the Animations option under Settings. Make sure that the check box labeled “Include reference in export” is ticked and that the check box labeled “Move to Origin” is not ticked. Slide the Oversampling bar all the way to the right. Set Orientation Curve Tolerance to 0.15. When you’re done, click the Export button.
  24. Next we will export the creature’s meshes. Click the Utilities panel and click the “More…” button. In the Utilities window, select the “Expotron Utility” option then click the OK button. The Utilities panel will now have various Expotron utility settings to fiddle with.

    Make sure that the skin mesh you wish to export is selected. Under NWN2 Types, click the “Character (skin)” radio button. Under “Skeleton Name,” type the name of the skeleton to which the skin mesh is rigged. (Recall that the skeleton’s name is that of its root bone.) If your model uses transparencies in the alpha channel of its textures, click the radio button beside “Transparency mask.” Otherwise, keep it set to “No Transparency.”  If you have lower LOD versions of your mesh, give the same Expotron settings to each of them.
  25. Press [H] to bring up the Select Objects dialog box.  Select all the collision spheres that are linked to your mesh’s skeleton along with the mesh itself. If you have lower LOD versions of your mesh, select those as well. Next, click the Select button.

    Click the File menu and click the “Export Selected…” option. In the dialog box named “Select File to Export,” set the “Save as type” list box to “Neverwinter Nights 2 (*.MDB).” Under “File name,” type the name of your mesh. Click the Save button.

    You should now see a dialog box named “Expotron Export Options.” Make sure that all the check boxes are ticked then hit the OK button. This will export your mesh to an MDB file.
  26. If your creature has other meshes, such as a wing mesh, a tail mesh, or both, repeat steps 24 and 25 for each of them.
  27. Make sure you have a copy of the file appearance.2da in your Neverwinter Nights 2 Override folder. Append an entry on your creature in the file and save it.

    If you have a wing model or tail model to go with your creature, edit the appropriate 2da file to append an entry on it.
  28. And now, for the moment of truth. Create a test module and drop a creature in a new area. (I like using badgers for testing because they are already set to a faction that is friendly to player characters.) Change the creature's appearance to that of your model. Run the module and see if your model looks all right. If so, congratulations. All you have to do now is to weight the model's vertices in earnest and animate it.

In my next, concluding blog post in this series, I will show how to animate NWN2 models.