BMD/BDL (File Format): Difference between revisions

From Luma's Workshop
Jump to navigation Jump to search
(Begin a BMD/BDL page with the goal to actually have a complete one)
 
No edit summary
Line 6: Line 6:
These two formats hold the same data, except BDL contains an additional set of data which is used for faster rendering speeds.
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 ==
{| class="wikitable"
|-
! Offset !! Type !! Description
|-
| 0x00 || String || The magic that tells the game which format this file is. (ASCII)<br/>'''J3D2bmd2''' for BMD (J3DLoader V21)<br/>'''J3D2bmd3''' for BMD (J3DLoader v26)<br/>'''J3D2bdl4''' for BDL (J3DLoader v26)
|-
| 0x08 || Int32 || The total size of the file
|-
| 0x0C || Int32 || The number of chunks present in this file.<br/>'''8''' for BMD<br/>'''9''' for BDL
|}


=== Subversion Header ===
This part of the header is not used, and can be anything.
{| class="wikitable"
|-
! 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 '''Inf'''ormation section hosts a hierarchy of Joints, Materials, and Shapes, which are used to render the model.
{| class="wikitable"
|-
! Offset !! Type !! Description
|-
| 0x00 || String || Always '''INF1''' (ASCII)
|-
| 0x04 || Int32 || The total size of this chunk
|-
| 0x08 || Int16 || [[#J3DLoader%20Flags|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.
{| class="wikitable"
|-
! 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 (needs research. might skip a call to `J3DModelLoader::readPatchedMaterial`... Look into that soon.)
|-
| 0b0100000000000000 || ''UNKNOWN'' (Might be related to the above one)
|-
| 0b1000000000000000 || ''UNKNOWN''
|}


== TODO ==
== TODO ==

Revision as of 04:40, 2 January 2025

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 (needs research. might skip a call to `J3DModelLoader::readPatchedMaterial`... Look into that soon.)
0b0100000000000000 UNKNOWN (Might be related to the above one)
0b1000000000000000 UNKNOWN

TODO