## Contents

- Model Types

- Player Models
- Weapon Models

- Tags
- Animations
- Paths
- Skins And Textures
- MD3 Limits

## Model Types

An MD3 model contains a set of meshes and tags. Some in-game Quake models are actually composites of several MD3 files. For example, a player model consists of head.md3, upper.md3, and lower.md3 files. Tags within these files tell Quake how to assemble the model files into one single model.

Misfit Model 3D is capable of loading and saving a single MD3 file, or loading and saving all files in a player model as one model.

If you attempt to load a file named head.md3, upper.md3, or lower.md3 and the other two files are present, MM3D will ask you if you want to load all sections as a player model. Answer Yes to load all three files as one model. Answer No to load only the specified model file.

When you save a model, MM3D will ask to save as a player model if the following conditions are met. If any of the following conditions are not met, the model will be saved as a single MD3 file.

- The saving file name is head.md3, upper.md3, or lower.md3
- The model contains at least two points; named tag_torso and tag_head.
- The model contains at least one group beginning with h_ (for head meshes), u_ (for upper body meshes), and l_ (for lower body meshes).
- The MD3_composite metadata value is not set to 0 (zero)

If the model is saved as a player model the animation.cfg file will be created automatically. If the model is saved as a single file, no animation.cfg file will be created.

Skin files are read automatically for player and non-player models. Skin files are never created or modified by MM3D. If you wish to change or create a skin file you must do this step manually.

### Player Models

A typical MD3 player model might be 60 GL units tall and 30 wide. The base of the feet should be at -24.

Player models consist of three model files: head.md3, upper.md3, and lower.md3. Usually these correspond to head, torso, and legs respectively. These three models are connected with tags (Points in MM3D). The weapon and Team Arena CTF flag the player is holding are also connected to the player model with a tag.

Typical tags for player models:

Model File | Tags in model
--- | ---
head.md3 | tag_head
upper.md3 | tag_head, tag_torso, tag_weapon, (Team Arena) tag_flag
lower.md3 | tag_torso

Other unknown tags will be saved in all model files which can be used by Quake 3 mods.

You can have multiple skins for a player model. Each md3 file should have a corresponding skin file (head_default.skin, lower_default.skin, upper_default.skin). Usually there are at least three skins for a player model: _default.skin, _red.skin, and _blue.skin. For more on skins see Skins and Textures.

Player models need an animation.cfg file to specify which frames correspond to in-game actions. An animation.cfg file might look like the example below. All animation sequences should have at least one frame.

Head models do not have animations in Quake 3. The head is attached to the tag_head tag in the upper body model. If you want to animate the head, you can hide the tag_head inside the model and do all the head animations in the torso (upper) meshes. You should still make a head model because it is displayed on the HUD.

It's possible to add support for head animations by modifying the Quake 3 code. MM3D supports ALL_ animation prefix for head/upper/lower animations and HEAD_ animation prefix for head-only animations.

The animation name affects which sections of the player the animation is exported to.

Animation Prefix | Models
--- | ---
ALL_ | upper.md3, lower.md3, head.md3
BOTH_ | upper.md3, lower.md3
TORSO_ | upper.md3
LEGS_ | lower.md3
HEAD_ | head.md3

Quake 3 player model animations must be in the same order as listed below. The optional Quake III: Team Arena animations at the end of the list require tag_flag tag in the upper model to be used in-game. It is recommended to set Loop for each animation as listed below in the Animation Panel. This controls whether the individual animations are marked as looping in the exported animation.cfg.

Animation | Loop | Description
--- | --- | ---
BOTH_DEATH1 | no | Random death 1, for example twirl death.
BOTH_DEAD1 | no | Set animation frame count to 0 in MM3D to use last frame of BOTH_DEATH1.
BOTH_DEATH2 | no | Random death 2, for example other side twirl death.
BOTH_DEAD2 | no | Set animation frame count to 0 in MM3D to use last frame of BOTH_DEATH2.
BOTH_DEATH3 | no | Random death 3, for example backflip death.
BOTH_DEAD3 | no | Set animation frame count to 0 in MM3D to use last frame of BOTH_DEATH3.
TORSO_GESTURE | no | Taunt.
TORSO_ATTACK | no | Firing gun. This is synced with first person hand model and must have 6 frames.
TORSO_ATTACK2 | no | Guntlet punch. This is synced with first person hand model and must have 6 frames.
TORSO_DROP | no | Drop weapon. This is synced with first person hand model and must have 5 frames.
TORSO_RAISE | no | Raise weapon. This is synced with first person hand model and must have 4 frames.
TORSO_STAND | no | Holding gun.
TORSO_STAND2 | no | Holding gauntlet.
LEGS_WALKCR | yes | Walking while crouching. It is played in reverse when walking backward.
LEGS_WALK | yes | Walking forward. It is played in reverse when walking backward.
LEGS_RUN | yes | Running forward.
LEGS_BACK | yes | Running backward.
LEGS_SWIM | yes | Swimming.
LEGS_JUMP | no | Jump forward (jump off the ground).
LEGS_LAND | no | Jump forward (land).
LEGS_JUMPB | no | Jump backward (jump off the ground).
LEGS_LANDB | no | Jump backward (land).
LEGS_IDLE | yes | Idle standing.
LEGS_IDLECR | yes | Idle crouching.
LEGS_TURN | yes | Standing still and turning left or right.
TORSO_GETFLAG | no | Team Arena; give order to get flag.
TORSO_GUARDBASE | no | Team Arena; give order to guard base.
TORSO_PATROL | no | Team Arena; give order to patrol.
TORSO_FOLLOWME | no | Team Arena; give order to follow me.
TORSO_AFFIRMATIVE | no | Team Arena; confirm order.
TORSO_NEGATIVE | no | Team Arena; reject order.

