ANIM (Metroid Prime): Difference between revisions
Jump to navigation
Jump to search
→Rotation Vector Bitstream Format (Compressed)
>Aruki |
>Aruki |
||
Line 212: | Line 212: | ||
== Rotation Vector Bitstream Format (Compressed) == | == Rotation Vector Bitstream Format (Compressed) == | ||
The '''Rotation Vector Bitstream Format''' (0x2) is the most widely used animation format | 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 222: | ||
=== Key Values === | === Key Values === | ||
When decoding the animation, each bone's | 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 240: | ||
</pre> | </pre> | ||
Translation components are multiplied by ''Translation Multiplier'', | Translation components are multiplied by ''Translation Multiplier'', and scale components are multiplied by ''Scale Multiplier''. | ||
=== Layout === | === Layout === | ||
{| class="wikitable" | {| class="wikitable" | ||
!Type | !Type | ||
!style="width: 220px;"|Element Count | !style="width: 220px;"|Element Count | ||
!style="width: 240px;"|Name | !style="width: 240px;"|Name | ||
!Notes | !Notes | ||
!MP1 | |||
!MP2 | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|[[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}} | |||
|- | |- | ||
|u32 | |u32 | ||
|1 | |1 | ||
|{{unknown|Unknown 1}} | |{{unknown|Unknown 1}} | ||
|Always 0x1 | |Always 0x1 | ||
|{{check}} | |||
|{{nocheck}} | |||
|- | |||
|u16 | |||
|1 | |||
|{{unknown|Unknown 2}} | |||
| | |||
|{{nocheck}} | |||
|{{check}} | |||
|- | |- | ||
|float | |float | ||
|1 | |1 | ||
|'''Duration''' | |'''Duration''' | ||
|Time in seconds that the animation plays for | |Time in seconds that the animation plays for | ||
|{{check}} | |||
|{{check}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|u32 | |u32 | ||
|1 | |1 | ||
|{{unknown|Unknown 3}} | |{{unknown|Unknown 3}} | ||
|Always 0x0 | |Always 0x0 | ||
|{{check}} | |||
|{{check}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|4 | |4 | ||
|u32 | |u32 | ||
|{{unknown|Unknown 4}} | |{{unknown|Unknown 4}} | ||
|Always 0x1 | |Always 0x1 | ||
|{{check}} | |||
|{{check}} | |||
|- | |- | ||
|u32 | |u32 | ||
|1 | |1 | ||
|'''Key Bitmap Length''' | |'''Key Bitmap Length''' | ||
|Number of bits in ''Key Bitmap'' | |Number of bits in ''Key Bitmap'' | ||
|{{check}} | |||
|{{check}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|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}} | |||
|- | |- | ||
|[[#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}} | |||
|- | |- | ||
|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 '' | 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 396: | ||
|------------|------------|-----|------------| | |------------|------------|-----|------------| | ||
</pre> | </pre> | ||
|{{check}} | |||
|{{check}} | |||
|} | |} | ||
Line 541: | Line 573: | ||
[[Category:File Formats]] | [[Category:File Formats]] | ||
[[Category:Metroid Prime]] | [[Category:Metroid Prime]] | ||
[[Category:Metroid Prime 2: Echoes]] |