MOD file

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search

MOD Format[edit]

The MOD format is a proprietary binary data structure used to represent and serialize 3D model data, including geometry, textures, materials, and metadata. It employs a chunk-based architecture where each chunk represents a specific data category or type, enabling modular and efficient parsing and serialization.

Alignment[edit]

Chunks are written at addresses that are a multiple of `0x20` (32), using `00` bytes to pad as necessary. This is done for efficiency during reading and writing operations.

Chunk Structure[edit]

Although every individual chunk is unique, they all follow a similar structure:

Header[edit]

Each chunk begins with a header consisting of:

  • Opcode (4 bytes): Identifies the chunk type.
  • Length (4 bytes): Specifies the size of the chunk payload, excluding the header.


Chunk Types[edit]

Below is a list of chunk types with links to detailed descriptions:

Chunk Details[edit]

Header (0x00)[edit]

  • Description: Contains minimal metadata about the MOD file, including creation date and flags.
  • Contents: (To be filled)

Vertex (0x10)[edit]

  • Description: Contains vertex position data for the 3D model.
  • Contents: (To be filled)

VertexNormal (0x11)[edit]

  • Description: Contains normal vector data for vertices, used for lighting calculations.
  • Contents: (To be filled)

VertexNBT (0x12)[edit]

  • Description: Stores additional data such as binormal and tangent vectors for vertices.
  • Contents: (To be filled)

VertexColour (0x13)[edit]

  • Description: Contains color information for vertices, often used for vertex shading.
  • Contents: (To be filled)

TexCoord0-7 (0x18 to 0x1F)[edit]

  • Description: Stores texture coordinate set 0 to 7 for mapping textures onto geometry.
  • Contents: (To be filled)

Texture (0x20)[edit]

  • Description: Contains texture data used for rendering the model.
  • Contents: (To be filled)

TextureAttribute (0x22)[edit]

  • Description: Stores attributes and metadata related to textures.
  • Contents: (To be filled)

Material (0x30)[edit]

  • Description: Defines materials, including shaders and associated textures.
  • Contents: (To be filled)

VertexMatrix (0x40)[edit]

  • Description: Stores transformation matrices for vertices.
  • Contents: (To be filled)

MatrixEnvelope (0x41)[edit]

  • Description: Defines envelopes for vertex weighting and deformation.
  • Contents: (To be filled)

Mesh (0x50)[edit]

  • Description: Contains data for geometric objects, including faces and connectivity.
  • Contents: (To be filled)

Joint (0x60)[edit]

  • Description: Stores joint data for skeletal animation.
  • Contents: (To be filled)

JointName (0x61)[edit]

  • Description: Contains names of joints for animation and rigging purposes.
  • Contents: (To be filled)

CollisionPrism (0x100)[edit]

  • Description: Defines collision prisms used in physics calculations.
  • Contents: (To be filled)

CollisionGrid (0x110)[edit]

  • Description: Contains data for collision grids, used for spatial partitioning.
  • Contents: (To be filled)

EndOfFile (0xFFFF)[edit]

  • Description: Marks the end of the MOD file.
  • Contents: (To be filled)

Additional Notes[edit]

  • Alignment ensures optimal performance with the GameCube and Wii, where aligned data loads quicker as they directly fall onto cache lines.