Introduction
The X format is Microsoft’s model format for Direct3D, introduced with DirectX in the 1990s. The D3DX helper library in the DirectX SDK could load an X file straight into a mesh, so it was widely used in Windows games and samples of the DirectX 8 and 9 era. A file can hold meshes with normals, texture coordinates and materials, a hierarchy of frames, skin weights and animation.
Microsoft has since retired D3DX and the format with it, and newer engines use FBX or glTF instead. X files still turn up in older games and teaching material.
Structure
Every X file starts with a 16-byte header: the magic xof , a version
such as 0302 or 0303, a format, and the size of floats,
0032 or 0064. The format is txt for text,
bin for binary, or tzip and bzip for compressed
text and binary.
The body is a list of data objects, each an instance of a template. Templates are
declared types such as Frame, FrameTransformMatrix,
Mesh, MeshNormals, MeshTextureCoords,
MeshMaterialList, Material and
AnimationSet. Objects nest, so a frame holds its transform, its meshes and
its child frames.
xof 0303txt 0032
Mesh Triangle {
3;
0.0; 0.0; 0.0;,
1.0; 0.0; 0.0;,
0.0; 1.0; 0.0;;
1;
3; 0, 1, 2;;
}
The binary form, added in DirectX 3.0, stores the same objects as a stream of little-endian tokens.
In this reference
- Header and compression – the 16-byte header, every format and float size code, the MSZIP-compressed forms and the Header template
- Text encoding – reserved words, comments, template declarations, data objects, references, and the rules for commas and semicolons
- Binary encoding – every token and token record, the grammar, and a worked byte example
- Mesh and frame templates – every standard template for meshes, materials, frames, patches, progressive meshes and effects, with its GUID and members
- Animation and skinning – animation sets, keys and their types, options, compressed animation, skin weights
- Vertex data codes – the FVF flags of FVFData and the declaration types, methods and usages of DeclData
Not described
These pages follow Microsoft’s DirectX 9 documentation of the .x format and its templates. The explorer has no DirectX .x viewer, so a dropped file shows as bytes.
Known, not yet covered
- Viewer: there is no .x plugin: the text and binary encodings and their templates are not read.
Unknown
- Reference: whether a compressed chunk’s size includes the
CKmarker, and the data format ofCompressedAnimation. - Reference: the template pages for
FaceAdjacency,PMInfo,PMVSplitRecord,PMAttributeRange,DeclData,VertexElement,CompressedAnimationSet,AnimationKey,FloatKeys,TimedFloatKeysandXSkinMeshHeaderon Microsoft Learn were re-read on 13 November 2026 and add nothing that was missing: the meaning of thePMInfo,PMVSplitRecordandPMAttributeRangemembers (Microsoft: “Not supported. Used internally by DirectX”), what theFaceAdjacencyindices hold (its text repeats the duplicate-vertex description), the layout ofDeclData’sdataDWORDs, and the order of quaternion values (Microsoft says only that rotation is key type 0; Assimp reads w, x, y, z) all remain undocumented. - Reference: the extras of Retained Mode, and the differences between versions 3.2 and 3.3.
Links
Software
- DirectX Viewer – the model viewer in the legacy DirectX SDK (Windows)
- Autodesk 3ds Max – modelling program that writes X files through an exporter plugin (Windows)
Developers
- Assimp – library that imports dozens of 3D formats, text and binary X files among them (C++)
Reference
- X file format reference – Microsoft’s description of the text and binary encodings and the templates
- Templates – Microsoft’s list of the standard templates, one page each
- DirectX file format – Paul Bourke’s copy of the older DirectX file format specification, with the Retained Mode templates