Difference between revisions of "ANIM"

From Battlepedia
Jump to navigationJump to search
(Added new information about Seil's BFBBAnimTools script; added a download link to the new tool.)
m
Line 4: Line 4:
 
|games=Night of 100 Frights<br>Battle for Bikini Bottom<br>The SpongeBob SquarePants Movie<br>The Incredibles<br>Rise of the Underminer}}
 
|games=Night of 100 Frights<br>Battle for Bikini Bottom<br>The SpongeBob SquarePants Movie<br>The Incredibles<br>Rise of the Underminer}}
  
== ANIM Importer (Old) ==
+
==ANIM Importer (Old)==
 
[https://cdn.discordapp.com/attachments/446321271635050508/614641973273296915/anim.zip These are scripts to import most .ANIM files into 3ds Max.] Note: they may look a little wonky or broken.
 
[https://cdn.discordapp.com/attachments/446321271635050508/614641973273296915/anim.zip These are scripts to import most .ANIM files into 3ds Max.] Note: they may look a little wonky or broken.
  
== The New Anim Importer/Exporter (BFBBAnimTools by Seil)==
+
==The New Anim Importer/Exporter (BFBBAnimTools by Seil)==
On October 4th, 2019, user Seil of the BFBB Modding community figured out the ANIM file format, and has created a tool called BFBBAnimTools for 3DS Max in MAXScript format. The tool allows a proper import of BFBB's original ANIM files to 3DS Max, as well as now the long awaited export feature, allowing you to create custom anim files for already existing models, or even possibly in the future custom models. The tool allows exporting ANIM files for the PlayStation 2, Xbox, and the GameCube versions of BFBB.
+
On October 4th, 2019, user [[User:Seil|Seil]] figured out the ANIM file format and has created a tool called BFBBAnimTools for 3DS Max in MAXScript format. The tool allows a proper import of BFBB's original ANIM files to 3DS Max, as well as now the long awaited export feature, allowing you to create custom anim files for already existing models, or even possibly in the future custom models. The tool allows exporting ANIM files for the PlayStation 2, Xbox, and the GameCube versions of BFBB.
 
You can download the new BFBBAnimTools utility [http://www.mediafire.com/file/0zt4sx0y9o1206d/BFBBAnimTools.ms/file here.]
 
You can download the new BFBBAnimTools utility [http://www.mediafire.com/file/0zt4sx0y9o1206d/BFBBAnimTools.ms/file here.]
 +
 
==Format==
 
==Format==
 
Animation assets are stored using the SKB format. The overall format looks like this:
 
Animation assets are stored using the SKB format. The overall format looks like this:
 +
 
<source lang=cpp>
 
<source lang=cpp>
 
iAnimSKBHeader header;
 
iAnimSKBHeader header;

Revision as of 22:10, 12 October 2019

ANIM
Animation
Type Binary
Object ID -
Games used Night of 100 Frights
Battle for Bikini Bottom
The SpongeBob SquarePants Movie
The Incredibles
Rise of the Underminer

ANIM Importer (Old)

These are scripts to import most .ANIM files into 3ds Max. Note: they may look a little wonky or broken.

The New Anim Importer/Exporter (BFBBAnimTools by Seil)

On October 4th, 2019, user Seil figured out the ANIM file format and has created a tool called BFBBAnimTools for 3DS Max in MAXScript format. The tool allows a proper import of BFBB's original ANIM files to 3DS Max, as well as now the long awaited export feature, allowing you to create custom anim files for already existing models, or even possibly in the future custom models. The tool allows exporting ANIM files for the PlayStation 2, Xbox, and the GameCube versions of BFBB. You can download the new BFBBAnimTools utility here.

Format

Animation assets are stored using the SKB format. The overall format looks like this:

iAnimSKBHeader header;
iAnimSKBKey keys[header.KeyCount];
float times[header.TimeCount];
unsigned short offsets[header.TimeCount - 1][header.BoneCount];

Header

The header is defined by an iAnimSKBHeader struct:

struct iAnimSKBHeader
{
	unsigned int Magic;
	unsigned int Flags;
	unsigned short BoneCount;
	unsigned short TimeCount;
	unsigned int KeyCount;
	float Scale[3];
};
  • Magic is always 'SKB1'.
  • Flags
  • BoneCount is the number of bones in the model.
  • TimeCount is the number of times (frames) in the animation.
  • KeyCount is the total number of keyframes in the animation.
  • Scale

Keys

Each keyframe in the keys array is defined by an iAnimSKBKey struct:

struct iAnimSKBKey
{
	unsigned short TimeIndex;
	short Quat[4];
	short Tran[3];
};
  • TimeIndex is an index into the times array
  • Quat represents an quaternion rotation (X, Y, Z, W) for a bone at this keyframe.
  • Tran represents an offset position (X, Y, Z) for a bone at this keyframe.

Times

The times array maps each frame of the animation to a time in seconds. Typically this starts at 0 and increases by a multiple of 0.01666... (1/60th of a second). The last time in the animation can be interpreted as the length of the animation in seconds.

Offsets

The offsets array maps each bone in the model to a starting index in the keys array, for each time (frame) in the animation (except for the last one, because it signifies the end of the animation and doesn't have a keyframe associated with it).

For example, if a model has 3 bones, and each bone has a keyframe on every time (so 3 keyframes per time), then the offsets array would look like this:

offsets[0][0] = 0
offsets[0][1] = 3
offsets[0][2] = 6
offsets[1][0] = 1
offsets[1][1] = 4
offsets[1][2] = 7
offsets[2][0] = 2
...