Anonymous

Changes

From Final Fantasy Inside

FF9/File/0x02

914 bytes removed, 05:25, 23 May 2019
m
6 revisions imported
'''3D Model begins with 4-byte header:Header'''
Global header for the 3D model, one per model.<br />
Size: 20 bytes
1: 00 (1-st model byte)
2{| border="0" cellspacing="1" cellpadding="3" width="640" style="background: 00rgb(255,255,255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | Offset! style="background:rgb(204,204,204);" align="center" width="80" | Size! style="background:rgb(204,204,204);" align="center" | Description|-| | 0x00| | WORD| | NULL (0x0000)|-| | 0x02| | BYTE| | Number of Bones|-| | 0x03| | BYTE| | Number of Groups|-| | 0x04| | WORD| | Total size of data, excl. all headers (3D Model/Bone/Object-Group Headers)|-| | 0x06| | WORD| | Unknown (possible an ID)|-| | 0x08| | WORD| | Unknown (possible an ID)|-| | 0x0A| | WORD| | Unknown (possible an ID)|-| | 0x0C| | DWORD| | Pointer to Bone Header(s)|-| | 0x10| | WORD| | Pointer to Group Header(s)|}
3: Bones count.
4: Objects count.'''Bone Header'''
Global header for bones, one header per bone.<br />
Size: 4 bytes
Next there is 8 byte, unknown purpose
Next there is 4 bytes{| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(255, value is always 0x14. I think255, that it is count of bytes from 1255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | Offset! style="background:rgb(204,204,204);" align="center" width="80" | Size! style="background:rgb(204,204,204);" align="center" | Description|-| | 0x00| | 24BIT| | Length|-st byte to bones table. | | 0x03| | BYTE| | Parent Bone|}
Next there is 4-byte pointer from 1-st model byte to object table.
'''Group Header'''
Global header for groups, one header per group.<br />
Size: 40 bytes
'''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. {| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(0255,255,255)" align="center"! style="background:rgb(204,0204,0204);" align="center"width="80" | Offset! style="background:rgb(204,204,204);" align="center" width="80" | DataSize! style="background:rgb(204,204,204);" align="center" | Length Description|-| | 0x00| | WORD| | Size of the group's data (bytesexcluding the header).|-| | 0x02| | WORD| | Number of Quadrangle Polygons (Type-A)|-| | 0x04| | WORD| | Number of Triangle Polygons (Type-A)|-| | 0x06| | WORD| | Number of Quadrangle Polygons (Type-B)|-| | 0x08| | WORD| | Number of Triangle Polygons (Type-B)|-| | 0x0A| | WORD| | Number of Quadrangle Polygons (Type-C)
|-
| style="background:rgb(255,255,255);" | UNKNOWN0x0C| | WORD| style="background:rgb| Number of Triangle Polygons (255,255,255Type-C);" | 2
|-
| style="background:rgb(255,255,255);" | Quads count0x0E| style="background:rgb(255,255,255);" | 2WORD| | Group X offset
|-
| style="background:rgb(255,255,255);" | Triangles count0x10| style="background:rgb(255,255,255);" | 2WORD| | Group Y offset
|-
| style="background:rgb(255,255,255);" | UNKNOWN, zeroes0x12| style="background:rgb(255,255,255);" | 14WORD| | Group Z offset
|-
| style="background:rgb(255,255,255);" | Pointer to vertex table, counting from first byte of model0x14| | DWORD| style="background:rgb(255,255,255);" | 4Pointer to Bone Data Chunk
|-
| style="background:rgb(255,255,255);" | Pointer to vertices, counting from first byte of model0x18| | DWORD| style="background:rgb(255,255,255);" | 4Pointer to Vertex Data Chunk
|-
| style="background:rgb(255,255,255);" | Pointer to quad block with triangles, counting from first byte of model0x1C| | DWORD| style="background:rgb(255,255,255);" | 4Pointer to Polygon Data Chunk
|-
| style="background:rgb(255,255,255);" | Pointer to texture coordinates, counting from first byte of model0x20| | DWORD| style="background:rgb(255,255,255);" | 4Pointer to Texture Mapping Data Chunk
|-
| style="background:rgb(255,255,255);" | 0x24| | DWORD| | Pointer to the end End-of object, counting from first byte of model| style="background:rgb(255,255,255);" | 4-Group
|}
'''Vertex tableBone Data Chunk'''
In this table there is information about count of vertex connected to every Local group data for bones, one data chunk per bone. Every record is 2-byte. If count of bones is odd, there is 2-byte paddingthe group.<br />Size: 4 bytes
'''Vertices'''{| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(255,255,255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | Offset! style="background:rgb(204,204,204);" align="center" width="80" | Size! style="background:rgb(204,204,204);" align="center" | Description|-| | 0x00| | DWORD| | Number of vertices connected to the bone|}
Here there is information about all vertices of selected object. Vertex record is 3-byte and is of next structure:
'''Vertex Data Chunk''' Local group data for vertices, one data chunk per vertex of the group.<br />Size: 8 bytes  {| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(0255,0255,0255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | DataOffset! style="background:rgb(204,204,204);" align="center" width="80" | Length Size! style="background:rgb(bytes204,204,204);" align="center" | Description
|-
| style="background:rgb(255,255,255);" | X0x00| | WORD| style="background:rgb| X-Coordinate (255,255,255signed value);" | 2
|-
| style="background:rgb(255,255,255);" | Y0x02| | WORD| style="background:rgb| Y-Coordinate (255,255,255signed value);" | 2
|-
| style="background:rgb(255,255,255);" | Z0x04| | WORD| style="background:rgb| Z-Coordinate (255,255,255signed value);" | 2
|-
| style="background:rgb(255,255,255);" | Bone number0x06| style="background:rgb(255,255,255);" | 1BYTE| | ID of the bone the vertex is connected to
|-
| style="background:rgb(255,255,255);" | UnkNown0x07| style="background:rgb(255,255,255);" | 1BYTE| | Unknown
|}
Point coordinates are in local coordinate system of given bones. Vertex count begins from 0. For every model object it counts from 0.
'''Polygon Data Chunk'''
'''Quad Local group data for polygons.<br />There are six different types of polygons, three types of polygons made out of four vertices (quadrangle) and Triangle block'''three types of polygons made out of three vertices (triangle).
First there is block of quads, next there is triangles. Count of quads and triangles is in object table.
''Quadrangle Type-A'''Quad record Size:'''''24 bytes {| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(0255,0255,0255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | DataOffset! style="background:rgb(204,204,204);" align="center" | Length (bytes)|-| stylewidth="background:rgb(255,255,255);80" | 1-st vertex indexSize| ! style="background:rgb(255204,255204,255204);" | 2|-| stylealign="background:rgb(255,255,255);" | 2-nd vertex index| style="background:rgb(255,255,255);center" | 2Description
|-
| style="background:rgb(255,255,255);" | 3-rd vertex index0x00| | WORD| style="background:rgb(255,255,255);" | 2Vertex index 1
|-
| style="background:rgb(255,255,255);" | 4-th vertex index0x02| | WORD| style="background:rgb(255,255,255);" | Vertex index 2
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for first vertex.0x04| | WORD| style="background:rgb(255,255,255);" | 2Vertex index 3
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for second vertex.0x06| | WORD| style="background:rgb(255,255,255);" | 2Vertex index 4
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for third vertex.0x08| | WORD| style="background:rgb(255,255,255);" | 2Texture index 1
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for fourth vertex.0x0A| | WORD| style="background:rgb(255,255,255);" | Texture index 2
|-
| style="background:rgb(255,255,255);" | Color R (I think)0x0C| style="background:rgb(255,255,255);" | 1WORD| | Texture index 3
|-
| style="background:rgb(255,255,255);" | Color G (I think)0x0E| style="background:rgb(255,255,255);" | 1WORD| | Texture index 4
|-
| style="background:rgb(255,255,255);" | Color B (I think)0x10| | 24BIT| style="background:rgb| Vertex colour (255,255,255R8G8B8);" | 1
|-
| style="background:rgb(255,255,255);" | (Texture information?)0x13| | BYTE| style="background:rgb| Texture material index (255,255,255Referenced to 0x12 chunk);" | 1
|-
| style="background:rgb(255,255,255);" | (Texture information?)0x14| style="background:rgb(255,255,255);" | 4DWORD| | Unknown
|}
''Triangle Type-A''
'''''Triangle recordSize:'''''20 bytes
{| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(0255,0255,0255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | DataOffset! style="background:rgb(204,204,204);" align="center" width="80" | Length Size! style="background:rgb(bytes204,204,204);" align="center" | Description
|-
| style="background:rgb(255,255,255);" | 1-st vertex index0x00| | WORD| style="background:rgb(255,255,255);" | 2Vertex index 1
|-
| style="background:rgb(255,255,255);" | 2-nd vertex index0x02| | WORD| style="background:rgb(255,255,255);" | Vertex index 2
|-
| style="background:rgb(255,255,255);" | 3-rd vertex index0x04| | WORD| style="background:rgb(255,255,255);" | 2Vertex index 3
|-
| style="background:rgb(255,255,255);" | (Texture information?)0x06| | BYTE| style="background:rgb| Texture material index (255,255,255Referenced to 0x12 chunk);" | 2
|-
| style="background:rgb(255,255,255);" | Color R (I think)0x07| style="background:rgb(255,255,255);" | 1BYTE| | Unknown
|-
| style="background:rgb(255,255,255);" | Color G (I think)0x08| | 24BIT| style="background:rgb| Vertex colour (255,255,255R8G8B8);" | 1?
|-
| style="background:rgb(255,255,255);" | Color B (I think)0x0B| style="background:rgb(255,255,255);" | 1BYTE| | Unknown
|-
| style="background:rgb(255,255,255);" | (Texture information?)0x0C| | WORD| style="background:rgb(255,255,255);" | Texture index 1
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for first vertex.0x0E| | WORD| style="background:rgb(255,255,255);" | Texture index 2
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for second vertex.0x10| | WORD| style="background:rgb(255,255,255);" | 2Texture index 3
|-
| style="background:rgb(255,255,255);" | Coordinate index from block of coordinates of texturation for third vertex.0x12| style="background:rgb(255,255,255);" | 2DWORD|-| styleIf first bit =1, then packet type chenging from 0x24 to 0x26 and "background:rgb(255,255,255);ANDed" | (Texture information?)| style=with 0xE0 part "background:rgb(255,255,255);ORing" | 2with TPage.
|}
''Quadrangle Type-B''
 
Size: 32 bytes
 
 
''Triangle Type-B''
 
Size: 24 bytes
 
 
''Quadrangle Type-C''
 
Size: 24 bytes
 
 
''Triangle Type-C''
'''Texture coordinates'''Size: 20 bytes
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.
'''Texture Mapping Data Chunk'''
Records counting from 0Local group data for texture mapping.<br />The number of texture mapping coordinates are: Number of quadrangle polygons (any type) * 4 + Number of triangle polygons (any type) * 3.<br />Size: 2 bytes
Texture coordinate record:
{| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(0255,0255,0255)" align="center"! style="background:rgb(204,204,204);" align="center" width="80" | DataOffset! style="background:rgb(204,204,204);" align="center" width="80" | Length Size! style="background:rgb(bytes204,204,204);" align="center" | Description
|-
| style="background:rgb(255,255,255);" | Texture coordinate U0x00| | BYTE| style="background:rgb(255,255,255);" | 1U-Coordinate
|-
| style="background:rgb(255,255,255);" | Texture coordinate V0x01| | BYTE| style="background:rgb(255,255,255);" | 1V-Coordinate
|}