Difference between revisions of "FF9/File/0x02"

From Final Fantasy Inside
< FF9
Jump to navigation Jump to search
my_wiki>Zidane
 
m (6 revisions imported)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Model begins with 4-byte header:
+
'''3D Model Header'''
  
 +
Global header for the 3D model, one per model.<br />
 +
Size: 20 bytes
  
1: 00    (1-st model byte)
 
  
2: 00
+
{| 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
 +
| | 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'''
  
4: Objects count.
+
Local group data for bones, one data chunk per bone of the group.<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
 +
| | DWORD
 +
| | Number of vertices connected to the bone
 +
|}
  
  
Next there is 8 byte, unknown purpose
+
'''Vertex Data Chunk'''
  
Next there is 4 bytes, value is always 0x14. I think, that it is count of bytes from 1-st byte to bones table.
+
Local group data for vertices, one data chunk per vertex of the group.<br />
 +
Size: 8 bytes
  
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
 +
|}
  
  
'''Bones'''
+
'''Polygon Data Chunk'''
  
Next there is model scelet, bones counting from 0. Every bone information is of 4-bytes:
+
Local group data for polygons.<br />
 +
There are six different types of polygons, three types of polygons made out of four vertices (quadrangle) and three types of polygons made out of three vertices (triangle).
  
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.
+
Size: 20 bytes
  
{| border="0" cellspacing="1" cellpadding="3" style="background: rgb(0,0,0)" align="center"
+
{| border="0" cellspacing="1" cellpadding="3" width="640" style="background: rgb(255,255,255)" align="center"
! style="background:rgb(204,204,204);" align="center" | Data
+
! style="background:rgb(204,204,204);" align="center" width="80" | Offset
! style="background:rgb(204,204,204);" align="center" | Length (bytes)
+
! 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
 
|-
 
|-
| style="background:rgb(255,255,255);" | UNKNOWN
+
| | 0x02
| style="background:rgb(255,255,255);" | 2
+
| | WORD
 +
| | Vertex index 2
 
|-
 
|-
| style="background:rgb(255,255,255);" | Quads count
+
| | 0x04
| style="background:rgb(255,255,255);" | 2
+
| | WORD
 +
| | Vertex index 3
 
|-
 
|-
| style="background:rgb(255,255,255);" | Triangles count
+
| | 0x06
| style="background:rgb(255,255,255);" | 2
+
| | BYTE
 +
| | Texture material index (Referenced to 0x12 chunk)
 
|-
 
|-
| style="background:rgb(255,255,255);" | UNKNOWN, zeroes
+
| | 0x07
| style="background:rgb(255,255,255);" | 14
+
| | BYTE
 +
| | Unknown
 
|-
 
|-
| style="background:rgb(255,255,255);" | Pointer to vertex table, counting from first byte of model
+
| | 0x08
| style="background:rgb(255,255,255);" | 4
+
| | 24BIT
 +
| | Vertex colour (R8G8B8) ?
 
|-
 
|-
| style="background:rgb(255,255,255);" | Pointer to vertices, counting from first byte of model
+
| | 0x0B
| style="background:rgb(255,255,255);" | 4
+
| | BYTE
 +
| | Unknown
 
|-
 
|-
| style="background:rgb(255,255,255);" | Pointer to quad block with triangles, counting from first byte of model
+
| | 0x0C
| style="background:rgb(255,255,255);" | 4
+
| | 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" | Offset
 +
! style="background:rgb(204,204,204);" align="center" width="80" | Size
 +
! style="background:rgb(204,204,204);" align="center" | Description
 
|-
 
|-
| style="background:rgb(255,255,255);" | Pointer to texture coordinates, counting from first byte of model
+
| | 0x00
| style="background:rgb(255,255,255);" | 4
+
| | BYTE
 +
| | U-Coordinate
 
|-
 
|-
| style="background:rgb(255,255,255);" | Pointer to the end of object, counting from first byte of model
+
| | 0x01
| style="background:rgb(255,255,255);" | 4
+
| | BYTE
 +
| | V-Coordinate
 
|}
 
|}

Latest revision as of 05:25, 23 May 2019

3D Model Header

Global header for the 3D model, one per model.
Size: 20 bytes


Offset Size 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.
Size: 4 bytes


Offset Size Description
0x00 24BIT Length
0x03 BYTE Parent Bone


Group Header

Global header for groups, one header per group.
Size: 40 bytes


Offset Size 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


Bone Data Chunk

Local group data for bones, one data chunk per bone of the group.
Size: 4 bytes


Offset Size Description
0x00 DWORD Number of vertices connected to the bone


Vertex Data Chunk

Local group data for vertices, one data chunk per vertex of the group.
Size: 8 bytes


Offset Size 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


Polygon Data Chunk

Local group data for polygons.
There are six different types of polygons, three types of polygons made out of four vertices (quadrangle) and three types of polygons made out of three vertices (triangle).


Quadrangle Type-A

Size: 24 bytes

Offset Size 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

Triangle Type-A

Size: 20 bytes

Offset Size Description
0x00 WORD Vertex index 1
0x02 WORD Vertex index 2
0x04 WORD Vertex index 3
0x06 BYTE Texture material index (Referenced to 0x12 chunk)
0x07 BYTE Unknown
0x08 24BIT Vertex colour (R8G8B8) ?
0x0B BYTE 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.
The number of texture mapping coordinates are: Number of quadrangle polygons (any type) * 4 + Number of triangle polygons (any type) * 3.
Size: 2 bytes


Offset Size Description
0x00 BYTE U-Coordinate
0x01 BYTE V-Coordinate