Data structures

This section documents the mdl file format itself, structure by structure, as ValveMDL understands it.

What is supported

ValveMDL is evidence driven: a structure is documented here once it has been read out of real files and cross-checked against the Source SDK, and not before. Gaps are left as gaps rather than guessed at.

Documented means the structure is defined here and checked against the SDK. Loaded means ValveMDL follows the offsets to it and hands it to you.

Structure

Documented

Loaded

studiohdr_t

yes

mdl.header

studiohdr2_t

yes

mdl.header2

mstudiobone_t

yes

mdl.bones, names and surfaceprops resolved

mstudiobonecontroller_t

yes

mdl.bonecontrollers

mstudioaxisinterpbone_t

yes

bone.procedural

mstudioquatinterpbone_t

yes

bone.procedural

mstudioaimatbone_t

yes

bone.procedural

mstudiojigglebone_t

yes

bone.procedural

vertexFileHeader_t

yes

mdl.vvd.header

FileHeader_t (vtx)

yes

mdl.vtx.header

mstudiovertex_t

yes

mdl.vvd.vertices

mstudiotexture_t

yes

mdl.textures, names resolved

cdtextures (search paths)

yes

mdl.cdtextures

Skin replacement table

yes

mdl.skins

mstudioanimdesc_t

yes

mdl.animations

mstudioseqdesc_t

yes

mdl.sequences

mstudioanim_t

yes

animation.nodes, extents measured

mstudioikchain_t

yes

mdl.ikchains, with .links

mstudioikrule_t

yes

animation.ikrules

mstudioevent_t

yes

sequence.events

mstudioflexdesc_t

yes

mdl.flexdescs

mstudioflexcontroller_t

yes

mdl.flexcontrollers

mstudioflexrule_t

yes

mdl.flexrules, with .ops

mstudioflex_t

yes

mesh.flexes, with .vertanims

mstudioeyeball_t

yes

model.eyeballs

mstudiolinearbone_t

yes

mdl.linearbones

mstudiobodyparts_t

yes

mdl.bodyparts, names resolved

mstudiomodel_t

yes

mdl.models, or bodypart.models

mstudiomesh_t

yes

mdl.meshes, or model.meshes

mstudiohitboxset_t

yes

mdl.hitboxsets, with .hitboxes

mstudiobbox_t

yes

hitboxset.hitboxes

mstudioattachment_t

yes

mdl.attachments

mstudioposeparamdesc_t

yes

mdl.poseparameters

mstudiomodelgroup_t

yes

mdl.includemodels

mstudiomouth_t

yes

not yet

mstudioanimblock_t

yes

not yet

Vertex and tangent pools

yes

mdl.vvd.vertices / .tangents

Vvd fixup table

yes

mdl.vvd.fixups, replayed by mesh_vertices()

Vtx mesh tree

yes

mdl.vtx.bodyparts

Versions

Team Fortress 2 ships mdl versions 44, 45, 46, 47 and 48 – five variants of the same format, in the same game. Version 48 accounts for about 91% of them. studiohdr_t itself is unchanged across that whole range; the version differences live in how the structures it points at are interpreted.