BMD/BDL (File Format)

From Luma's Workshop
Revision as of 07:40, 2 January 2025 by Super Hackio (talk | contribs)
Jump to navigation Jump to search
This page is in progress and may contain incomplete information or editor's notes.

BMD (Binary Model) and BDL (Binary Display List) are two 3D model formats used in Super Mario Galaxy and Super Mario Galaxy 2, among a few other Wii and GameCube games, such as Super Mario Sunshine.

These two formats hold the same data, except BDL contains an additional set of data which is used for faster rendering speeds.

Super Mario Galaxy & Super Mario Galaxy 2 contain J3DLoader versions 21 and 26.

File Header

Offset Type Description
0x00 String The magic that tells the game which format this file is. (ASCII)
J3D2bmd2 for BMD (J3DLoader V21)
J3D2bmd3 for BMD (J3DLoader v26)
J3D2bdl4 for BDL (J3DLoader v26)
0x08 Int32 The total size of the file
0x0C Int32 The number of chunks present in this file.
8 for BMD
9 for BDL

Subversion Header

This part of the header is not used, and can be anything.

Offset Type Description
0x00 String A 4 character value representing the Subversion. Usually SVR3 for SMG/2.
0x04 Byte[12] Twelve bytes of padding. Usually these are 0xFF

Information (INF1)

The Information section hosts a hierarchy of Joints, Materials, and Shapes, which are used to render the model.

Offset Type Description
0x00 String Always INF1 (ASCII)
0x04 Int32 The total size of this chunk
0x08 Int16 J3DLoader Flags
0x0A Int16 Padding (0xFFFF)
0x0C Int32 Matrix Group Count
0x10 Int32 Vertex Count

J3DLoader Flags

The J3DLoader contains several flags which affect how models are handled. There are more than what are shown here, however, those must be applied by the game itself in the code.

Value Description
0b0000000000000000 No flags applied (TODO: Check if this defaults to basic matrix calculation)
0b0000000000000001 Use Autodesk Softimage matrix calculation
0b0000000000000010 Use Autodesk Maya matrix calculation
0b0000000000000100 Use Basic matrix calculation
0b0000000000001000 UNKNOWN
0b0000000000010000 UseImmidiateMtx (needs research)
0b0000000000100000 UsePostTexMtx (needs research)
0b0000000001000000 UNKNOWN
0b0000000010000000 UNKNOWN
0b0000000100000000 NoMatrixTransform (needs research)
0b0000001000000000 UNKNOWN
0b0000010000000000 UNKNOWN
0b0000100000000000 UNKNOWN
0b0001000000000000 UNKNOWN
0b0010000000000000 DoBdlMaterialCalc
0b0100000000000000 NoBdlMaterialPatch - If set, skips the call to J3DModelLoader::readPatchedMaterial.
0b1000000000000000 UNKNOWN

For all BMD files, the game always includes load flags Material_PE_Full, Material_UseIndirect, UseUniqueMaterials, and UNKNOWN_21.
For all BDL files, the game always includes load flags Material_UseIndirect, and UseUniqueMaterials.

> Note: Changing the load flags by changing the code doesn't seem to do much.

TODO