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:MD2 (Quake II)

From ReverseEngineering.wiki
Format
Developer id Software
Versions 8
Magic 49 44 50 32 ("IDP2") then int32 8
Extensions .md2
Endianness little
On this wiki Facts · Code · Notes · Topics

Vertex-animated model format of Quake II (magic IDP2, version 8): a 68-byte header, skins, texture coordinates, triangles, frames of byte-quantised vertices and optional GL command lists.

Header

17 int32 fields (68 bytes): ident ("IDP2"), version (8), skinwidth, skinheight, framesize (bytes per frame), num_skins, num_xyz, num_st, num_tris, num_glcmds, num_frames, ofs_skins, ofs_st, ofs_tris, ofs_frames, ofs_glcmds, ofs_end.

Limits in the engine headers: 4096 triangles, 2048 vertices, 512 frames, 32 skins, skin name 64 bytes.

Layout

Skins are 64-byte paths (usually .pcx), texture coordinates are int16 pairs, triangles hold three vertex indices and three texture-coordinate indices; each frame has scale and translate vectors, a 16-byte name and per-vertex bytes (x, y, z, normal index into the 162-entry table). Layout details of frames beyond the header are from the Quake 2 model documentation and are not re-checked here (unverified).

The older Quake 1 model format is Format:MDL (Quake); the Quake III successor is Format:MD3 (Quake III).

Code & repositories

  • https://github.com/id-Software/Quake-2 @ 372afde46e7defc9dd2d719a1732b8ace1fa096e · license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize a license file)
    GPL release of the Quake II source; qcommon/qfiles.h defines BSP v38, PAK, WAL, PCX, MD2 and SP2 on-disk structures.
    Tested on: source read, not run: source read, not built: qcommon/qfiles.h at commit 372afde · checked 2026-10-18; last activity 2023-12-05

Evidence & references

id-Software/Quake-2 qcommon/qfiles.h at commit 372afde: IDALIASHEADER, ALIAS_VERSION, dmdl_t.