ANIM (File Format): Difference between revisions
Jump to navigation
Jump to search
no edit summary
imported>Jackoalan No edit summary |
imported>Jackoalan No edit summary |
||
Line 1: | Line 1: | ||
{{research|1|Having trouble with bone rotations +/- 180 degrees in format 2}} | {{research|1|Having trouble with bone rotations +/- 180 degrees in format 2}} | ||
The '''ANIM format''' is used in conjunction with | The '''ANIM format''' is used in conjunction with [[CINF (File Format)|CINF]] and [[CSKR (File Format)|CSKR]] | ||
to animate | rigging to animate [[CMDL (File Format)|CMDL meshes]]. | ||
There are two versions of the ANIM format in ''Metroid Prime'' (indicated by the file's first long value): | There are two versions of the ANIM format in ''Metroid Prime'' (indicated by the file's first long value): | ||
Line 39: | Line 39: | ||
|header‑>bone_entry_count | |header‑>bone_entry_count | ||
|bone_entry_map | |bone_entry_map | ||
|The index-positions of this table correspond to the '' | |The index-positions of this table correspond to the ''Bone IDs'' in the associated [[CINF (File Format)|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 | |long | ||
Line 130: | Line 130: | ||
== Rotation Vector Bitstream Format == | == Rotation Vector Bitstream Format == | ||
The '''Rotation Vector Bitstream Format''' is the most widely used animation format in ''Metroid Prime''. | The '''Rotation Vector Bitstream Format''' (0x2) is the most widely used animation format in ''Metroid Prime''. | ||
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]] | ||
to make for a very compact, compressed animation. The data is processed sequentially to reconstruct the | to make for a very compact, compressed animation. The data is processed sequentially to reconstruct the | ||
uncompressed bone channel data. | |||
In addition to the bitstream quantization, the format includes a bitmap specifying which frames of the animation have | In addition to the bitstream quantization, the format includes a bitmap specifying which frames of the animation have | ||
keys added. Consequently, the runtime | keys added. Consequently, the runtime generates missing keys via interpolation (reducing animation size further). | ||
{| class="wikitable" | |||
!Data Type | |||
!Element Count | |||
!Identifier | |||
!Notes | |||
|- | |||
|[[#Header2|Header2]] | |||
|1 | |||
|header | |||
| | |||
|- | |||
|long | |||
|round_up(header‑>key_bitmap_length / 32) | |||
|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. | |||
|- | |||
|long | |||
|1 | |||
|bone_channel_count | |||
|Count of animated bone channels (matches header‑>bone_channel_count) | |||
|- | |||
|long | |||
|1 | |||
|bone_channel_count | |||
|Duplicate channel count for some reason | |||
|- | |||
|[[#Bone Channel Descriptor|Bone Channel Descriptor]] | |||
|header‑>bone_channel_count | |||
|bone_channel_descriptor_array | |||
|Array describing animated bone channels | |||
|} | |||
=== Header2 === | === Header2 === | ||
Line 218: | Line 250: | ||
|long | |long | ||
|key_bitmap_length | |key_bitmap_length | ||
|Number of bits in '' | |Number of bits in ''key_bitmap'' | ||
|} | |} | ||
=== Bone Channel Descriptor === | |||
{| class="wikitable" | |||
!Offset | |||
!Length | |||
!Data Type | |||
!Identifier | |||
!Notes | |||
|- | |||
|0x0 | |||
|4 | |||
|long | |||
|bone_id | |||
|''Bone ID'' in the associated [[CINF (File Format)|CINF]] for this bone channel | |||
|- | |||
|0x4 | |||
|2 | |||
|short | |||
|key_count | |||
|Number of keys in the bitstream for this bone channel (same value for all channels in animation) | |||
|- | |||
|0x6 | |||
|2 | |||
|short | |||
|initial_rx | |||
|Initial X value of bone's rotation vector | |||
|- | |||
|0x8 | |||
|1 | |||
|char | |||
|q_rx | |||
|Number of bits allocated to bone's ''rx'' in bitstream | |||
|- | |||
|0x9 | |||
|2 | |||
|short | |||
|initial_ry | |||
|Initial Y value of bone's rotation vector | |||
|- | |||
|0xB | |||
|1 | |||
|char | |||
|q_ry | |||
|Number of bits allocated to bone's ''ry'' in bitstream | |||
|- | |||
|0xC | |||
|2 | |||
|short | |||
|initial_rz | |||
|Initial Z value of bone's rotation vector | |||
|- | |||
|0xE | |||
|1 | |||
|char | |||
|q_rz | |||
|Number of bits allocated to bone's ''rz'' in bitstream | |||
|- | |||
|0xF | |||
|2 | |||
|short | |||
|translation_key_count | |||
|If this bone channel has an animated translation, its value will match ''key_count'', otherwise the value will be 0. | |||
'''If the value is 0, this descriptor ends here''' | |||
|- | |||
|0x11 | |||
|2 | |||
|short | |||
|initial_tx | |||
|Initial X value of bone's translation vector | |||
|- | |||
|0x13 | |||
|1 | |||
|char | |||
|q_tx | |||
|Number of bits allocated to bone's ''tx'' in bitstream | |||
|- | |||
|0x14 | |||
|2 | |||
|short | |||
|initial_ty | |||
|Initial Y value of bone's translation vector | |||
|- | |||
|0x16 | |||
|1 | |||
|char | |||
|q_ty | |||
|Number of bits allocated to bone's ''ty'' in bitstream | |||
|- | |||
|0x17 | |||
|2 | |||
|short | |||
|initial_tz | |||
|Initial Z value of bone's translation vector | |||
|- | |||
|0x19 | |||
|1 | |||
|char | |||
|q_tz | |||
|Number of bits allocated to bone's ''tz'' in bitstream | |||
|} | |||
[[Category:File Formats]] | [[Category:File Formats]] |