Introduction
This is the model format of Quake, released by id Software in 1996, used for monsters, weapons, items and the player. A model is a single mesh animated by storing the position of every vertex in every frame. Its skins, the textures wrapped around it, are 8-bit images in Quake’s 256-colour palette, stored inside the model file.
The Quake source code was released under the GPL in 1999, and the format is still used by Quake engine ports and the games and mods built on them. It was followed by MD2 in Quake II. Half-Life’s studio models share the extension but not the format.
Structure
A Quake MDL file is binary and little-endian. The header starts with
IDPO and version 6, then gives a scale and an origin used to unpack the
vertices, a bounding radius, the eye position, the counts of skins, vertices,
triangles and frames, the skin size, and flags such as the rocket trail an object
leaves.
The skins follow, each a block of palette indices, or a group of skins that animate. Then come the texture coordinates, with a flag for vertices on the seam between the front and back of the skin, the triangles, each with a flag saying whether it faces front, and the frames. Each frame stores every vertex as three bytes plus a byte choosing a normal from a fixed table, and a frame can also be a group of frames that play in a loop.
0HeaderIDPO, version 6, scale, origin, counts, flags84 bytes84Skins 8-bit palette imagesvaries…Texture coordinates seam flag, s, t12 bytes each…Triangles front flag, three vertex indices16 bytes each…Frames packed vertices for each framevaries
In this reference
- Header and data – every header field, sync types and effect flags, skins and skin groups, texture coordinates and the seam rule, triangles, frames and frame groups, with a worked example
- Normal table – the 162 vertex normals, shared with Quake II’s MD2
In the explorer
A dropped Quake model shows its header, skins, texture coordinates, triangles and frames in the byte
tree and in tables, every vertex of every frame decoded. Each skin picture, including those of skin
groups, can be opened as an image, and the model is drawn in 3D with the frames and frame groups played
as animations. Skins take their colours from a palette.lmp when one is supplied beside the
model; without it each palette index is drawn as a grey level. Files of up to 256 MB are read.
The model is textured with the first skin; the option “Skin on the model” chooses another. A skin group changes picture on the model at its times, as WinQuake does, or ten a second from four places as GLQuake does. A skin wider or taller than 8,192 pixels is cut into tiles of 4,096 pixels, every triangle with it, and nothing is made smaller; beyond eight million triangle pieces it is not laid on the model.
A model with EF_ROTATE turns while the animation plays. For a model with a trail flag the
option “Trail” runs it round a circle at 300 units a second, stepped 72 times a second, and draws the
particles of its trail in the Textured mode; the path and the speed are the viewer’s own, since a model
file does not say how it moves. Without a palette.lmp the particles are light grey.
Not described
Known, not yet covered
- Viewer: the light a rocket (
EF_ROCKET) casts on its surroundings is not drawn; the view has no level for it to fall on.
Other formats that use .mdl
The Quake model is a different format from Valve’s studio models: they share only the extension.
- Half-Life model (IDST) – Valve’s skeletal model for Half-Life (GoldSrc): bones, sequences and hit boxes
- Source engine model – Valve’s studio model for Source, versions 44 to 49, with vertex and strip files
Links
Software
- QuakeSpasm – Quake engine port that plays Quake and its mods (Windows, macOS, Linux)
Developers
- Quake source code – id Software’s engine code under the GPL, including the model loader (C)
- Assimp – library that imports dozens of 3D formats, Quake MDL among them (C++)
Reference
- modelgen.h – the Quake header file that defines the model structures
- Unofficial Quake Specs: Alias models – the community’s 1996 description of the format