Difference between revisions of "FF8/FileFormat MCH"

From Final Fantasy Inside
< FF8
Jump to navigation Jump to search
my_wiki>Koral
 
my_wiki>Myst6re
Line 1: Line 1:
<small>Last Update: [[User:Koral|Koral]] 18:21, 24 May 2009 (EDT)</small>
+
<small>Authors: [[User:Koral|Koral]], [http://forums.qhimm.com/index.php?topic=13261.msg184344#msg184344 Vehek]</small>
  
 
= MCH Field Character Models =
 
= MCH Field Character Models =
Line 19: Line 19:
  
 
== Header ==
 
== Header ==
 +
 
<pre>
 
<pre>
 
0x100 bytes [256 bytes]
 
0x100 bytes [256 bytes]
Line 32: Line 33:
  
 
== Texture-Data ==
 
== Texture-Data ==
 +
[http://wiki.qhimm.com/PSX/TIM_format TIM format]
 +
 
<pre>
 
<pre>
 
(for each Texture)
 
(for each Texture)
Line 40: Line 43:
  
 
== Model-Data ==
 
== Model-Data ==
<pre>
 
    Header: 0x40 bytes (64)
 
 
        DWORD: number of Skeleton Bones
 
        DWORD: number of Vertices
 
        DWORD:  (unknown)
 
        DWORD: number of Faces
 
        DWORD:  (unknown)
 
        DWORD: number of Skin objects
 
  
        DWORD * 10:   (unknown)
+
{| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;"
 
+
! style="background:rgb(204,204,204)" | Offset
</pre>
+
! style="background:rgb(204,204,204)" | Length
 +
! style="background:rgb(204,204,204)" | Description
 +
|-
 +
| 0x00
 +
| 4 bytes
 +
| Number of Skeleton Bones
 +
|-
 +
| 0x04
 +
| 4 bytes
 +
| Number of Vertices
 +
|-
 +
| 0x08
 +
| 4 bytes
 +
| Number of texture animations
 +
|-
 +
| 0x0C
 +
| 4 bytes
 +
| Number of Faces
 +
|-
 +
| 0x10
 +
| 4 bytes
 +
| Number of Unknown data
 +
|-
 +
| 0x14
 +
| 4 bytes
 +
| Number of Skin objects
 +
|-
 +
|style="background:rgb(255,255,204)" | 0x18
 +
|style="background:rgb(255,255,204)" | 4 bytes
 +
|style="background:rgb(255,255,204)" | Unknown
 +
|-
 +
| 0x1C
 +
| 2 bytes
 +
| Triangle count
 +
|-
 +
| 0x1E
 +
| 2 bytes
 +
| Quad count
 +
|-
 +
|style="background:rgb(255,255,204)" | 0x20
 +
|style="background:rgb(255,255,204)" | 32 bytes
 +
|style="background:rgb(255,255,204)" | Unknown
 +
|}
  
 
<pre>
 
<pre>
Line 67: Line 103:
  
 
<pre>
 
<pre>
     Vertex Data:  
+
     Vertex Data:
 
     (for each vertex)
 
     (for each vertex)
  
Line 77: Line 113:
  
 
<pre>
 
<pre>
     Face Data:  
+
    Texture-animations Data:
 +
struct
 +
{
 +
byte unknown
 +
byte total_textures?
 +
byte unknown
 +
byte uSize
 +
byte vSize
 +
byte replacement_section_count
 +
UV_pair original_area_coords
 +
byte unknown[2]
 +
UV_pair replacement_coords[replacement_section_count]
 +
}
 +
</pre>
 +
 
 +
<pre>
 +
     Face Data:
 
     (for each face)
 
     (for each face)
  
Line 83: Line 135:
 
         BYTE * 3:    (unknown)
 
         BYTE * 3:    (unknown)
 
         BYTE:  Polygon Type [0x2d = Quad, 0x25 = Triangle]
 
         BYTE:  Polygon Type [0x2d = Quad, 0x25 = Triangle]
         DWORD * 2:  (unknown)
+
        SHORT: When bit 0x04 set, face has semi-transparency
 +
        SHORT:    (unknown)
 +
         DWORD:  (unknown)
 
         SHORT * 4: Indices per Face-Vertex
 
         SHORT * 4: Indices per Face-Vertex
 
         SHORT * 4:  (unknown)
 
         SHORT * 4:  (unknown)
Line 90: Line 144:
 
         DWORD * 12:  (unknown)
 
         DWORD * 12:  (unknown)
 
    
 
    
 +
</pre>
 +
 +
<pre>
 +
    Unknown Data, Seems to split up the skin-objects, triangles, and quads:
 +
struct
 +
{
 +
uint16 start_skinobject_index
 +
uint16 skinobject_count
 +
byte unknown[12]
 +
uint16 start_triangle_index
 +
uint16 triangle_count
 +
uint16 start_quad_index
 +
uint16 quad_count
 +
byte unknown2[8]
 +
}
 
</pre>
 
</pre>
  

Revision as of 18:00, 1 July 2012

Authors: Koral, Vehek

MCH Field Character Models

Each MCH file contains a skinned-animated model representing a character on the field or world Maps. There appear to be multiple files of the same character representing differnt Level of Details.

They usually contain multiple TIM textures (standard PSX textures), mesh geometry, bones, skeleton heirarchy information and skinning information. The whereabouts of the Bone Animation data is currently unknown.


Accessing MCH Files

todo


MCH File Structure

Header

0x100 bytes [256 bytes]

    DWORD: Offsets to multiple Texture-Data
        Start: 0x00
        Parse DWORDS until read value: 0xFFFFFFFF

    DWORD: Offset to Model Data
    


Texture-Data

TIM format

(for each Texture)

    Standard [TIM] format textures


Model-Data

Offset Length Description
0x00 4 bytes Number of Skeleton Bones
0x04 4 bytes Number of Vertices
0x08 4 bytes Number of texture animations
0x0C 4 bytes Number of Faces
0x10 4 bytes Number of Unknown data
0x14 4 bytes Number of Skin objects
0x18 4 bytes Unknown
0x1C 2 bytes Triangle count
0x1E 2 bytes Quad count
0x20 32 bytes Unknown
    Skeleton Data: 0x40 bytes per bone, recurse through number of bones dictated in Header
    (for each bone)

        SHORT: parent bone (1-based)
        SHORT:   (unknown)
        DWORD:   (unknown)
        SHORT: bone length
        DWORD * 15:   (unknown)
          
    Vertex Data:
    (for each vertex)

        SHORT * 3: Vertex XYZ Position
        SHORT:   (unknown)
        DWORD * 4:   (unknown)
          
    Texture-animations Data:
struct
{
	byte unknown
	byte total_textures?
	byte unknown
	byte uSize
	byte vSize
	byte replacement_section_count
	UV_pair original_area_coords
	byte unknown[2]
	UV_pair replacement_coords[replacement_section_count]
}
    Face Data:
    (for each face)

        DWORD:   (unknown)
        BYTE * 3:    (unknown)
        BYTE:  Polygon Type [0x2d = Quad, 0x25 = Triangle]
        SHORT: When bit 0x04 set, face has semi-transparency
        SHORT:    (unknown)
        DWORD:   (unknown)
        SHORT * 4: Indices per Face-Vertex
        SHORT * 4:   (unknown)
        BYTE * 4 * 4: Vertex Colour (RGBA) per Face-Vertex
        BYTE * 2 * 4: Vertex UV, (1st byte U, 2nd byte V) per Face-Vertex
        DWORD * 12:  (unknown)
  
    Unknown Data, Seems to split up the skin-objects, triangles, and quads:
struct
{
	uint16 start_skinobject_index
	uint16 skinobject_count
	byte unknown[12]
	uint16 start_triangle_index
	uint16 triangle_count
	uint16 start_quad_index
	uint16 quad_count
	byte unknown2[8]
}
    Skin-Object Data: 
    (for each skin-object)

        SHORT: Bone ID (1-based)
        SHORT:   (unknown)
        SHORT: index of first vertex
        SHORT: number of vertices
        


todo: notes on skinning, animation data


MCH Model File List

todo