I tried to search the Internet for solutions to my modeling problems, but the sites that Google found did not have the answers. Most of the top links that Google returned even included my own blog. Eventually, I figured out how to solve the problem through trial and error – lots of trials that yielded mostly errors. To keep myself from making the same mistakes in the future (and to finally get a useful link from Google), I wrote this tutorial. Hopefully, other NWN2 modders will find it useful as well.
This tutorial is primarily for 3D modelers who know how to make and texture a creature mesh but don’t know the workflow for getting it in Neverwinter Nights 2. It will explain the peculiarities of making new skeletons and animations for NWN2 models, especially those whose meshes are stored in separate MDB files. This tutorial will also show how to export all the creature meshes, skeletons, and animations for use in NWN2. Along the way, we will tackle naming conventions and unravel the mysteries of relevant 2DA files. The latter topic may be of interest to NWN2 modders who are not modelers but want to edit 2DA files to correctly put custom creature models in their modules.
The following software must be installed for this tutorial to be of full use to NWN2 modelers:
- Neverwinter Nights 2 (with or without expansions)
- Software for editing 2DA files; e.g., Notepad, Excel, or one of the free 2DA editors available at the Neverwinter Vault
- 3DS Max 6, 7, or 8. No other version will do.
- The Expotron plug-in that was used by Obsidian Entertainment for NWN2
Modders who are not modelers will only need NWN2 and 2DA-editing software and may want to refer only to my section on editing 2DA files.
It is assumed that the reader already has a creature model that would comprise no more than 6,000 triangles if all its quads were converted to tris. This poly count is the total from all meshes that make up the basic model – body, head, wings, and tail, but not including hair or armor accessories. The model should already have been UV mapped and preferably textured. Optionally, there may be one or two lower LOD (level-of-detail) versions of the mesh already made, but these are not necessary to follow the tutorial.
Before proceeding to the tutorial proper, we need to lay out some basic knowledge to prepare ourselves for what follows.
About Model Parts and Their Skeletons
Each mesh in NWN2 is stored as an MDB file. Not all meshes are animated, but the ones that are will have skeletons and animations stored as GR2 files. Each skeleton should be composed of no more than fifty-four bones, not counting facial bones that are animated only in cut scenes (the “f_” bones) and attachment points (the “ap_” bones, dummy objects to which other non-animating meshes or visual effects may attach themselves). Fifty-four bones isn’t a whole lot, especially for creatures with extra limbs or heads. Nevertheless, there are ways to overcome this limitation, as we shall soon see.
A skeleton is a set of bones arranged in a hierarchy, much like a pyramidal organization chart. At the top of the hierarchy is the root bone. For skeletons that animate the body mesh, the root bone is typically at the center of the pelvis, although it need not be, especially for creatures that don’t really have a pelvis. The NWN2 engine uses the root bone to calculate distances between the creature and other objects. Because other bones can emanate from the root bone in any direction, the root bone is generally just a tiny nub, unlike the long bones found in limbs and torsos.
A model is composed of one or more meshes. Simple creatures, such as the chicken in NWN2, are completely embodied in a single mesh. More complex creatures may be composed of a head mesh, a hair mesh, a body mesh, a wing mesh, a tail mesh, and zero or more armor/clothing accessories. Accessories do not need their own skeletons because they stick to the creature’s attachment points. The hair, head, and body share the same skeleton hierarchy. Wings and tails may have their own skeletons, each of which comprises as many as fifty-four bones. In fact, making creative use of wings and tails is how one can overcome the bone limit in the body’s skeleton. Just because a mesh is listed as a wing or tail model doesn’t mean it actually has to be a wing or tail. It can be any part of the creature that needs its own skeleton. My hydra model doesn’t have any wings, but because it needed more than fifty-four bones, I divided my model into two parts – the body mesh and the mesh for its heads and necks. I assigned the latter mesh to the wings slot to give it its own skeleton.
If you find yourself needing more bones than are allowed on a single mesh, you can divide your model into three meshes – the body and head, the cloak or wings, and the tail. Each of these can have its own skeleton consisting of no more than fifty-four bones. Be aware, however, that a model that is divided this way will never have its parts joined perfectly at the seams. While moving, some parts of the wings or tail may sink too deeply at times into the body or may separate far enough to form a small gap. This is unavoidable. The best that you can do is to try to keep the parts joined as well as you can when animating the creature. If you must divide your creature model, try to cut it in places where players are unlikely to look closely, if that is at all possible.
|There is a slight gap in the red dragon's tail, but players will not notice it because they will be too busy worrying about the opposite end of the dragon.|
Some models have their head stored in a separate MDB file from their body. The head and body share the same skeleton structure, however, so what advantage is there in keeping the head and body meshes in separate files? There are two reasons for wanting to do that:
- To allow different heads to go on the same body. For creatures of the same species and gender, you may want to allow some variation in the creatures’ head appearance. This is done by creating two or more head meshes for the same creature. For example, you can make a new lizardman head to make it look different from other lizardmen.
- To assign different textures to the body and head. Each mesh can have its own set of textures – diffuse map, normal map, glow map, tint map, and even specular highlights. The latter allows you to set the gleam of the mesh. The shine of metal, for example, is brighter and more concentrated than that of skin. It makes sense to separate the fleshy head of an armored creature from its metal body to give them different textures.
If none of these reasons apply to your model, it may be best to keep the head and body in the same MDB file. Assuming that the head is welded to the body, this will keep the parts perfectly fused even when the model moves.
The above considerations may also apply to wings and tails. A creature’s wings and tail meshes may have variations in their appearance as well as textures and specular highlights that are different from its body.
Even though meshes of multi-part creatures are stored in separate MDB files, it is best to keep all the meshes of each creature in a single 3DS Max file. When animating the creature later, you will need all its meshes and skeletons together.
That’s it for now. In my next blog post, I will discuss what 2DA files are needed to bring new creature models to NWN2, which columns in these files are important, and what to put in them.