Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:MDL (Quake)

From ReverseEngineering.wiki
Format
Developer id Software
Versions 6
Magic 49 44 50 4F ("IDPO") at offset 0, then int32 6
Extensions .mdl
Endianness little
On this wiki Facts · Code · Notes · Topics

Alias (vertex-animated) model format of Software:Quake: magic "IDPO", version 6, an 84-byte header with scale and origin for decoding byte-quantised vertices, followed by 8-bit skins, texture coordinates, triangles and keyframes. Not related to the Half-Life or Source .mdl formats.

Identification

IDPO at offset 0 and the int32 version 6. Half-Life (IDST) and Source models use the same extension but are unrelated.

Structure

After the 84-byte header, in order:

  1. Skins (numskins times): an int32 type (0 single, 1 group). A single skin is skinwidth * skinheight palette indices; a group is a count, that many float intervals, then that many images.
  2. Texture coordinates (numverts times, 12 bytes): onseam, s, t as int32.
  3. Triangles (numtris times, 16 bytes): facesfront and three vertex indices.
  4. Frames (numframes times): an int32 type (0 single, 1 group). A single frame is a bounding-box min and max vertex, a 16-byte name, then numverts 4-byte vertices; a group adds a count, bounds, float intervals and that many single frames.

A vertex is three unsigned bytes and an index into the engine's table of 162 precomputed normals. The model-space position is scale * v + scale_origin per axis.

Pitfalls

  • Skin coordinates of back-facing triangles that touch a seam vertex (onseam set, 0x20) get half the skin width added to s: the skin holds front and back halves side by side.
  • Frame and skin types are full int32, not bytes.

Evidence & references

  • id Software Quake source, WinQuake/modelgen.h (mdl_t, stvert_t, dtriangle_t, trivertx_t, daliasframe_t), model.c (Mod_LoadAliasModel), r_alias.c (seam fix-up of half the skin width, transform from scale_origin) at commit bf4ac42.
  • Runtime test: all 81 .mdl files of LibreQuake v0.09-beta start with IDPO and version 6.