Difference between revisions of "ANIM (File Format)"

From Retro Modding Wiki
Jump to: navigation, search
(Header0)
(Quaternion Array Format)
Line 85: Line 85:
 
| boneN/key0 | boneN/key1 | ... | boneN/keyN |
 
| boneN/key0 | boneN/key1 | ... | boneN/keyN |
 
|------------|------------|-----|------------|
 
|------------|------------|-----|------------|
 +
Any bone channels that were marked 0xff in the ''bone_translation_map'' are skipped by this array
 
</pre>
 
</pre>
 
|-
 
|-

Revision as of 17:52, 22 February 2015

Morphball render.png This file format is almost completely documented
Having trouble with bone rotations +/- 180 degrees in format 2

The ANIM format is used in conjunction with the CINF and CSKR to animate rigged CMDL meshes.

There are two versions of the ANIM format in Metroid Prime (indicated by the file's first long value):

Version Description
0x0 Quaternion array format
0x2 Rotation vector bitstream format

Quaternion Array Format

The Quaternion Array Format (0x0) is a less common animation format in Metroid Prime. It's only used in a Ridley intro animation and the rotating pirate data artifact hologram above the Impact Crater.

The format maps animation channels to bones and supplies rotations as an array of quaternion (WXYZ) keys. Optionally, translations may be specified for a subset of bones as an array of float3 keys.

Data Type Element Count Identifier Notes
Header0 1 header
char header‑>bone_entry_count bone_entry_map The index-positions of this table correspond to the bone ids in the associated CINF. The value is 0xff if the bone is not animated by this ANIM or an index relating the bone_translation_map and quaternion_key_array below
long 1 bone_channel_count Count of bone channels present in the bone_translation_map and quaternion_key_array below
char bone_channel_count bone_translation_map Each bone channel may be optionally augmented with translation vectors at the bottom of the file
long 1 quaternion_key_count Count of elements quaternion_key_array below
float4 quaternion_key_count quaternion_key_array The quaternion keys are interleaved like such (bone-major):
|------------|------------|-----|------------|
| bone0/key0 | bone0/key1 | ... | bone0/keyN |
| bone1/key0 | bone1/key1 | ... | bone1/keyN |
| .......... | .......... | ... | .......... |
| boneN/key0 | boneN/key1 | ... | boneN/keyN |
|------------|------------|-----|------------|
long 1 translation_key_count Count of elements translation_key_array below
float3 translation_key_count translation_key_array The translation keys are interleaved like such (bone-major):
|------------|------------|-----|------------|
| bone0/key0 | bone0/key1 | ... | bone0/keyN |
| bone1/key0 | bone1/key1 | ... | bone1/keyN |
| .......... | .......... | ... | .......... |
| boneN/key0 | boneN/key1 | ... | boneN/keyN |
|------------|------------|-----|------------|
Any bone channels that were marked 0xff in the ''bone_translation_map'' are skipped by this array
long 1 evnt_ref ID for this ANIM's EVNT resource, or 0xffffffff if no events triggered

Header0

Offset Length Data Type Identifier Notes
0x0 4 float duration Time in seconds that the animation plays for
0x4 4 float key_interval Time in seconds between keys of each bone channel (reciprocal of frame-rate)
0x8 4 long bone_entry_count Count of bone-channels in animation
0xC 4 long key_count Count of keys for each bone channel (keys are set for every frame of the animation)

Bitstream Format