Anonymous

Changes

From Final Fantasy Inside

FF9/File/0x02

4,754 bytes added, 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)|}  '''Bone Header''' Global header for bones, one header per bone.<br />Size: 4 bytes  {| 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| | 24BIT| | Length|-| | 0x03| | BYTE| | Parent Bone|}  '''Group Header''' Global header for groups, one header per group.<br />Size: 40 bytes  {| 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| | WORD| | Size of the group's data (excluding 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)|-| | 0x0C| | WORD| | Number of Triangle Polygons (Type-C)|-| | 0x0E| | WORD| | Group X offset|-| | 0x10| | WORD| | Group Y offset|-| | 0x12| | WORD| | Group Z offset|-| | 0x14| | DWORD| | Pointer to Bone Data Chunk|-| | 0x18| | DWORD| | Pointer to Vertex Data Chunk|-| | 0x1C| | DWORD| | Pointer to Polygon Data Chunk|-| | 0x20| | DWORD| | Pointer to Texture Mapping Data Chunk|-| | 0x24| | DWORD| | Pointer to End-of-Group|} 
3: Bones count.'''Bone Data Chunk'''
Local group data for bones, one data chunk per bone of the group.<br />Size: 4: Objects count.bytes
{| 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
|}
Next there is 8 byte, unknown purpose'''Vertex Data Chunk'''
Next there is 4 bytesLocal group data for vertices, value is always 0x14one data chunk per vertex of the group. I think, that it is count of <br />Size: 8 bytes from 1-st byte to bones table.
Next there is 4-byte pointer from 1-st model byte to object table.
{| 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
| | WORD
| | X-Coordinate (signed value)
|-
| | 0x02
| | WORD
| | Y-Coordinate (signed value)
|-
| | 0x04
| | WORD
| | Z-Coordinate (signed value)
|-
| | 0x06
| | BYTE
| | ID of the bone the vertex is connected to
|-
| | 0x07
| | BYTE
| | Unknown
|}
'''BonesPolygon Data Chunk'''
Next there is model sceletLocal group data for polygons.<br />There are six different types of polygons, bones counting from 0three types of polygons made out of four vertices (quadrangle) and three types of polygons made out of three vertices (triangle). Every bone information is of 4-bytes:
3 bytes — bone length
1 byte — parent bone''Quadrangle Type-A''
Size: 24 bytes
{| 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
| | WORD
| | Vertex index 1
|-
| | 0x02
| | WORD
| | Vertex index 2
|-
| | 0x04
| | WORD
| | Vertex index 3
|-
| | 0x06
| | WORD
| | Vertex index 4
|-
| | 0x08
| | WORD
| | Texture index 1
|-
| | 0x0A
| | WORD
| | Texture index 2
|-
| | 0x0C
| | WORD
| | Texture index 3
|-
| | 0x0E
| | WORD
| | Texture index 4
|-
| | 0x10
| | 24BIT
| | Vertex colour (R8G8B8)
|-
| | 0x13
| | BYTE
| | Texture material index (Referenced to 0x12 chunk)
|-
| | 0x14
| | DWORD
| | Unknown
|}
'''Object table'Triangle Type-A''
Size of table is 40 * objects count.: 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|-| | 0x00| | WORD| | Vertex index 1
|-
| style="background:rgb(255,255,255);" | UNKNOWN0x02| style="background:rgb(255,255,255);" | WORD| | Vertex index 2
|-
| style="background:rgb(255,255,255);" | Quads count0x04| style="background:rgb(255,255,255);" | 2WORD| | Vertex index 3
|-
| style="background:rgb(255,255,255);" | Triangles count0x06| | BYTE| style="background:rgb| Texture material index (255,255,255Referenced to 0x12 chunk);" | 2
|-
| style="background:rgb(255,255,255);" | UNKNOWN, zeroes0x07| style="background:rgb(255,255,255);" | 14BYTE| | Unknown
|-
| style="background:rgb(255,255,255);" | Pointer to vertex table, counting from first byte of model0x08| | 24BIT| style="background:rgb| Vertex colour (255,255,255R8G8B8);" | 4?
|-
| style="background:rgb(255,255,255);" | Pointer to vertices, counting from first byte of model0x0B| style="background:rgb(255,255,255);" | 4BYTE| | Unknown
|-
| | 0x0C| | WORD| | Texture index 1|-| | 0x0E| | WORD| | Texture index 2|-| | 0x10| | WORD| | Texture index 3|-| | 0x12| | DWORD| | If first bit = 1, then packet type chenging from 0x24 to 0x26 and "ANDed" with 0xE0 part "ORing" with TPage.|} ''Quadrangle Type-B'' Size: 32 bytes  ''Triangle Type-B'' Size: 24 bytes  ''Quadrangle Type-C'' Size: 24 bytes  ''Triangle Type-C'' Size: 20 bytes  '''Texture Mapping Data Chunk''' Local 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  {| 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" | Pointer to quad block with trianglesOffset! style="background:rgb(204,204, counting from first byte of model204);" align="center" width="80" | Size| ! style="background:rgb(255204,255204,255204);" align="center" | 4Description
|-
| style="background:rgb(255,255,255);" | Pointer to texture coordinates, counting from first byte of model0x00| style="background:rgb(255,255,255);" | 4BYTE| | U-Coordinate
|-
| style="background:rgb(255,255,255);" | Pointer to the end of object, counting from first byte of model0x01| style="background:rgb(255,255,255);" | 4BYTE| | V-Coordinate
|}