Difference between revisions of "BMD and BDL (File Format)"

From Custom Mario Kart
Jump to navigation Jump to search
m
Line 1: Line 1:
'''BMD''' and '''BDL''' are two file formats used by a wide variety of Nintendo games between the GameCube & Wii.  
+
'''BMD''' and '''BDL''' are two file formats used by a wide variety of [[Nintendo]] games between the [[GameCube]] and [[Wii]].  
  
 
== File Header ==
 
== File Header ==
Line 37: Line 37:
 
== Sections ==
 
== Sections ==
  
BMD & BDL contain mostly the same sections, with the exception of the MDL3 section that appears only within BDL files.
+
BMD and BDL contain mostly the same sections, with the exception of the MDL3 section that appears only within BDL files.
  
 
=== INF1 ===
 
=== INF1 ===
Line 83: Line 83:
 
|}
 
|}
  
The next part of the INF1 section describes the scene graph of the file, it controlls what references what. It starts immediately after 0x18 in the INF1 section. There can be many of these and they go in order:
+
The next part of the INF1 section describes the scene graph of the file, it controls what references what. It starts immediately after 0x18 in the INF1 section. There can be many of these and they go in order:
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 131: Line 131:
 
=== VTX1 ===
 
=== VTX1 ===
  
The VTX1 sections stores the vertex arrays for positions, colors, normals & texture coordinates. Additionally, it stores the data format in which these arrays are stored.
+
The VTX1 sections stores the vertex arrays for positions, colors, normals and texture coordinates. Additionally, it stores the data format in which these arrays are stored.
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 207: Line 207:
 
|}
 
|}
  
From here the VTX1 sections stores Vertex Data, until the begginnning of the next section.
+
From here the VTX1 sections stores Vertex Data, until the beginning of the next section.
  
 
=== EVP1 ===
 
=== EVP1 ===
Line 239: Line 239:
 
== Format Values ==
 
== Format Values ==
  
Here specific values & their meanings are listed for various sections.
+
Here are specific values and their meanings are listed for various sections.
  
 
=== VTX1 ===
 
=== VTX1 ===

Revision as of 20:19, 13 July 2016

BMD and BDL are two file formats used by a wide variety of Nintendo games between the GameCube and Wii.

File Header

The file begins with the header of 0x10 bytes. BDL Includes an extra section (MDL3) that BMD does not. The structure is the same as for BCK & JPA files (All lengths are in Hexadecimal):

Offset Size Description
0x00 8 File identifier: 'J3D2bmd3' for BMD and 'J3D2bdl4' for BDL in ASCII.
0x08 4 Length of file in bytes.
0x0c 4 Number of sections in the file (08 in BMD & 09 in BDL)
0x10 4 'SVR3' in ASCII.
0x14 0C Consists only of FF (Padding?)
End of header

Sections

BMD and BDL contain mostly the same sections, with the exception of the MDL3 section that appears only within BDL files.

INF1

The INF1 section contains Model Information.

Offset Size Description
0x00 2 Section name: 'INF1' in ASCII.
0x04 4 Length of section in bytes.
0x08 2 Unknown model setting (very similar to MDL0), 01 for BMD & 00 for BDL.
0x0a 4 Unknown model setting, always FFFF0000.
0x0c 4 Unknown model setting, seen to be anywhere from 0001 - 0030.
0x10 4 Number of coordinates in VTX1 section.
0x14 4 Offset location relative to beginning of section (After the length of section, typically location 0x18).
0x18 (O = The offset) 2 Unknown setting (Always 00 10).

The next part of the INF1 section describes the scene graph of the file, it controls what references what. It starts immediately after 0x18 in the INF1 section. There can be many of these and they go in order:

Offset Size Description
0x00 + O 4 Unknown
0x04 + O 4 Unknown
0x08 + O 4 Unknown
0x0a + O 4 Unknown
0x0e + O (O2 = This Offset) 4 Unknown

The end of this section:

Offset Size Description
0x00 + O2 O2 - Start of VTX1 Section Attempts to spell '......This is padding data to align' until the beginning of the VTX1 section in ASCII.
End of INF1 Section

VTX1

The VTX1 sections stores the vertex arrays for positions, colors, normals and texture coordinates. Additionally, it stores the data format in which these arrays are stored.

Offset Size Description
0x00 4 Section name: 'VTX1' in ASCII.
0x04 4 Size of section in bytes.
0x08 4 Offset location of the array data.
0x0c 4 Offset relative to the start of the 'VTX1' section (Always 0A if VTX1 section begins 0xFF).
End of section header, beginning of array format

The next section of the VTX1 section describes the array format, this section can be used many times.

Offset Size Description
0x00 4 ArrayType. (See VTX1 Array Types, the last array always seems to have 0x000000ff here)
0x04 4 ComponentCount. Effects DataType, 00 = Component Type 1, 01 = Component Type 2
0x08 4 DataType. (See VTX1 Component Types)
0x09 1 Position of decimal point, has only been seen to be 00, 07, 08, 0b & 0e.
0x0a 1 Always FF
0x0b 2 Always FF FF
End of array format

If there are five arrays or less, then immediately after the last array this will appear, and likewise if it exceeds five then it will not:

Size Description
0A Spells 'This is padding ' in ASCII

From here the VTX1 sections stores Vertex Data, until the beginning of the next section.

EVP1

This section is what contains the weight data for vertex skinning.

Offset Size Description
0x00 4 Section name: 'EVP1' in ASCII.
0x04 4 Size of section in bytes.
0x06 2 What it should count (See EVP1 Count Index
0x08 2 Padding (FF)

Format Values

Here are specific values and their meanings are listed for various sections.

VTX1

Known values for VTX1.

ArrayType

Value Reference Description
0x00 'POSITION_MATRIX_INDEX'
0x01 'TEX0_MATRIX_INDEX'
0x02 'TEX1_MATRIX_INDEX'
0x03 'TEX2_MATRIX_INDEX'
0x04 'TEX3_MATRIX_INDEX'
0x05 'TEX4_MATRIX_INDEX'
0x06 'TEX5_MATRIX_INDEX'
0x07 'TEX6_MATRIX_INDEX'
0x08 'TEX7_MATRIX_INDEX'
0x09 'POSITION' Texture position
0x0a 'NORMAL' This effects the direction of the normals
0x0b 'COLOR0' Vertex Colour Channel 1
0x0c 'COLOR1' Vertex Colour Channel 2
0x0d 'TEX0'
0x0e 'TEX1'
0x0f 'TEX2'
0x10 'TEX3'
0x11 'TEX4'
0x12 'TEX5'
0x13 'TEX6'
0x14 'TEX7'
0x15 'POSITION_MATRIX_ARRAY'
0x16 'NORMAL_MATRIX_ARRAY'
0x17 'TEXTURE_MATRIX_ARRAY'
0x18 'LIT_MATRIX_ARRAY'
0x19 'NORMAL_BINORMAL_TANGENT'
0x1a 'MAX_ATTR'
0xff 'NULL_ATTR'

CompType

Type 1

This may be used in DataType if ComponentType is set to 00:

Value Reference Description
0x00 'U8'
0x01 'S8'
0x02 'U16'
0x03 'S16'
0x04 'F32'
Type 2

This may be used in DataType if ComponentType is set to 01:

Value Reference Description
0x00 'RGB565'
0x01 'RGB8'
0x02 'RGBX8'
0x03 'RGBA4'
0x04 'RGBA6'
0x05 'RGBA8'

EVP1

Known values for EVP1.

Count

Value Description
0x00 Counts each bone
0x01
0x02
0x01