FF9/File/0x02

From Final Fantasy Inside
< FF9
Revision as of 13:09, 16 November 2008 by my_wiki>Zidane
Jump to navigation Jump to search

Model begins with 4-byte header:


1: 00 (1-st model byte)

2: 00

3: Bones count.

4: Objects count.


Next there is 8 byte, unknown purpose

Next there is 4 bytes, value is always 0x14. I think, that it is count of bytes from 1-st byte to bones table.

Next there is 4-byte pointer from 1-st model byte to object table.


Bones

Next there is model scelet, bones counting from 0. Every bone information is of 4-bytes:

3 bytes — bone length

1 byte — parent bone


Object table

Size of table is 40 * objects count.

Data Length (bytes)
UNKNOWN 2
Quads count 2
Triangles count 2
UNKNOWN, zeroes 14
Pointer to vertex table, counting from first byte of model 4
Pointer to vertices, counting from first byte of model 4
Pointer to quad block with triangles, counting from first byte of model 4
Pointer to texture coordinates, counting from first byte of model 4
Pointer to the end of object, counting from first byte of model 4


Vertex table

In this table there is information about count of vertex connected to every bone. Every record is 2-byte. If count of bones is odd, there is 2-byte padding.


Vertices

Here there is information about all vertices of selected object. Vertex record is 3-byte and is of next structure:

Data Length (bytes)
X 2
Y 2
Z 2
Bone number 1
UnkNown 1

Point coordinates are in local coordinate system of given bones. Vertex count begins from 0. For every model object it counts from 0.


Quad and Triangle block

First there is block of quads, next there is triangles. Count of quads and triangles is in object table.

   Quad record:
Data Length (bytes)
1-st vertex index 2
2-nd vertex index 2
3-rd vertex index 2
4-th vertex index 2
Coordinate index from block of coordinates of texturation for first vertex. 2
Coordinate index from block of coordinates of texturation for second vertex. 2
Coordinate index from block of coordinates of texturation for third vertex. 2
Coordinate index from block of coordinates of texturation for fourth vertex. 2
Color R (I think) 1
Color G (I think) 1
Color B (I think) 1
(Texture information?) 1
(Texture information?) 4


    Triangle record:
Data Length (bytes)
1-st vertex index 2
2-nd vertex index 2
3-rd vertex index 2
(Texture information?) 2
Color R (I think) 1
Color G (I think) 1
Color B (I think) 1
(Texture information?) 1
Coordinate index from block of coordinates of texturation for first vertex. 2
Coordinate index from block of coordinates of texturation for second vertex. 2
Coordinate index from block of coordinates of texturation for third vertex. 2
(Texture information?) 2


Texture coordinates

In this block there is texture coordinate of selected object. Values of given table used for applying texture to quads and triangles of object. To elements of given table points «Coordinate index from block of coordinates of texturation for <N> vertex.» from triangle and quad records.


Records counting from 0.

Texture coordinate record:

Data Length (bytes)
Texture coordinate U 1
Texture coordinate V 1