Quake 4 Animation Guide

Animation - Creating .md5anims and .md5meshes

There are four steps to getting animated characters into the game:

  1. Character creation. This step includes modeling a lo-poly version of the mesh, rigging the mesh, skinning the mesh and applying materials to it.
  2. Animating the character.
  3. Adding animations to the character’s .def file.
  4. Exporting the meshes and animations to the game.

1. Character Creation

The Quake 4 engine uses Maya to convert meshes and animations into usable .md5’s. Guidelines for creating a character:

2. Animating the Character

Animate the character as normal in Maya. For those who are new to animation, The Animator’s Survival Kit by Richard Williams is a good place to start. There are also scores of tutorials on the Internet for Maya-specific animation techniques (http://www.highend3d.com).

The animations used by AI and NPCs can move in space as long as the origin is properly constrained to the character. Multiplayer animations are split between the torso and legs and should therefore be animated in place. When saving the animation, be sure that the Time Slider includes the range of frames intended. The animation will be exported using that range. Otherwise, a range can be specified in the export block of the .def file (see below).

3. Adding Animations to the Character’s .def File

The character’s .def file contains the variables that define the character’s behavior. Animations available to the character are listed in the .def file and Maya files are exported to the game as .md5’s based upon that information. Animation files are added to the export block and then further defined in the model definition block. The game Editor’s list of available animation is updated with information from the model definitions.

3.1 The Export Block

The export block consists of: 1.) the options line, 2.) the Maya file being used to create the mesh, 3.) one or more Maya animation files. For the character .def file, the export block should contain run, walk, and idle animations.

export new_character
options -prefix nc_ -scale .3937 -align ALL -keep muzzle_flash

mesh    characters/anims/mesh.ma        -dest characters/anims/mesh
anim    characters/anims/idle.ma        -dest characters/anims/idle
anim    characters/anims/walk.ma        -dest characters/anims/walk
anim    characters/anims/run.ma -dest characters/anims/run

3.2 The Options Line

The above example contains options most frequently used when exporting .md5’s:

Some additional commands that may be useful:

"-rename"               Usage: -rename [joint name] [new name]"
"-parent"               Usage: -parent [joint name] [new parent]"
"-dest"                 Usage: -dest [filename]"
"-range"                Usage: -range [start frame] [end frame]"
"-cycleStart"           Usage: -cycleStart [first frame of cycle]"
"-rotate"               Usage: -rotate [yaw]"
"-xyzprecision"         Usage: -xyzprecision [precision]"
"-quatprecision"        Usage: -quatprecision [precision]"
"-jointthreshold"       Usage: -jointthreshold [minimum joint weight]"
"-skipmesh"             Usage: -skipmesh [name of mesh to skip]"
"-keepmesh"             Usage: -keepmesh [name of mesh to keep]"
"-keepmeshprefix"       Usage: -keepmeshprefix [prefix of mesh(s) to keep]"
"-jointgroup"           Usage: -jointgroup [group name] [joint1] [joint2]...[joint n]"

3.3 The Models Definition Block

The models definition block: 1.) defines the name of the model as it will appear in the game Editor, 2.) defines the names of the .md5 animations as they will appear in the game Editor and Modview, 3.) defines the channels of the character, 4.) allows sounds and effects to be played on specific frames of the animations.

model model_new_character
        mesh                  -dest characters/anims/mesh.md5mesh
        channel torso         (*waist)
        channel legs          (*hips origin -*waist)

        anim idle               -dest characters/anims/idle.md5anim
        anim walk               -dest characters/anims/walk.md5anim
                frame 7         footstep
                frame 14        footstep
        anim run                -dest characters/anims/run.md5anim

Consult the existing .def files that have been provided with the SDK for additional examples. The multiplayer models and animations are defined and exported through player.def and player_meshes.def. The marine AI models and animations are exported through ai/char_marine.def.

4. Exporting Meshes and Animations to the Game

Exporting the meshes and animations converts the Maya files to the md5’s that the game uses -- as defined and listed in the .def files. It is first necessary to define where your version of Maya is located so that the engine can find it. Follow these steps:

Press the windows key and the pause/break key simultaneously.
Click the Advanced tab.
Click ‘Environmental Variables’.
Click ‘New’ and create a new variable name:
The variable value should be the path to the Maya directory, i.e. 
C:\Program Files\Alias\Maya6.0\

When ready to export, access the console and type:

exportmodels ai/new_character.def

Be sure to include any subdirectories below the ‘def’ directory. This command will export any animation or mesh in the export block that has been updated since the last time the models from that .def file were exported. Animations and meshes that haven’t been updated will be ignored. Using the command ‘reexportmodels’ will export every animation and mesh within the def file, whether or not they have been updated.

Unless specifically defined in the export block, the frame range of the md5anim is pulled from the Time Slider of the source file. However, the engine assumes that every animation begins with frame 1 regardless of where the Time Slider range happens to lie. If the Time Slider starts on frame 10 and ends on frame 20, the .md5anim will start with frame 1 and end with frame 11. Therefore, it’s a good idea to have every source animation begin at frame 1.

To define the range in the export block:

anim    walk.ma -range 10 20 -dest walk

If there are any errors with the mesh or animations, etc., the engine will list the errors and the export will fail. A common mistake is to make a syntax error in the .def file which will either cause an error on export, or cause a successful export where the character won’t actually appear in the game (a simple box shows up in its place). If this occurs, scour the .def file for any misspellings, invalid paths, open braces, etc. Otherwise, if the export is successful, the new .md5’s will be available to use in both the game Editor and Modview.

Animations (last edited 2005-11-04 17:29:52 by EricBiessman)