#### Example animation.cfg

    //Quake3 player animation file

    sex m
    footsteps normal

    // first frame, num frames, looping frames, frames per second

    0       32      0       25              // BOTH_DEATH1
    32      1       0       25              // BOTH_DEAD1
    32      35      0       20              // BOTH_DEATH2
    67      1       0       20              // BOTH_DEAD2
    68      25      0       25              // BOTH_DEATH3
    93      1       0       25              // BOTH_DEAD3

    94      39      0       15              // TORSO_GESTURE
    133     7       0       15              // TORSO_ATTACK  (MUST NOT CHANGE -- hand animation is synced to this)
    140     11      0       15              // TORSO_ATTACK2 (MUST NOT CHANGE -- hand animation is synced to this)
    151     5       0       15              // TORSO_DROP    (MUST NOT CHANGE -- hand animation is synced to this)
    156     6       0       15              // TORSO_RAISE   (MUST NOT CHANGE -- hand animation is synced to this)
    162     31      0       10              // TORSO_STAND
    193     11      0       10              // TORSO_STAND2

    94      12      12      15              // LEGS_WALKCR
    107     12      12      15              // LEGS_WALK
    120     12      12      17              // LEGS_RUN
    133     14      12      17              // LEGS_BACK
    148     12      12      14              // LEGS_SWIM
    159     6       0       8               // LEGS_JUMP
    167     6       0       12              // LEGS_LAND
    172     6       0       10              // LEGS_JUMPB
    178     6       0       10              // LEGS_LANDB
    185     6       6       5               // LEGS_IDLE
    192     7       7       5               // LEGS_IDLECR
    200     6       6       20              // LEGS_TURN

#### Player Metadata

Set MD3_CFG_* metadata to insert a keyword into the animation.cfg. For example, set MD3_CFG_sex meta data to value f to specify that the player model is female. Keywords and values are automatically detected when loading a player model. Any arbitraty keywords can be used. Keywords should not start with an animation prefix (ALL_, BOTH_, TORSO_, LEGS_, or HEAD_) as it may be detected as an animation when loaded by MM3D. Quake 3 only supports sex, footsteps, headoffset, fixedtorso, and fixedlegs. Example:

    sex f // m, f, or n
    footsteps normal // footstep sfx: normal, boot, flesh, mech, or energy
    headoffset 0 0 0 // head offset when displayed on HUD
    fixedtorso // don't rotate torso pitch when looking up or down
    fixedlegs // don't rotate legs (always align with torso)

Set the MD3_AnimKeyword metadata value to 1 to list animation names at the beginning of line in animation.cfg. This is automatically detected when loading a player model. It is not supported by Quake 3. It is used by Elite Force Single Player and Turtle Arena. Example:

    BOTH_DEATH1 0       32      0       25
    BOTH_DEAD1  32      1       0       25

Set the MD3_NoSyncWarning metadata value to 1 to disabling writing sync warnings in animation.cfg for TORSO_ATTACK, TORSO_ATTACK2, TORSO_DROP, and TORSO_RAISE. It is used by Turtle Arena which does not feature first person hand models.

Set the MD3_EliteLoop metadata value to 1 to use Elite Force Single Player style looping values in animation.cfg. -1 for not looping and 0 for looping instead of Quake 3 style 0 for not looping and number of frames for looping. It is not supported by Quake 3. This is automatically detected when loading a player model if a looping value is -1.

### Weapon Models

