Introduction
The studio model is Valve’s model format for Half-Life, released in 1998, and for the Source engine that followed. Unlike the Quake model it replaced, it is skeletal: the meshes are attached to a hierarchy of bones, and animations are sequences of bone movements that can be blended. A model also holds hit boxes for collisions with bullets, attachment points, body groups that swap parts in and out, and skin families of textures.
Studio models are compiled with Valve’s studiomdl tool from source files
such as SMD meshes and animations, and tools exist to
decompile them back.
Structure
A studio model is binary and little-endian. It starts with IDST, a
version number, the model’s name and its length, then the eye position, bounding
boxes and flags, followed by counts and offsets for each table: bones, bone
controllers, hit boxes, sequences, sequence groups, textures, skin families, body parts
and attachments.
Half-Life models are version 10. Large models may keep their textures in a second
file with a T added to the name, such as scientistT.mdl, and
animation in sequence group files numbered 01, 02 and so on.
Source engine models, version 44 and upwards, are a different layout and a
separate format.
In this reference
The reference pages cover version 10, Half-Life’s studio model. The Source engine versions are on the Source engine model pages.
- Header and files – every header field, the limits, the texture and sequence group companion files, and the transition graph
- Skeleton – bones, bone controllers and every motion flag, hit boxes and hit groups, attachments
- Sequences and animation – sequence groups, sequences, events, pivots, and how the run-length coded bone animation and blends are decoded
- Textures and geometry – textures and their flags and palettes, skin families, body parts, models, meshes and triangle commands
Viewer
Drop a version 10 model on this page, or open it from its folder so that the textures
file NAMET.mdl and the sequence group files NAME01.mdl,
NAME02.mdl and so on are used with it. The model is drawn and its
sequences played; the textures, bones, hit boxes and attachments are shown, and every
record, event, pivot, vertex and decoded animation value is listed. Options choose the
model of each body part, the skin family, the blend bytes and the bone controllers, and,
where sequence group 0’s unused2 field is not 0, whether it is added to
the place of the animations (as Valve’s SDK model viewer does) or ignored.
The model is lit, and its chrome textures are mapped, as the SDK’s model viewer works
them out; the option “Lighting” gives the light of the 3D view instead, and “Chrome
seen from” chooses between the viewer and the model’s origin. The table
of events says which wave file, sentence or following sequence an event’s options name,
and what a number below
1000 does in the monster whose model has this file’s name; the option “Events below
1000” picks another monster. During playback the note over the view says each event as
its frame is passed, with what it does or names, and keeps the words for half a second of
playback (the viewer’s own choice); up to eight events of one moment are written out
and the rest counted, all being in the table of events.
Files up to 256 MB are read. Where animation blocks share their values so often that
measuring them for the byte tree takes more than 40 million steps and one step for
every byte of the file, the later blocks are shown by their channel offsets, and the
option “Byte tree from sequence” measures them.
Body parts may share an array of models, models an array of meshes and meshes their triangle commands: each record is read once, the table of models still lists every model of every body part, and the tables of meshes and vertices list a shared record under the first body part that names it. Where the body parts have more than 4,096 choices of model together, one field, “Body part models”, takes pairs such as 0:2 instead of a list for each part. One view draws up to 2,000,000 triangles; when there are more, body parts that draw the same arrays are drawn once, and the option “3D view: start at triangle” reaches the rest. Records that overlap one another at different alignments, which only a damaged or crafted file has, are read up to as many as the file could hold side by side (and triangle vertices up to one for every four bytes); the problems list says so.
Not described
Known, not yet covered
- Viewer: sequence events are listed and said over the 3D view as playback passes them, but not acted out: the sound files they name are not played, and no muzzle flashes or sparks are drawn, whose appearance the engine decides.
Unknown
- Reference: what the values of the header’s
flagsfield mean. The compiler stores the number it is given, and the published SDK headers and sources define no value; the engine that reads it is not published.
Other formats that use .mdl
The Half-Life model is a different format from Quake’s and from the Source engine’s: they share only the extension.
- Quake model (IDPO) – Quake’s animated model: palette skins inside the file and whole-frame animation
- Source engine model – Valve’s studio model for Source, versions 44 to 49, with vertex and strip files
Links
Software
- Half-Life Model Viewer – community viewer for studio models (Windows)
Developers
- Half-Life SDK – Valve’s code, including the studio model renderer and
studiomdl(C++) - Assimp – library that imports dozens of 3D formats, Half-Life studio models among them (C++)
Reference
- studio.h – the Half-Life SDK header that defines the version 10 structures