Difference between revisions of "FSKA (File Format)"
m (The textboxes with color were black (for me)) |
(Documenting unknown fields for now, keys and flags later.) |
||
Line 1: | Line 1: | ||
{{Under-construction}} | {{Under-construction}} | ||
− | The '''FSKA''' subfile stores animations which control how to transform bones of a model over time. It appears as a subfile of a '''[[BFRES (File Format)|BFRES file]]''' in the '''2:nd''' [[index group]]. Unless otherwise noted, all offsets in the file are relative to themselves. | + | The '''FSKA''' (ca'''F'''e '''SK'''eletal '''A'''nim) subfile stores animations which control how to transform bones of a model over time. It appears as a subfile of a '''[[BFRES (File Format)|BFRES file]]''' in the '''2:nd''' [[index group]]. Unless otherwise noted, all offsets in the file are relative to themselves. |
== Header (FSKA) == | == Header (FSKA) == | ||
− | An FSKA file begins with an | + | An FSKA file begins with an 0x30 byte header that starts with the file identifier, followed by info about the image. |
{|class="wikitable" | {|class="wikitable" | ||
Line 11: | Line 11: | ||
| 0x00 || String || '''File magic'''. Always ''FSKA'' in ASCII. | | 0x00 || String || '''File magic'''. Always ''FSKA'' in ASCII. | ||
|- | |- | ||
− | | 0x04 || Int32 || ''' | + | | 0x04 || Int32 || '''File name''' offset. The name of this file. |
|- | |- | ||
− | | 0x08 || Int32 || | + | | 0x08 || Int32 || '''End of BFRES string table''' offset. Points to just after the last string in the string table. Originally pointed to a string being the file path of the file the FSKA data was created from, which has been removed in the released game. |
|- | |- | ||
− | | 0x0C || UInt32 || ''' | + | | 0x0C || UInt32 || '''Flags'''. Controls how scaling and rotation is performed. Encoded as '''xxxxxxxx xxxxxxxx xxxRxxSS xxxxxxPC''' bits. |
+ | * C determines whether curves were baked. | ||
+ | * P controls the loop play policy with unknown meaning. | ||
+ | * SS controls how to perform scaling: | ||
+ | {| class="wikitable" | ||
+ | ! Value !! Description | ||
+ | |- | ||
+ | | 0 || No scaling | ||
+ | |- | ||
+ | | 1 || Standard scaling | ||
+ | |- | ||
+ | | 2 || Maya scaling | ||
+ | |- | ||
+ | | 3 || Softimage scaling | ||
+ | |} | ||
+ | * R controls the rotation mode, either euler XYZ rotation (bit set) or quaternion (bit unset). | ||
|- bgcolor="#AAFFAA" | |- bgcolor="#AAFFAA" | ||
| colspan="3" align="center" | '''if BFRES version >= 3.4.0''' | | colspan="3" align="center" | '''if BFRES version >= 3.4.0''' | ||
Line 21: | Line 36: | ||
| 0x10 || UInt32 || '''Frame count'''. | | 0x10 || UInt32 || '''Frame count'''. | ||
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
− | | 0x14 || UInt16 || '''[[#Bone|Bone]] count'''. | + | | 0x14 || UInt16 || '''[[#Bone Animation|Bone Animation]] count'''. |
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
− | | 0x16 || UInt16 || ''' | + | | 0x16 || UInt16 || '''[[BFRES (File Format)#User Data|User data]] entry count'''. |
|- bgcolor="#FFAAAA" | |- bgcolor="#FFAAAA" | ||
| colspan="3" align="center" | '''else''' | | colspan="3" align="center" | '''else''' | ||
Line 29: | Line 44: | ||
| 0x10 || UInt16 || '''Frame count'''. | | 0x10 || UInt16 || '''Frame count'''. | ||
|- bgcolor="#FFDDDD" | |- bgcolor="#FFDDDD" | ||
− | | 0x12 || UInt16 || '''[[#Bone|Bone]] count'''. | + | | 0x12 || UInt16 || '''[[#Bone Animation|Bone Animation]] count'''. |
|- bgcolor="#FFDDDD" | |- bgcolor="#FFDDDD" | ||
− | | 0x14 || | + | | 0x14 || UInt16 || '''[[BFRES (File Format)#User Data|User data]] entry count'''. |
+ | |- bgcolor="#FFDDDD" | ||
+ | | 0x16 || — || '''Padding'''. | ||
|- | |- | ||
− | | 0x18 || UInt32 || ''' | + | | 0x18 || UInt32 || '''Curve''' count. |
|- | |- | ||
− | | 0x1C || UInt32 || ''' | + | | 0x1C || UInt32 || '''Baked size'''. |
|- | |- | ||
− | | 0x20 || Int32 || '''[[#Bone|Bone]]''' array offset. | + | | 0x20 || Int32 || '''[[#Bone Animation|Bone Animation]]''' array offset. |
+ | |- | ||
+ | | 0x24 || Int32 || '''Skeleton Bind''' offset, unknown purpose. | ||
+ | |- | ||
+ | | 0x28 || Int32 || '''Skeleton Bind Index''' array offset, unknown purpose. | ||
+ | |- | ||
+ | | 0x2C || Int32 || '''[[BFRES (File Format)#User Data|User data]] [[index group]]''' offset. | ||
+ | |- | ||
+ | | 0x30 || colspan="2" {{Unknown|End of FSKA header}} | ||
|} | |} | ||
− | After this follows something like a UInt16 array of unknown length (around | + | After this follows something like a UInt16 array of unknown length (around 35 to 39 elements), each mostly having values 0x0000 or 0xFFFF. It might be possible the first ones are an offset to user data like in other subfile formats. |
− | == Bone == | + | == Bone Animation == |
This section describes how a bone of the model has to be transformed over time. It appears in an array of bones following and referenced by the header. | This section describes how a bone of the model has to be transformed over time. It appears in an array of bones following and referenced by the header. | ||
Line 49: | Line 74: | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || UInt32 || ''' | + | | 0x00 || UInt32 || '''Flags'''. |
|- | |- | ||
| 0x04 || Int32 || '''Bone name offset''' of the bone to be transformed. | | 0x04 || Int32 || '''Bone name offset''' of the bone to be transformed. | ||
|- | |- | ||
− | | 0x08 || | + | | 0x08 || Byte || '''Begin rotate''', unknown purpose. |
|- | |- | ||
− | | | + | | 0x09 || Byte || '''Begin translate''', unknown purpose. |
|- | |- | ||
− | | | + | | 0x0A || Byte || '''[[#Curve|Curve]]''' count. Might be 0 if the bone is not changed at all. |
|- | |- | ||
− | | | + | | 0x0B || Byte || '''Begin base translate''', unknown purpose. |
|- | |- | ||
− | | | + | | 0x0C || Single || '''Begin curve''', index of first curve. |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
− | | | + | | 0x10 || Int32 || '''[[#Curve|Curve]] array''' offset. |
|- | |- | ||
− | | | + | | 0x14 || Int32 || '''[[#Base Value Array|Base value array]]''' offset. |
|- | |- | ||
− | | | + | | 0x18 || colspan="2" {{Unknown|End of Bone Animation}} |
|} | |} | ||
− | == | + | == Curve == |
− | This section controls how a specific transformation is applied on a bone over time. | + | This section controls how a specific transformation is applied on a bone over time. Curves are referenced in an array by the Bone section; there might be no curves if the bone will not be animated. |
{|class="wikitable" | {|class="wikitable" | ||
Line 87: | Line 102: | ||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || UInt16 || ''' | + | | 0x00 || UInt16 || '''Flags''' / data type. |
|- | |- | ||
| 0x02 || UInt16 || '''Key''' count. | | 0x02 || UInt16 || '''Key''' count. | ||
|- | |- | ||
− | | 0x04 || UInt32 || ''' | + | | 0x04 || UInt32 || '''Target type'''. |
{|class="wikitable" | {|class="wikitable" | ||
|- | |- | ||
Line 115: | Line 130: | ||
|} | |} | ||
|- | |- | ||
− | | 0x08 || | + | | 0x08 || Single || '''Start frame''', first frame of the animation. |
|- | |- | ||
− | | 0x0C || Single || | + | | 0x0C || Single || '''End frame''', last frame of the animation. |
|- | |- | ||
| 0x10 || Single || '''Data value scale''', a factor to scale the data values with. | | 0x10 || Single || '''Data value scale''', a factor to scale the data values with. | ||
|- | |- | ||
− | | 0x14 || Single || '''Data value | + | | 0x14 || Single || '''Data value offset''', an initial value to offset the data values with. |
|- bgcolor="#AAFFAA" | |- bgcolor="#AAFFAA" | ||
| colspan="3" align="center" | '''if BFRES version >= 3.4.0''' | | colspan="3" align="center" | '''if BFRES version >= 3.4.0''' | ||
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
− | | 0x18 || Single || ''' | + | | 0x18 || Single || '''Delta'''. |
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
| 0x1C || Int32 || '''[[#Key Frames|Key frames]]''' array offset. | | 0x1C || Int32 || '''[[#Key Frames|Key frames]]''' array offset. | ||
|- bgcolor="#DDFFDD" | |- bgcolor="#DDFFDD" | ||
| 0x20 || Int32 || '''[[#Key Data|Key data]]''' array offset. | | 0x20 || Int32 || '''[[#Key Data|Key data]]''' array offset. | ||
+ | |- bgcolor="#DDFFDD" | ||
+ | | 0x2C || colspan="2" {{Unknown|End of Curve}} | ||
|- bgcolor="#FFAAAA" | |- bgcolor="#FFAAAA" | ||
| colspan="3" align="center" | '''else''' | | colspan="3" align="center" | '''else''' | ||
Line 136: | Line 153: | ||
|- bgcolor="#FFDDDD" | |- bgcolor="#FFDDDD" | ||
| 0x1C || Int32 || '''[[#Key Data|Key data]]''' array offset. | | 0x1C || Int32 || '''[[#Key Data|Key data]]''' array offset. | ||
+ | |- bgcolor="#FFDDDD" | ||
+ | | 0x20 || colspan="2" {{Unknown|End of Curve}} | ||
|} | |} | ||
Line 165: | Line 184: | ||
|- | |- | ||
| 0x09, 0x0A || Byte | | 0x09, 0x0A || Byte | ||
+ | |} | ||
+ | |||
+ | == Base Value Array == | ||
+ | This structure stores how a bone is transformed in its initial state, and is referenced by each Bone section once. | ||
+ | |||
+ | {|class="wikitable" | ||
+ | |- | ||
+ | ! Offset !! Type !! Description | ||
+ | |- | ||
+ | | 0x00 || Single[3] || '''Scale Vector''' 3 floats. The amount to scale the bone by. | ||
+ | |- | ||
+ | | 0x0C || Single[4] || '''Rotation Vector''', normally stored as euler rotation (X, Y, Z in radians) but it can be stored as a quaternion. The last float is not used by euler rotation and is therefore set to 1f. | ||
+ | |- | ||
+ | | 0x1C || Single[3] || '''Translation Vector''' 3 floats. The amount to translate the bone by. | ||
+ | |- | ||
+ | | 0x20 || colspan="2" {{Unknown|End of Base Value Array}} | ||
|} | |} | ||
Revision as of 11:56, 27 May 2017
The FSKA (caFe SKeletal Anim) subfile stores animations which control how to transform bones of a model over time. It appears as a subfile of a BFRES file in the 2:nd index group. Unless otherwise noted, all offsets in the file are relative to themselves.
Header (FSKA)
An FSKA file begins with an 0x30 byte header that starts with the file identifier, followed by info about the image.
Offset | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 | String | File magic. Always FSKA in ASCII. | ||||||||||
0x04 | Int32 | File name offset. The name of this file. | ||||||||||
0x08 | Int32 | End of BFRES string table offset. Points to just after the last string in the string table. Originally pointed to a string being the file path of the file the FSKA data was created from, which has been removed in the released game. | ||||||||||
0x0C | UInt32 | Flags. Controls how scaling and rotation is performed. Encoded as xxxxxxxx xxxxxxxx xxxRxxSS xxxxxxPC bits.
| ||||||||||
if BFRES version >= 3.4.0 | ||||||||||||
0x10 | UInt32 | Frame count. | ||||||||||
0x14 | UInt16 | Bone Animation count. | ||||||||||
0x16 | UInt16 | User data entry count. | ||||||||||
else | ||||||||||||
0x10 | UInt16 | Frame count. | ||||||||||
0x12 | UInt16 | Bone Animation count. | ||||||||||
0x14 | UInt16 | User data entry count. | ||||||||||
0x16 | — | Padding. | ||||||||||
0x18 | UInt32 | Curve count. | ||||||||||
0x1C | UInt32 | Baked size. | ||||||||||
0x20 | Int32 | Bone Animation array offset. | ||||||||||
0x24 | Int32 | Skeleton Bind offset, unknown purpose. | ||||||||||
0x28 | Int32 | Skeleton Bind Index array offset, unknown purpose. | ||||||||||
0x2C | Int32 | User data index group offset. | ||||||||||
0x30 | End of FSKA header |
After this follows something like a UInt16 array of unknown length (around 35 to 39 elements), each mostly having values 0x0000 or 0xFFFF. It might be possible the first ones are an offset to user data like in other subfile formats.
Bone Animation
This section describes how a bone of the model has to be transformed over time. It appears in an array of bones following and referenced by the header.
Offset | Type | Description |
---|---|---|
0x00 | UInt32 | Flags. |
0x04 | Int32 | Bone name offset of the bone to be transformed. |
0x08 | Byte | Begin rotate, unknown purpose. |
0x09 | Byte | Begin translate, unknown purpose. |
0x0A | Byte | Curve count. Might be 0 if the bone is not changed at all. |
0x0B | Byte | Begin base translate, unknown purpose. |
0x0C | Single | Begin curve, index of first curve. |
0x10 | Int32 | Curve array offset. |
0x14 | Int32 | Base value array offset. |
0x18 | End of Bone Animation |
Curve
This section controls how a specific transformation is applied on a bone over time. Curves are referenced in an array by the Bone section; there might be no curves if the bone will not be animated.
Offset | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x00 | UInt16 | Flags / data type. | ||||||||||||||||||||
0x02 | UInt16 | Key count. | ||||||||||||||||||||
0x04 | UInt32 | Target type.
| ||||||||||||||||||||
0x08 | Single | Start frame, first frame of the animation. | ||||||||||||||||||||
0x0C | Single | End frame, last frame of the animation. | ||||||||||||||||||||
0x10 | Single | Data value scale, a factor to scale the data values with. | ||||||||||||||||||||
0x14 | Single | Data value offset, an initial value to offset the data values with. | ||||||||||||||||||||
if BFRES version >= 3.4.0 | ||||||||||||||||||||||
0x18 | Single | Delta. | ||||||||||||||||||||
0x1C | Int32 | Key frames array offset. | ||||||||||||||||||||
0x20 | Int32 | Key data array offset. | ||||||||||||||||||||
0x2C | End of Curve | |||||||||||||||||||||
else | ||||||||||||||||||||||
0x18 | Int32 | Key frames array offset. | ||||||||||||||||||||
0x1C | Int32 | Key data array offset. | ||||||||||||||||||||
0x20 | End of Curve |
Key Frames
The key frame array is of length and element type given by the header:
Data Types | Key Frame Element Type |
---|---|
0x02, 0x05, 0x06, 0x09, 0x0A | UInt16 >> 5 |
else | Byte |
The resulting values of the elements specify the frame at which the key with the same index in the key data array is placed.
Key Data
Each key in the key array consists of 4 unknown values of different type dependent upon the data type specified in the header:
Data Types | Key Data Element Type |
---|---|
0x02 | Single |
0x05 | Int16 |
0x06 | Int16 |
0x09, 0x0A | Byte |
Base Value Array
This structure stores how a bone is transformed in its initial state, and is referenced by each Bone section once.
Offset | Type | Description |
---|---|---|
0x00 | Single[3] | Scale Vector 3 floats. The amount to scale the bone by. |
0x0C | Single[4] | Rotation Vector, normally stored as euler rotation (X, Y, Z in radians) but it can be stored as a quaternion. The last float is not used by euler rotation and is therefore set to 1f. |
0x1C | Single[3] | Translation Vector 3 floats. The amount to translate the bone by. |
0x20 | End of Base Value Array |
Tools
The following tools can handle FSKA files:
- ModelThingy, by Ploaj (can animate models)