ANIM (Metroid Prime): Difference between revisions

>Aruki
(merging wiki pages for MP1/2 ANIM. Did format 0, will do format 2 later)
>Aruki
 
(7 intermediate revisions by 3 users not shown)
Line 29: Line 29:
!style="width: 215px;"|Element Count
!style="width: 215px;"|Element Count
!style="width: 240px;"|Name
!style="width: 240px;"|Name
!Notes
!MP1
!MP1
!MP2
!MP2
!Notes
|-
|-
|0x4
|0x4
|float
|[[Char Anim Time]]
|1
|1
|'''Duration'''
|'''Duration'''
|Time in seconds that the animation plays for
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|'''[1/2 in CCharAnimTime]''' Time in seconds that the animation plays for
|-
|0x8
|u32
|1
|'''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>
|-
|-
|0xC
|0xC
|float
|[[Char Anim Time]]
|1
|1
|'''Key Interval'''
|'''Key Interval'''
|Time in seconds between keys of each bone channel (reciprocal of frame-rate)
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|'''[1/2 in CCharAnimTime]''' Time in seconds between keys of each bone channel (reciprocal of frame-rate)
|-
|0x10
|u32
|1
|'''Differential State Enum'''
|{{check}}
|{{check}}
|'''[2/2 in CCharAnimTime]''' State of ''Key Interval'' time point for proper integration control
|-
|-
|0x14
|0x14
Line 69: Line 53:
|1
|1
|'''Key Count'''
|'''Key Count'''
|Count of keys for each bone channel (keys are set for every frame of the animation)
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|Count of keys for each bone channel (keys are set for every frame of the animation)
|-
|-
|0x18
|0x18
Line 77: Line 61:
|1
|1
|'''Root Bone ID'''
|'''Root Bone ID'''
|ID of the root bone in this ANIM
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|ID of the root bone in this ANIM
|-
|-
|0x1C
|0x1C
Line 85: Line 69:
|1
|1
|'''Bone Channel Count'''
|'''Bone Channel Count'''
|Count of bone channel indices in the next array. Always 100.
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|Count of bone channel indices in the next array. Always 100.
|-
|-
|0x20
|0x20
Line 93: Line 77:
|''Bone Channel Count''
|''Bone Channel Count''
|'''Bone Channel Index Array'''
|'''Bone Channel Index Array'''
|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.
|{{check}}
|{{check}}
|{{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|}}
|{{unknown|}}
Line 101: Line 85:
|1
|1
|'''Rotation Channel Index Count'''
|'''Rotation Channel Index Count'''
|Count of rotation channel indices in the next array. Matches the number of valid bone channels.
|{{nocheck}}
|{{nocheck}}
|{{check}}
|{{check}}
|Count of rotation channel indices in the next array. Matches the number of valid bone channels.
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 109: Line 93:
|''Rotation Channel Index Count''
|''Rotation Channel Index Count''
|'''Rotation Channel Index Array'''
|'''Rotation Channel Index Array'''
|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.
|{{nocheck}}
|{{nocheck}}
|{{check}}
|{{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 117: Line 101:
|1
|1
|'''Translation Channel Index Count'''
|'''Translation Channel Index Count'''
|Count of translation channel indices in the next array. Matches the number of valid bone channels.
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|Count of translation channel indices in the next array. Matches the number of valid bone channels.
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 125: Line 109:
|''Translation Channel Index Count''
|''Translation Channel Index Count''
|'''Translation Channel Index Array'''
|'''Translation Channel Index Array'''
|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.
|{{check}}
|{{check}}
|{{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|}}
Line 133: Line 117:
|1
|1
|'''Scale Channel Index Count'''
|'''Scale Channel Index Count'''
|Count of scale channel indices in the next array. Matches the number of valid bone channels.
|{{nocheck}}
|{{nocheck}}
|{{check}}
|{{check}}
|Count of scale channel indices in the next array. Matches the number of valid bone channels.
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 141: Line 125:
|''Scale Channel Index Count''
|''Scale Channel Index Count''
|'''Scale Channel Index Array'''
|'''Scale Channel Index Array'''
|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.
|{{nocheck}}
|{{nocheck}}
|{{check}}
|{{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|}}
Line 149: Line 133:
|1
|1
|'''Scale Key Count'''
|'''Scale Key Count'''
|Count of elements in ''Scale Key Array'' below
|{{nocheck}}
|{{nocheck}}
|{{check}}
|{{check}}
|Count of elements in ''Scale Key Array'' below
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 157: Line 141:
|''Scale Key Count''
|''Scale Key Count''
|'''Scale Key Array'''
|'''Scale Key Array'''
|{{nocheck}}
|{{check}}
|The scale keys are interleaved as such (bone-major):
|The scale keys are interleaved as such (bone-major):
<pre>
<pre>
Line 168: Line 150:
|------------|------------|-----|------------|
|------------|------------|-----|------------|
</pre>
</pre>
|{{nocheck}}
|{{check}}
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 173: Line 157:
|1
|1
|'''Rotation Key Count'''
|'''Rotation Key Count'''
|Count of elements in ''Rotation Key Array'' below
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|Count of elements in ''Rotation Key Array'' below
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 181: Line 165:
|''Rotation Key Count''
|''Rotation Key Count''
|'''Rotation Key Array'''
|'''Rotation Key Array'''
|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.
|{{check}}
|{{check}}
|{{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 189: Line 173:
|1
|1
|'''Translation Key Count'''
|'''Translation Key Count'''
|Count of elements in ''Translation Key Array'' below
|{{check}}
|{{check}}
|{{check}}
|{{check}}
|Count of elements in ''Translation Key Array'' below
|-
|-
|{{unknown|}}
|{{unknown|}}
Line 197: Line 181:
|''Translation Key Count''
|''Translation Key Count''
|'''Translation Key Array'''
|'''Translation Key Array'''
|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.
|{{check}}
|{{check}}
|{{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 205: Line 189:
|1
|1
|'''EVNT Ref'''
|'''EVNT Ref'''
|ID for this ANIM's [[EVNT (File Format)|EVNT]] resource, or 0xFFFFFFFF if no events triggered
|{{check}}
|{{check}}
|{{nocheck}}
|{{nocheck}}
|ID for this ANIM's [[EVNT (File Format)|EVNT]] resource, or 0xFFFFFFFF if no events triggered
|}
|}


== Rotation Vector Bitstream Format (Compressed) ==
== Rotation Vector Bitstream Format (Compressed) ==


The '''Rotation Vector Bitstream Format''' (0x2) is the most widely used animation format in ''Metroid Prime''.
The '''Rotation Vector Bitstream Format''' (0x2) is the most widely used animation format.
The format uses a compressed [[wikipedia:Bitstream|bitstream]] to store keys that have been
The format uses a compressed [[wikipedia:Bitstream|bitstream]] to store keys that have been
[[wikipedia:Delta encoding|delta encoded]] and [[wikipedia:Quantization (signal processing)|quantized]]
[[wikipedia:Delta encoding|delta encoded]] and [[wikipedia:Quantization (signal processing)|quantized]]
Line 222: Line 206:


=== Key Values ===
=== Key Values ===
When decoding the animation, each bone's rotation (and possibly translation) values are initialized to the ''Initial *''
When decoding the animation, each bone's attribute values are initialized to the ''Initial *''
values in the ''bone channel descriptors''. For every frame of every bone channel, the key value in the bitstream is ''added''
values in the ''bone channel descriptors''. For every frame of every bone channel, the key value in the bitstream is ''added''
with the previous key value (to resolve the delta encoding).  
with the previous key value (to resolve the delta encoding).  
Line 240: Line 224:
</pre>
</pre>


Translation components are multiplied by ''Translation Multiplier'', yielding world units.
Translation components are multiplied by ''Translation Multiplier'', and scale components are multiplied by ''Scale Multiplier''.


=== Layout ===
=== Layout ===


{| class="wikitable"
{| class="wikitable"
!Offset
!Type
!Type
!style="width: 220px;"|Element Count
!style="width: 220px;"|Element Count
!style="width: 240px;"|Name
!style="width: 240px;"|Name
!Notes
!Notes
!MP1
!MP2
|-
|-
|0x4
|u32
|u32
|1
|1
|'''Scratch Size'''
|'''Scratch Size'''
|Amount of memory that the animation system needs to allocate to process animation
|Amount of memory that the animation system needs to allocate to process animation
|{{check}}
|{{check}}
|-
|-
|0x8
|[[EVNT (File Format)|EVNT]]
|[[EVNT (File Format)|EVNT]]
|1
|1
|'''EVNT Ref'''
|'''EVNT Ref'''
|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
|{{check}}
|{{nocheck}}
|-
|-
|0xC
|u32
|u32
|1
|1
|{{unknown|Unknown 1}}
|{{unknown|Unknown 1}}
|Always 0x1
|Always 0x1
|{{check}}
|{{nocheck}}
|-
|u16
|1
|{{unknown|Unknown 2}}
|
|{{nocheck}}
|{{check}}
|-
|-
|0x10
|float
|float
|1
|1
|'''Duration'''
|'''Duration'''
|Time in seconds that the animation plays for
|Time in seconds that the animation plays for
|{{check}}
|{{check}}
|-
|-
|0x14
|float
|float
|1
|1
|'''Interval'''
|'''Interval'''
|Time in seconds between frames (reciprocal of frame-rate, typically 30-fps)
|Time in seconds between frames (reciprocal of frame-rate, typically 30-fps)
|{{check}}
|{{check}}
|-
|-
|0x18
|u32
|u32
|1
|1
|'''Root Bone ID'''
|'''Root Bone ID'''
|ID of the root bone in this ANIM
|ID of the root bone in this ANIM
|{{check}}
|{{check}}
|-
|-
|0x1C
|u32
|u32
|1
|1
|{{unknown|Unknown 3}}
|'''Looping Flag'''
|Always 0x0
|When non-zero, engine identifies this ANIM as looping
|{{check}}
|{{check}}
|-
|-
|0x20
|u32
|u32
|1
|1
|'''Rotation Divisor'''
|'''Rotation Divisor'''
|Rotation vectors are divided by this value before being applied
|Rotation vectors are divided by this value before being applied
|{{check}}
|{{check}}
|-
|-
|0x20
|float
|float
|1
|1
|'''Translation Multiplier'''
|'''Translation Multiplier'''
|Translation vectors are multiplied by this value before being applied
|Translation vectors are multiplied by this value before being applied
|{{check}}
|{{check}}
|-
|float
|1
|'''Scale Multiplier'''
|Scale vectors are multiplied by this value before being applied
|{{nocheck}}
|{{check}}
|-
|-
|0x24
|u32
|u32
|1
|1
|'''Bone Channel Count'''
|'''Bone Channel Count'''
|Count of bone channels present in ANIM
|Count of bone channels present in ANIM
|{{check}}
|{{check}}
|-
|-
|0x28
|4
|u32
|u32
|1
|{{unknown|Unknown 4}}
|{{unknown|Unknown 4}}
|Always 0x1
|Always 0x1
|{{check}}
|{{check}}
|-
|-
|0x2C
|u32
|u32
|1
|1
|'''Key Bitmap Length'''
|'''Key Bitmap Length'''
|Number of bits in ''Key Bitmap''
|Number of bits in ''Key Bitmap''
|{{check}}
|{{check}}
|-
|-
|0x30
|u32
|u32
|round_up(''Key Bitmap Length'' / 32)
|round_up(''Key Bitmap Length'' / 32)
|'''Key Bitmap'''
|'''Key Bitmap'''
|Word-packed bitmap. Each word is read from least-significant to most-significant bit. A set bit indicates the frame at the bit's position has keys for each bone channel. If the bit is unset, the keys must be generated via interpolation.
|Word-packed bitmap. Each word is read from least-significant to most-significant bit. A set bit indicates the frame at the bit's position has keys for each bone channel. If the bit is unset, the keys must be generated via interpolation.
|{{check}}
|{{check}}
|-
|-
|{{unknown|}}
|u32
|u32
|1
|1
|'''Bone Channel Count'''
|'''Bone Channel Count'''
|Count of animated bone channels (matches the previous bone channel count)
|Count of animated bone channels (matches the previous bone channel count)
|{{check}}
|{{nocheck}}
|-
|-
|{{unknown|}}
|u32
|u32
|1
|1
|'''Bone Channel Descriptor Count'''
|'''Bone Channel Descriptor Count'''
|Count of bone channel descriptors in ''Bone Channel Descriptor Table''. Matches the ''Bone Channel Counts''.
|Count of bone channel descriptors in ''Bone Channel Descriptor Table''. Matches the ''Bone Channel Counts''.
|{{check}}
|{{check}}
|-
|-
|{{unknown|}}
|[[#Bone Channel Descriptor|Bone Channel Descriptor]]
|[[#Bone Channel Descriptor|Bone Channel Descriptor]]
|''Bone Channel Descriptor Count''
|''Bone Channel Descriptor Count''
|'''Bone Channel Descriptor Table'''
|'''Bone Channel Descriptor Table'''
|Table describing animated bone channels
|Table describing animated bone channels
|{{check}}
|{{check}}
|-
|-
|{{unknown|}}
|u32
|u32
|<remainder of file>
|<remainder of file>
|'''Key Bitstream'''
|'''Key Bitstream'''
|Word-packed bitstream laid out as described by the descriptor table. The bitstream is unpacked just like ''Key Bitmap'' (least-significant to most-significant).  
|Word-packed bitstream laid out as described by the descriptor table. The bitstream is unpacked just like ''Key Bitmap'' (least-significant to most-significant).  
Key values are tightly-packed, quantized integers whose bit-depth is specified by the ''q_*'' values in the descriptor table.  
Key values are tightly-packed, quantized integers whose bit-depth is specified by the ''* Bits'' values in the descriptor table.  
Each bone-channel key-set starts with a single bit providing the ''W sign-bit'' (1 for negative, 0 for positive).
Each bone-channel key-set starts with a single bit providing the ''W sign-bit'' (1 for negative, 0 for positive).


Line 366: Line 380:
|------------|------------|-----|------------|
|------------|------------|-----|------------|
</pre>
</pre>
|{{check}}
|{{check}}
|}
|}


Line 375: Line 391:
!Name
!Name
!Notes
!Notes
!MP1
!MP2
|-
|-
|0x0
|0x0
Line 380: Line 398:
|'''Bone ID'''
|'''Bone ID'''
|''Bone ID'' in the associated [[CINF (File Format)|CINF]] for this bone channel
|''Bone ID'' in the associated [[CINF (File Format)|CINF]] for this bone channel
|{{check}}
|{{check}}
|-
|-
|0x4
|0x4
Line 385: Line 405:
|'''Rotation Key Count'''
|'''Rotation Key Count'''
|Number of rotation keys in the bitstream for this bone channel.
|Number of rotation keys in the bitstream for this bone channel.
'''If this value is 0, the remaining Rotation fields aren't present'''
'''In MP2, if this value is 0, the remaining Rotation fields aren't present'''
|{{check}}
|{{check}}
|-
|-
|0x6
|0x6
Line 391: Line 413:
|'''Initial Rotation X'''
|'''Initial Rotation X'''
|Initial X value of bone's rotation vector
|Initial X value of bone's rotation vector
|{{check}}
|{{check}}
|-
|-
|0x8
|0x8
Line 396: Line 420:
|'''Rotation Bits X'''
|'''Rotation Bits X'''
|Number of bits allocated to bone's rotation delta X in bitstream
|Number of bits allocated to bone's rotation delta X in bitstream
|{{check}}
|{{check}}
|-
|-
|0x9
|0x9
Line 401: Line 427:
|'''Initial Rotation Y'''
|'''Initial Rotation Y'''
|Initial Y value of bone's rotation vector
|Initial Y value of bone's rotation vector
|{{check}}
|{{check}}
|-
|-
|0xB
|0xB
Line 406: Line 434:
|'''Rotation Bits Y'''
|'''Rotation Bits Y'''
|Number of bits allocated to bone's rotation delta Y in bitstream
|Number of bits allocated to bone's rotation delta Y in bitstream
|{{check}}
|{{check}}
|-
|-
|0xC
|0xC
Line 411: Line 441:
|'''Initial Rotation Z'''
|'''Initial Rotation Z'''
|Initial Z value of bone's rotation vector
|Initial Z value of bone's rotation vector
|{{check}}
|{{check}}
|-
|-
|0xE
|0xE
Line 416: Line 448:
|'''Rotation Bits Z'''
|'''Rotation Bits Z'''
|Number of bits allocated to bone's rotation delta Z in bitstream
|Number of bits allocated to bone's rotation delta Z in bitstream
|{{check}}
|{{check}}
|-
|-
|0xF
|0xF
Line 422: Line 456:
|If this bone channel has an animated translation, its value will match ''Rotation Key Count''; otherwise the value will be 0.  
|If this bone channel has an animated translation, its value will match ''Rotation Key Count''; otherwise the value will be 0.  
'''If the value is 0, the remaining Translation fields aren't present'''
'''If the value is 0, the remaining Translation fields aren't present'''
|{{check}}
|{{check}}
|-
|-
|0x11
|0x11
Line 427: Line 463:
|'''Initial Translation X'''
|'''Initial Translation X'''
|Initial X value of bone's translation vector
|Initial X value of bone's translation vector
|{{check}}
|{{check}}
|-
|-
|0x13
|0x13
Line 432: Line 470:
|'''Translation Bits X'''
|'''Translation Bits X'''
|Number of bits allocated to bone's translation delta X in bitstream
|Number of bits allocated to bone's translation delta X in bitstream
|{{check}}
|{{check}}
|-
|-
|0x14
|0x14
Line 437: Line 477:
|'''Initial Translation Y'''
|'''Initial Translation Y'''
|Initial Y value of bone's translation vector
|Initial Y value of bone's translation vector
|{{check}}
|{{check}}
|-
|-
|0x16
|0x16
Line 442: Line 484:
|'''Translation Bits Y'''
|'''Translation Bits Y'''
|Number of bits allocated to bone's translation delta Y in bitstream
|Number of bits allocated to bone's translation delta Y in bitstream
|{{check}}
|{{check}}
|-
|-
|0x17
|0x17
|s16
|s16
|'''Translation Delta Z'''
|'''Initial Translation Z'''
|Initial Z value of bone's translation vector
|Initial Z value of bone's translation vector
|{{check}}
|{{check}}
|-
|-
|0x19
|0x19
Line 452: Line 498:
|'''Translation Bits Z'''
|'''Translation Bits Z'''
|Number of bits allocated to bone's translation delta Z in bitstream
|Number of bits allocated to bone's translation delta Z in bitstream
|{{check}}
|{{check}}
|-
|0x1A
|u16
|'''Scale Key Count'''
|If this bone channel has an animated scale, its value will match ''Scale Key Count''; otherwise the value will be 0.
'''If the value is 0, the remaining Scale fields aren't present'''
|{{nocheck}}
|{{check}}
|-
|0x1C
|s16
|'''Initial Scale X'''
|Initial X value of bone's scale vector
|{{nocheck}}
|{{check}}
|-
|0x1E
|u8
|'''Scale Bits X'''
|Number of bits allocated to bone's scale delta X in bitstream
|{{nocheck}}
|{{check}}
|-
|0x1F
|s16
|'''Initial Scale Y'''
|Initial Y value of bone's scale vector
|{{nocheck}}
|{{check}}
|-
|0x21
|u8
|'''Scale Bits Y'''
|Number of bits allocated to bone's scale delta Y in bitstream
|{{nocheck}}
|{{check}}
|-
|0x22
|s16
|'''Initial Scale Z'''
|Initial Z value of bone's scale vector
|{{nocheck}}
|{{check}}
|-
|0x24
|u8
|'''Scale Bits Z'''
|Number of bits allocated to bone's scale delta Z in bitstream
|{{nocheck}}
|{{check}}
|-
|-
| 0x1A
|0x25
|colspan=3 {{unknown|End of descriptor}}
|colspan=5 {{unknown|End of descriptor}}
|}
|}


[[Category:File Formats]]
[[Category:File Formats]]
[[Category:Metroid Prime]]
[[Category:Metroid Prime]]
[[Category:Metroid Prime 2: Echoes]]
Anonymous user