Springheel's Rigging Workflow

From The DarkMod Wiki
Revision as of 21:17, 11 November 2024 by Thebigh (talk | contribs) (→‎Create the model: -typo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This article is WIP.

This is a reference for me (so I don't have to relearn important steps), as well as anyone who wants to see the workflow I follow when adding new characters to the game.

Create the model

I use Lightwave 8.0 to work on character meshes. I'm not a proficient enough modeler to make high poly characters from scratch, so I wind up using a lot of bits and pieces of existing models (Oddity's and D3). Each character is roughly 4000-5000 polys with a shadowmesh that is half that. Each character has about seven or eight different submeshes (divided by layers in LW).

Important things to remember: The md5mesh format is less forgiving than regular .lwo models, so a few extra things need to be done. A character model can (and usually does) have multiple layers. A single layer can reference only one UVmap. A single poly or vert cannot be mapped onto two different UVmaps, or the texture will be distorted. Verts can only appear in one spot on the UVmap. If you have three verts welded together, and they're at different coordinates, textures will be smeared. Unweld the verts and then weld the verts at each coordinate separately. You'll still see a bit of a seam but it won't be as bad. Meshes that meet at sharp angles may need to be on separate layers to avoid strange black shadows in game.

Create the skeleton

If using an existing skeleton (like the default humanoid skeleton used for most characters), skip this section and go to Weighting.

TDM human characters share the same skeleton so they can also share animations. Same with heads. New creatures, like ravens or steambeasts, need their own skeleton.

I use Maya 7.0 to create skeletons.

Importing Model

First, I have to save the .lwo model into a format Maya can read. DO NOT use the built-in Lightwave exporter. It doesn't export the UVmap, which will mess things up later (you'll get an odd error when trying to export the model to md5mesh format). Instead, I use Deep Exploration to save the model with UVmap intact. If the model is just for visual reference, I usually compress the model into a single layer at this point for easier selection, though this isn't actually necessary.

The model needs to be resting on the XZ plane, facing X, with Y up. Once you've rotated the model the way you want it, you need to Delete History and Freeze Transformations. The latter is particularly important, because if the mesh has any rotation values, it will mess up its position when you load it in game (I had a raven that was sideways in game for the longest time before finding out the problem).

At this point I start creating the chains in the skeleton. Don't forget an origin bone that rests exactly at 0,0,0. The origin needs to be at the top of the join hierarchy. Follow the Maya tutorials for making joint chains. Give some thought to which chains will belong to the leg channel, and which to the torso.

Once the skeleton is complete, Delete History and Freeze Transformation on it as well.

Weighting

Weighting in Maya

If I'm creating a new skeleton, I have to weight the rig in Maya. This is generally done by using a paint tool, though you can select individual verts and use the Component Editor to give them specific values (if you know Maya better than I do this can probably be just as fast as LW).


Weighting in LW

In LW, weighting is done by selecting verts and assigning them to a specific joint with the New Weight option.

Exporting to Md5Mesh

Error "expecting to find weight but found }" generally means that the mesh references a non-existent joint. This can easily happen when copying character partss that are weighted for a different skeleton.

Maya will cull any joints that have nothing weighted to them during the export process. You need to add a line to the def file telling it to keep those joints:

addoptions -keep right_knee_dummy left_knee_dummy (etc)