VM61 BIN (File Format)

From Wexos's Wiki
Jump to navigationJump to search

BIN is a model file format used in Luigi's Mansion Arcade which inherits from the VM61 format. The format consist of a hierarchy of nodes, where each node can contain child nodes and meshes. The textures are external DDS files, and are linked by each material. This format is an evolution of Mario Kart Arcade GP DX's BIKE BIN.

File Format

The file byte order is always little endian. All sections and subsections are aligned to 0x10.

VM61 Header

The file starts with the common VM61 header. It has the following structure:

Offset Type Description
0x00 Char[4] File magic. Always VM61 in ASCII.
0x04 UInt32 Version number of the file format.
0x08 UInt32 Size of this header in bytes.
0x0C UInt32 Unknown. Seems to be padding.

BIN Header

The BIN header follows the VM61 header. It has the following structure:

Offset Type Description
0x00 Int64 Number of materials.
0x08 Int64 Material array offset.
0x10 Int64 Number of texture references.
0x18 Int64 Texture reference array offset.
0x20 Int64 Number of bones.
0x28 Int64 Bone array offset.
0x30 Int64 Root node offset.
0x38 Int64 Number of bone links.
0x40 Int64 Bone links array offset.
0x48 Int64 Number of node pairs.
0x50 Int64 Node pair array offset.
0x58 Int64 Padding.

Material

Each material has the following structure:

Offset Type Description
0x00 Int64 Material name offset.
0x08 Byte Unknown.
0x09 Byte Unknown.
0x0A UInt16 Unknown.
0x0C UInt32 Unknown.
0x10 Byte Unknown.
0x11 Byte Unknown.
0x12 UInt16 Unknown.
0x14 UInt32 Unknown.
0x18 Byte Unknown.
0x19 Byte Unknown.
0x1A UInt16 Unknown.
0x1C UInt32 Unknown.
0x20 UInt32 Unknown.
0x24 Byte Unknown.
0x25 Byte Unknown.
0x26 UInt16 Unknown.
0x28 Byte Unknown.
0x29 Byte Unknown.
0x2A UInt16 Unknown.
0x2C Byte Unknown.
0x2D Byte Unknown.
0x2E Byte Unknown.
0x2F Byte Unknown.
0x30 Float[4] Ambient color in RGBA.
0x40 Float[4] Diffuse color in RGBA.
0x50 Float[4] Specular color in RGBA.
0x60 Float[4] Incandescence color in RGBA.
0x70 Float Shiny.
0x74 Float Unknown.
0x78 Float Unknown.
0x7C Float Unknown.
0x80 Float Unknown.
0x84 Float Unknown.
0x88 Float Unknown.
0x8C UInt32 Unknown.
0x90 UInt32 Unknown.
0x94 UInt32 Unknown.
0x98 UInt32 Unknown.
0x9C UInt32 Unknown.
0xA0 Int64 Unknown.
0xA8 Int64 Translation animation offset.
0xB0 UInt32 Unknown.
0xB4 UInt32 Unknown.
0xA8 Int16 Color 1 texture index.
0xAA Int16 Color 2 texture index.
0xAC Int16 Color 3 texture index.
0xAE Int16 Specular texture index.
0xB0 Int16 Reflective texture index.
0xB2 Int16 Environment texture index.
0xB4 Int16 Normal texture index.
0xB6 Int16 Incandescence texture index.

Translation Animation

If the offset is not 0, a simple translation animation is applied to the material. The animation is a constant value.

Offset Type Description
0x00 Float U translation.
0x04 Float V translation.

Texture Reference

Each texture reference has the following structure:

Offset Type Description
0x00 Int64 Texture name offset.

Bone

Each bone has the following structure:

Offset Type Description
0x00 Int64 Bone name offset.
0x08 Int64 Node pair offset.

Root Node

The root node has the following structure:

Offset Type Description
0x00 Int64 Node pair offset.

Bone Link

Each bone link corresponds to a node that contains a model object as well as a node that contains a bone, then it gives a local ID for each bone.

Offset Type Description
0x00 Int64 Model object node offset.
0x08 Int64 Bone node offset.
0x10 UInt32 Local bone ID.
0x14 UInt32 Padding.

Node Pair

Each node pair contains the name and the node offset. The node pairs are in an array, which means it doesn't specify the hierarchy. Each entry has the following structure:

Offset Type Description
0x00 Int64 Node name offset.
0x08 Int64 Node offset.

Node

Each node has the following structure:

Offset Type Description
0x00 UInt32 Visibility flag.
0x04 Byte[28] Unknown.
0x20 Transform Node transform.
0x44 Float[3] Bounding sphere XYZ position.
0x50 Float Bounding sphere radius.
0x54 UInt32 Unknown.
0x58 Int64 Model object array offset. Points to an array of Int64s, which points to model objects. The count is not stored, but the array is terminated by 0.
0x60 Int64 Morph array offset. Points to an array of Int64s, which point to a sub-array of Int64s which point to baked model objects used as vertex morph animations. The count is not stored, but the array is terminated by 0.
0x68 Int64 Child node array offset. Points to an array of UInt32s, which points to node children. The count is not stored, but the array is terminated by 0.
0x70 Transform Pose transform.
0x94 Float[3] Bounding box maximum position.
0xA0 Float[3] Bounding box minimum position.
Transform
Offset Type Description
0x00 Float[3] Scale.
0x0C Float[3] Rotation, in radians.
0x18 Float[3] Translation.

Model Object

Each entry has the following structure:

Offset Type Description
0x00 UInt32 Unknown.
0x04 UInt32 Number of triangles to draw. The number of elements in the index buffer is equal to this number multiplied by 3.
0x08 Int32 Material index. -1 if none.
0x0C Float[3] Bounding sphere XYZ position.
0x18 Float Bounding sphere radius.
0x1C UInt32 Vertex count.
0x20 Int64 Position buffer offset.
0x28 Int64 Normal buffer offset.
0x30 Int64 Secondary normal buffer offset. Unknown usage.
0x38 Int64 Color buffer offset.
0x40 Int64 UV buffer 1 offset.
0x48 Int64 UV buffer 2 offset.
0x50 Int64 UV buffer 3 offset.
0x58 Int64 UV buffer 4 offset.
0x60 Int64 UV buffer 5 offset.
0x68 Int64 UV buffer 6 offset.
0x70 Int64 Index buffer offset.
0x78 UInt32 Number of bones influencing the vertices.
0x7C UInt64 Bone ID mask. Each bit represents a local bone ID from the corresponding bone link.
0x84 UInt32 Unknown.
0x88 Int64 Unknown.
0x90 Int64 Weight buffer offset (vertices * 4 bytes per bone).
0x98 Float[3] Bounding box maximum position.
0xA4 Float[3] Bounding box minimum position.

Tools

The following tools can handle VM61 BIN files:

  • (none)