A typical MD3 weapon might be 5 GL units wide and 45 long. They usually would have no animations, although it should be possible to add animation by modifying the Quake 3 code. You can also add texture animations with shaders. Weapons are attached to the tag_weapon tag in the player model's upper model or first person hand model. Weapons typically have tag named tag_weapon at the model origin (0,0,0), however it is not used by the Quake 3 code. Some weapons have a tag named tag_flash where Quake 3 attaches the muzzle flash model (typically (weapon)_flash.md3 in the same directory). Some weapons have a tag named tag_barrel where Quake 3 attaches the barrel model (typically (weapon)_barrel.md3 in the same directory).

### Hand Models

A hand model is used for positioning the first person weapon model. The model consists of only an animated tag_weapon tag and is not rendered by Quake 3.

## Tags

Quake 3 uses tags to join models to each other. MM3D loads tags as points, so if you want to create a tag make a Point (more details about points). The point name should be whatever you want the name of the tag to be. The red axis of the tag is forward, the blue axis of the tag is up, and the green axis of the tag is left. For example you want the red side of that tag to face front for tag_weapon.

The MD3 orientation for tags is not the default orientation for MM3D points, so you must rotate any points you create into the correct orientation.

## Animations

MD3 animations specify vertex positions for each vertex for each frame of each animation. This can be tedious. When creating a model from scratch it is usually easier to save the model in MM3D format and create skeletal animations. Then when you are ready to export to MD3, convert the skeletal animations to frame animations using the Animation Sets Window and save as an MD3.

Because of the enormous overhead of saving undo information for animations upon insertion and deletion of vertex and face primitives, you are not allowed to add or remove primitives from a model that has frame animations. You may, however, merge another existing model into the one you are working on. This is another reason why it is best to work with MM3D files and skeletal animations and only export MD3 files when necessary.

MM3D will save all frame (vertex, mesh deformation) animations when saving as MD3.

## Paths

When an MD3 model is saved, path information is stored in the model. Quake3 uses a VFS (virtual file system), and you must tell Quake3 where your files are located in this VFS. For example a player model might be located in the Quake3 VFS at models/players/man/. So all the models and textures should probably be located in there and when you make a pk3 file (zip file really), it should contain that directory hierarchy.

We still need MM3D to save paths and filenames with models/players/man/. This is where the MD3_PATH metadata attribute comes in. You should set the MD3_PATH metadata attribute to models/players/man/. MD3 Filter will append all filenames that gets stored in the MD3 file to MD3_PATH. So your body.tga texture when saved would be written in the MD3 file as models/players/man/body.tga. When quake3 opens it that is where it will look in the VFS.

Note: The Quake 3 VFS does not start with a /.

## Skins and Textures

The MD3 filter can load any image type as a texture if MM3D can use it. When looking for a texture file it ignores the extension and finds any loadable texture with the the right file name (regardless of extension). For example if the model says it should use a file called body.tga, MD3 Filter could use body.png if it exists.

MD3 filter looks for texture images and skin files in the same directory as the model regardless of the values for paths contained in the model.

In general the MD3 filter attempts to load skins in the following manner:

- First it will look for .skin files with the following pattern. {modelName}_*.skin It will load all images inside those skin files. It will set the material to the image contained in {modelName}_default.skin.
- If no .skins files are there it will use shaderName specified in the model to look for a texture file.
- If that does not exist it will look for a valid texture whose filename matches {meshName}.*

When saving MD3 models it sets the shader name to the name of the texture that is assigned to the group. Also note that Quake3 by default only loads TGA and JPG files.

A skin file should be of the form indicated below.

mesh_name,MD3_PATH/textureFilename

and example upper_default.skin:

u_body,models/players/man/default_b.tga
u_cape,models/players/man/default_c.tga

Currently MD3 Filter will not load .shader files. These are files that could do complex OpenGL operations. You can still use shader files with your model inside Quake3 by creating the shader manually. Here is a example:

- Set group texture to meshName.tga
- Create a shader file called meshName.shader
- Quake3 should see meshName.shader and use it because MM3D set it to look for meshName.* and Quake3 should take the shader file first.
- Check your model in Quake3

## MD3 Limits

The MD3 file format has several limits that you should consider when making a model for this format. These are outlined below. If your model has more that the MD3 limit, the file will not be saved correctly and you should get a error message.

- Only faces and verticies in a group get saved.
- The MD3_PATH+file name cannot be longer than 63 characters. (Textures and model names)
- The group name and point name cannot be longer than 63 characters.
- Maximum of 1024 animation frames
- Maximum of 16 Points (Quake 3 Tags)
- Maximum of 32 Groups
- Maximum of 256 Textures per Group
- Maximum of 8192 Triangles per Group
- Maximum of 4096 Verticies per Group