MOD file

From Pikmin Technical Knowledge Base
Revision as of 23:08, 3 January 2025 by Sinf (talk | contribs) (Redux)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

MOD Format

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

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

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

Header

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

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

Chunk Details

Header (0x00)

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

Vertex (0x10)

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

VertexNormal (0x11)

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

VertexNBT (0x12)

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

VertexColour (0x13)

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

TexCoord0-7 (0x18 to 0x1F)

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

Texture (0x20)

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

TextureAttribute (0x22)

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

Material (0x30)

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

VertexMatrix (0x40)

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

MatrixEnvelope (0x41)

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

Mesh (0x50)

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

Joint (0x60)

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

JointName (0x61)

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

CollisionPrism (0x100)

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

CollisionGrid (0x110)

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

EndOfFile (0xFFFF)

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

Additional Notes

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