ANIM (Metroid Prime): Difference between revisions
merging wiki pages for MP1/2 ANIM. Did format 0, will do format 2 later
imported>Jackoalan |
>Aruki (merging wiki pages for MP1/2 ANIM. Did format 0, will do format 2 later) |
||
Line 1: | Line 1: | ||
''This article is for the ANIM format used in ''Metroid Prime''. See [[ANIM (File Format)]] for the other revisions of this format.'' | ''This article is for the ANIM format used in ''Metroid Prime'' and ''Metroid Prime 2: Echoes''. See [[ANIM (File Format)]] for the other revisions of this format.'' | ||
The '''ANIM format''' is used in conjunction with [[CINF (File Format)|CINF]] + [[CSKR (File Format)|CSKR]] | The '''ANIM format''' is used in conjunction with [[CINF (File Format)|CINF]] + [[CSKR (File Format)|CSKR]] rigging to animate [[CMDL (Metroid Prime)|CMDL meshes]]. The format is largely the same between the two games, with the main difference being that starting in ''Metroid Prime 2'', support for animating scale was added. | ||
rigging to animate [[CMDL (Metroid Prime)|CMDL meshes]]. | |||
There are two versions of the ANIM format | There are two versions of the ANIM format (indicated by the file's first u32 value), one with compressed animations and one with uncompressed ones: | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 19: | Line 18: | ||
== Quaternion Array Format (Uncompressed) == | == Quaternion Array Format (Uncompressed) == | ||
The '''Quaternion Array Format''' (0x0) is a less common animation format | The '''Quaternion Array Format''' (0x0) is a less common animation format. In ''Metroid Prime'', it only appears in a Ridley intro animation and the rotating pirate data artifact hologram above the Impact Crater, as well as some unused Samus animations, while in ''Metroid Prime 2'', it only seems to show up in some draft/test animations not used in the final game. | ||
above the Impact Crater, as well as some unused Samus animations. | |||
This format stores uncompressed animations by mapping animation channels to bones, supplying rotations as an array of [[wikipedia:Quaternion|quaternion]] (WXYZ) keys and translations/scales as an array of XYZ keys. Translations may be specified for a subset of bones as an array of XYZ keys. In ''Metroid Prime'', rotation keys are required on every channel, while translations may be specified for a subset of bones. In ''Metroid Prime 2'', all three transform components are opt-in. | |||
=== Layout === | === Layout === | ||
Line 33: | Line 29: | ||
!style="width: 215px;"|Element Count | !style="width: 215px;"|Element Count | ||
!style="width: 240px;"|Name | !style="width: 240px;"|Name | ||
!MP1 | |||
!MP2 | |||
!Notes | !Notes | ||
|- | |- | ||
Line 39: | Line 37: | ||
|1 | |1 | ||
|'''Duration''' | |'''Duration''' | ||
|{{check}} | |||
|{{check}} | |||
|'''[1/2 in CCharAnimTime]''' Time in seconds that the animation plays for | |'''[1/2 in CCharAnimTime]''' Time in seconds that the animation plays for | ||
|- | |- | ||
Line 45: | Line 45: | ||
|1 | |1 | ||
|'''Differential State Enum''' | |'''Differential State Enum''' | ||
|{{check}} | |||
|{{check}} | |||
|'''[2/2 in CCharAnimTime]''' State of ''Duration'' time point for proper integration control <ol start="0"><li>Non Zero</li><li>Zero Increasing</li><li>Zero Steady</li><li>Zero Decreasing</li><li>Infinity</li></ol> | |'''[2/2 in CCharAnimTime]''' State of ''Duration'' time point for proper integration control <ol start="0"><li>Non Zero</li><li>Zero Increasing</li><li>Zero Steady</li><li>Zero Decreasing</li><li>Infinity</li></ol> | ||
|- | |- | ||
Line 51: | Line 53: | ||
|1 | |1 | ||
|'''Key Interval''' | |'''Key Interval''' | ||
|{{check}} | |||
|{{check}} | |||
|'''[1/2 in CCharAnimTime]''' Time in seconds between keys of each bone channel (reciprocal of frame-rate) | |'''[1/2 in CCharAnimTime]''' Time in seconds between keys of each bone channel (reciprocal of frame-rate) | ||
|- | |- | ||
Line 57: | Line 61: | ||
|1 | |1 | ||
|'''Differential State Enum''' | |'''Differential State Enum''' | ||
|{{check}} | |||
|{{check}} | |||
|'''[2/2 in CCharAnimTime]''' State of ''Key Interval'' time point for proper integration control | |'''[2/2 in CCharAnimTime]''' State of ''Key Interval'' time point for proper integration control | ||
|- | |- | ||
Line 63: | Line 69: | ||
|1 | |1 | ||
|'''Key Count''' | |'''Key Count''' | ||
|{{check}} | |||
|{{check}} | |||
|Count of keys for each bone channel (keys are set for every frame of the animation) | |Count of keys for each bone channel (keys are set for every frame of the animation) | ||
|- | |- | ||
Line 69: | Line 77: | ||
|1 | |1 | ||
|'''Root Bone ID''' | |'''Root Bone ID''' | ||
|{{check}} | |||
|{{check}} | |||
|ID of the root bone in this ANIM | |ID of the root bone in this ANIM | ||
|- | |- | ||
|0x1C | |0x1C | ||
|u32 | |||
|1 | |||
|'''Bone Channel Count''' | |||
|{{check}} | |||
|{{check}} | |||
|Count of bone channel indices in the next array. Always 100. | |||
|- | |||
|0x20 | |||
|u8 | |||
|''Bone Channel Count'' | |||
|'''Bone Channel Index Array''' | |||
|{{check}} | |||
|{{check}} | |||
|This table maps each bone to a bone channel, with the index-position corresponding to a ''Bone ID'' in the associated [[CINF (File Format)|CINF]], while the value corresponds to a bone channel index. The value is 0xFF if the bone is not animated by this ANIM. | |||
|- | |||
|{{unknown|}} | |||
|u32 | |u32 | ||
|1 | |1 | ||
|'''Rotation Channel Index Count''' | |'''Rotation Channel Index Count''' | ||
|Count of rotation channel indices in the next array. | |{{nocheck}} | ||
|{{check}} | |||
|Count of rotation channel indices in the next array. Matches the number of valid bone channels. | |||
|- | |- | ||
| | |{{unknown|}} | ||
|u8 | |u8 | ||
|''Rotation Channel Index Count'' | |''Rotation Channel Index Count'' | ||
|'''Rotation Channel Index Array''' | |'''Rotation Channel Index Array''' | ||
|This table maps each bone to a rotation channel, with the index-position corresponding to | |{{nocheck}} | ||
|{{check}} | |||
|This table maps each bone channel to a rotation channel, with the index-position corresponding to an entry in the ''Bone Channel Index Array'' above (disregarding 0xFF entries), while the value corresponds to the index of a rotation channel. The value is 0xFF if the bone is not rotated by this ANIM. '''Note:''' In ''Metroid Prime'', every bone channel always has rotations, so this array is omitted. | |||
|- | |- | ||
|{{unknown|}} | |{{unknown|}} | ||
Line 87: | Line 117: | ||
|1 | |1 | ||
|'''Translation Channel Index Count''' | |'''Translation Channel Index Count''' | ||
|Count of translation channel indices in the next array. Matches the number of valid | |{{check}} | ||
|{{check}} | |||
|Count of translation channel indices in the next array. Matches the number of valid bone channels. | |||
|- | |- | ||
|{{unknown|}} | |{{unknown|}} | ||
Line 93: | Line 125: | ||
|''Translation Channel Index Count'' | |''Translation Channel Index Count'' | ||
|'''Translation Channel Index Array''' | |'''Translation Channel Index Array''' | ||
|This table maps each | |{{check}} | ||
|{{check}} | |||
|This table maps each bonechannel to a translation channel, with the index-position corresponding to an entry in the ''Bone Channel Index Array'' above (disregarding 0xFF entries), while the value corresponds to the index of a translation channel. The value is 0xFF if the bone is not translated by this ANIM. | |||
|- | |- | ||
|{{unknown|}} | |{{unknown|}} | ||
|u32 | |u32 | ||
|1 | |1 | ||
|''' | |'''Scale Channel Index Count''' | ||
|Count of | |{{nocheck}} | ||
|{{check}} | |||
|Count of scale channel indices in the next array. Matches the number of valid bone channels. | |||
|- | |||
|{{unknown|}} | |||
|u8 | |||
|''Scale Channel Index Count'' | |||
|'''Scale Channel Index Array''' | |||
|{{nocheck}} | |||
|{{check}} | |||
|This table maps each bone channel to a scale channel, with the index-position corresponding to an entry in the ''Bone Channel Index Array'' above (disregarding 0xFF entries), while the value corresponds to the index of a scale channel. The value is 0xFF if the bone is not scaled by this ANIM. | |||
|- | |- | ||
|{{unknown|}} | |{{unknown|}} | ||
| | |u32 | ||
|'' | |1 | ||
|''' | |'''Scale Key Count''' | ||
|The | |{{nocheck}} | ||
|{{check}} | |||
|Count of elements in ''Scale Key Array'' below | |||
|- | |||
|{{unknown|}} | |||
|float3 | |||
|''Scale Key Count'' | |||
|'''Scale Key Array''' | |||
|{{nocheck}} | |||
|{{check}} | |||
|The scale keys are interleaved as such (bone-major): | |||
<pre> | <pre> | ||
|------------|------------|-----|------------| | |------------|------------|-----|------------| | ||
Line 114: | Line 168: | ||
|------------|------------|-----|------------| | |------------|------------|-----|------------| | ||
</pre> | </pre> | ||
|- | |||
|{{unknown|}} | |||
|u32 | |||
|1 | |||
|'''Rotation Key Count''' | |||
|{{check}} | |||
|{{check}} | |||
|Count of elements in ''Rotation Key Array'' below | |||
|- | |||
|{{unknown|}} | |||
|float4 | |||
|''Rotation Key Count'' | |||
|'''Rotation Key Array''' | |||
|{{check}} | |||
|{{check}} | |||
|The rotation keys are interleaved the same way as the scale keys. In ''Metroid Prime 2'', any bone channels that were marked 0xFF in the ''Rotation Channel Index Array'' are skipped. | |||
|- | |- | ||
|{{unknown|}} | |{{unknown|}} | ||
Line 119: | Line 189: | ||
|1 | |1 | ||
|'''Translation Key Count''' | |'''Translation Key Count''' | ||
|{{check}} | |||
|{{check}} | |||
|Count of elements in ''Translation Key Array'' below | |Count of elements in ''Translation Key Array'' below | ||
|- | |- | ||
Line 125: | Line 197: | ||
|''Translation Key Count'' | |''Translation Key Count'' | ||
|'''Translation Key Array''' | |'''Translation Key Array''' | ||
|The translation keys are interleaved the same way as the | |{{check}} | ||
|{{check}} | |||
|The translation keys are interleaved the same way as the scale keys. Any bone channels that were marked 0xFF in the ''Translation Channel Index Array'' are skipped. | |||
|- | |- | ||
|{{unknown|}} | |{{unknown|}} | ||
Line 131: | Line 205: | ||
|1 | |1 | ||
|'''EVNT Ref''' | |'''EVNT Ref''' | ||
|{{check}} | |||
|{{nocheck}} | |||
|ID for this ANIM's [[EVNT (File Format)|EVNT]] resource, or 0xFFFFFFFF if no events triggered | |ID for this ANIM's [[EVNT (File Format)|EVNT]] resource, or 0xFFFFFFFF if no events triggered | ||
|} | |} |