|
|
(30 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | {{research|1|Having trouble with bone rotations +/- 180 degrees}}
| + | The '''ANIM''' format is used to represent discrete [[wikipedia:Key frame|animation keys]] |
− | The '''ANIM format''' is used in conjunction with the [[CINF (File Format)|CINF]] and [[CSKR (File Format)|CSKR]] | + | bound to a skeletal rig. |
− | to animate rigged [[CMDL (File Format)|CMDL meshes]]. | + | |
| | | |
− | There are two versions of the ANIM format in ''Metroid Prime'':
| + | Keyed attributes include: |
| | | |
− | {| class="wikitable"
| + | * [[wikipedia:Quaternion|Quaternion]] Rotations (WXYZ) |
− | !Version
| + | * Translations (XYZ) |
− | !Description
| + | * Scale (XYZ, since MP2) |
− | |-
| + | |
− | |0x0
| + | |
− | |[[#Quaternion Format|Quaternion array format]]
| + | |
− | |-
| + | |
− | |0x2
| + | |
− | |[[#Bitstream Format|Rotation vector bitstream format]]
| + | |
− | |}
| + | |
| | | |
− | == Quaternion Array Format ==
| + | ANIMs are used in a variety of ways by Retro's engine. A single ANIM resource is known as |
| + | a ''primitive'' which may be blended and/or sequenced with other primitives to assemble |
| + | complex character animations (defined by [[ANCS (File Format)|ANCS]] and [[CHAR (File Format)|CHAR]]). |
| | | |
− | The '''Quaternion Array Format''' (0x0) is a less common animation format in ''Metroid Prime''.
| + | Each game has deviations in the format, but the principle of operation remains the same for all of them: |
− | 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 [[wikipedia:Quaternion|quaternion]] (WXYZ) keys.
| + | * [[ANIM (Metroid Prime)]] (used in Metroid Prime 1 and 2) |
− | Optionally, translations may be specified for a subset of bones as an array of float3 keys.
| + | * [[ANIM (Metroid Prime 3)]] |
− | | + | * [[ANIM (Donkey Kong Country Returns)]] |
− | {| class="wikitable"
| + | * [[ANIM (Tropical Freeze)]] |
− | !Data Type
| + | |
− | !Element Count
| + | |
− | !Description
| + | |
− | !Notes
| + | |
− | |-
| + | |
− | |[[#Header0|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):
| + | |
− | <pre>
| + | |
− | |------------|------------|-----|------------|
| + | |
− | | bone0/key0 | bone0/key1 | ... | bone0/keyN |
| + | |
− | | bone1/key0 | bone1/key1 | ... | bone1/keyN |
| + | |
− | | .......... | .......... | ... | .......... |
| + | |
− | | boneN/key0 | boneN/key1 | ... | boneN/keyN |
| + | |
− | |------------|------------|-----|------------|
| + | |
− | </pre>
| + | |
− | |-
| + | |
− | |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):
| + | |
− | <pre>
| + | |
− | |------------|------------|-----|------------|
| + | |
− | | bone0/key0 | bone0/key1 | ... | bone0/keyN |
| + | |
− | | bone1/key0 | bone1/key1 | ... | bone1/keyN |
| + | |
− | | .......... | .......... | ... | .......... |
| + | |
− | | boneN/key0 | boneN/key1 | ... | boneN/keyN |
| + | |
− | |------------|------------|-----|------------|
| + | |
− | </pre>
| + | |
− | |-
| + | |
− | |long
| + | |
− | |1
| + | |
− | |evnt_ref
| + | |
− | |ID for this ANIM's [[EVNT (File Format)|EVNT]] resource, or 0xffffffff if no events triggered
| + | |
− | |}
| + | |
− | | + | |
− | === Header0 ===
| + | |
− | | + | |
− | {| class="wikitable"
| + | |
− | !Offset
| + | |
− | !Length
| + | |
− | !Data Type
| + | |
− | !Description
| + | |
− | !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 ==
| + | |
| | | |
| [[Category:File Formats]] | | [[Category:File Formats]] |
ANIMs are used in a variety of ways by Retro's engine. A single ANIM resource is known as
a primitive which may be blended and/or sequenced with other primitives to assemble
complex character animations (defined by ANCS and CHAR).
Each game has deviations in the format, but the principle of operation remains the same for all of them: