Kingdom Hearts II - ANB (Animation Binary)
ANB files are used by the game engine to animate a 3D model and trigger events in specific frames. They are used for both gameplay and cutscenes. All the gameplay ANB files are located inside MSET files in
obj/, while for cutscenes they are located in
Internally they are just BAR archives and for what it’s known the only two files that can be found in are motion data and effect data.
This file is responsible of animating a 3D model. It comes in two forms, interpolated and RAW. Due to the bigger complexity of interpolated-type motion files, they will be documented in a separate document.
The game engine assumes that the maximum frame rate is
60; this is referred as Global Frame Rate (or GFR). But every motion can run at a different frame rate; this is referred as Local Frame Rate (or LFR).
The RAW animation type just takes an array of matrices for each frame and applies them to the bones of a model. It is a very cheap technique in terms of CPU usage, but it requires a big amount of memory.
Like model files, the first
0x90 are reserved an always set to
00. Offsets and file size ignores the first
0x90. This document refers to the motion type
1, which is the RAW one. When the motion type is
0, the rest of the file after the header will be very different; refer to interpolated motion document.
|0||int||Motion ‘type’, 0=Interpolated, 1=Raw|
|4||int||Unknown. It can be
|8||int||Size of the file|
Raw motion header
This is located straight after the motion header.
|0x00||int||Bone count. Must match with the bone count of the model.|
|0x10||int||Amount of GFR in a loop (
|0x14||int||Total amount of frames, expressed in LFR|
|0x1c||int||Offset to the second matrix table|
|0x20||vec4f||Bounding Box minimum|
|0x30||vec4f||Bounding Box maximum|
|0x48||float||Frames per second, defines the LFR|
|0x4c||float||Frame count, expressed in LFR|
Raw motion matrices
An array of array of 4x4 matrices (
Matrix4x4). The first dimension of the array refers to the total amount of frames, while the second dimension is the bone count. For each frame (LFR), the game engine takes BoneCount amount of
Matrix4x4 and multiplies them to the mesh that corresponds to a specific bone.
Raw motion more matrices
This is optionally defined and its purpose is unknown. It is an array of 4x4 matrices (
Matrix4x4), where the size of the array is equal to the bone count. For the few files that has been analysed, those matrices are always a Matrix Identity.
This file describe triggers that happens during a motion and it’s believed they are located into a different file to favour decoupling.
Effect main header
|Array||Type A effect (Happens during X frames)|
|Array||Type B effect (Triggered on a specific frame)|
Effect entry header
|0||byte||Type A effect count|
|1||byte||Type B effect count|
|2||short||Start offset of the type B effects|
Type A effect
|4||byte||Effect A ID|
|5||byte||Param size as shorts|
Type B effect
|2||byte||Effect B ID|
|3||byte||Param size as shorts|
Effect A list
|0||Allows controls (But brings to idle animaiton)|
|1||Allows controls (But blocks the animation)|
|3||Blocks the animation (But disables gravity)|
|4||Blocks controls (But allows gravity)|
|20||Performs a reaction command (On current model)||?||?|
|23||Draws an additional texture||?||?|
|25||Performs a reaction command (On another model)||?||?|
|34||Blocks reaction command|
|41||Allows controls (But disables model rotation)|
Effect B list
|1||Plays PAX sprite||PAX sprite ID||?|
|2||Plays footstep sound||Sound ID||?|
|3||Plays animation in slot 628|
|13||Plays an enemy vsb voice||vsb ID||?|
|14||Plays an ally vsb voice||vsb ID||?|
|22||Makes the keyblade appear||?||?|
|23||Makes model opacity decrease||?||?|
|24||Makes model opacity increase||?||?|
|26||Makes a mesh disappear||?||?|
|27||Makes a mesh appear||?||?|
|29||Plays a Keyblade appearance sprite|