Introduction
MD5 is the model format of Doom 3, released by id Software in 2004, and of other games
on its engine such as Quake 4. Unlike the earlier MD2
and MD3, it is skeletal: vertices are attached to
joints by weights, and animations move the joints. The mesh and each animation are
separate text files, .md5mesh and .md5anim.
Because the files are readable text and the engine source was released under the GPL in 2011, MD5 became a common teaching example for skeletal animation.
Structure
An .md5mesh file starts with MD5Version 10 and the command
line that exported it, then the counts of joints and meshes. The
joints block gives each joint’s name, its parent and its position and
orientation in the bind pose, the orientation as three parts of a unit quaternion.
Each mesh block names its material and lists vertices, each with texture
coordinates and a range of weights; triangles as three vertex numbers; and weights,
each a joint, a bias and a position relative to that joint. A vertex’s position is the
sum of its weights.
MD5Version 10
commandline ""
numJoints 1
numMeshes 1
joints {
"origin" -1 ( 0 0 0 ) ( 0 0 0 )
}
mesh {
shader "models/crate"
numverts 3
vert 0 ( 0 0 ) 0 1
vert 1 ( 1 0 ) 1 1
vert 2 ( 0 1 ) 2 1
numtris 1
tri 0 0 1 2
numweights 3
weight 0 0 1 ( 0 0 0 )
weight 1 0 1 ( 1 0 0 )
weight 2 0 1 ( 0 1 0 )
}
An .md5anim file lists the joint hierarchy with flags saying which values
change, the bounds of each frame, a base frame, and then one block of changing values
per frame.
Links
Software
- dhewm3 – Doom 3 engine port that plays the game and its mods (Windows, macOS, Linux)
Developers
- Doom 3 source code – id Software’s engine code under the GPL, including the MD5 loader (C++)
- Assimp – library that imports dozens of 3D formats, MD5 among them (C++)