Difference between revisions of "FF8/FileFormat MCH"

From Final Fantasy Inside
< FF8
Jump to navigation Jump to search
my_wiki>Myst6re
m (7 revisions imported)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
<small>Authors: [[User:Koral|Koral]], [http://forums.qhimm.com/index.php?topic=6961.msg86318#msg86318 JWP] and [http://forums.qhimm.com/index.php?topic=13261.msg184344#msg184344 Vehek]</small>
 
<small>Authors: [[User:Koral|Koral]], [http://forums.qhimm.com/index.php?topic=6961.msg86318#msg86318 JWP] and [http://forums.qhimm.com/index.php?topic=13261.msg184344#msg184344 Vehek]</small>
  
= MCH Field Character Models =
+
= MCH Field Character Models =
  
Each MCH file contains a skinned-animated model representing a character on the field or world Maps.  
+
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.
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.  
+
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.
The whereabouts of the Bone Animation data is currently unknown.  
 
  
 +
<br />
  
= Accessing MCH Files =
+
= Accessing MCH Files =
  
 
<small>todo</small>
 
<small>todo</small>
  
 +
<br />
  
 +
=  MCH File Structure  =
  
= MCH File Structure =
+
==  Header  ==
  
== Header ==
+
0x100 bytes [256 bytes]
 +
 +
    DWORD: Offsets to multiple Texture-Data
 +
        Start: 0x00
 +
        Parse DWORDS until read value: 0xFFFFFFFF
 +
 +
    DWORD: Offset to Model Data
 +
   
  
<pre>
+
<br />
0x100 bytes [256 bytes]
 
  
    DWORD: Offsets to multiple Texture-Data
+
==  Texture-Data ==
        Start: 0x00
 
        Parse DWORDS until read value: 0xFFFFFFFF
 
  
    DWORD: Offset to Model Data
 
   
 
</pre>
 
   
 
 
== Texture-Data ==
 
 
[[PSX/TIM_format|TIM format]]
 
[[PSX/TIM_format|TIM format]]
  
<pre>
+
(for each Texture)
(for each Texture)
+
 +
    Standard [TIM] format textures
  
    Standard [TIM] format textures
+
<br />
</pre>
 
  
 +
==  Model-Data  ==
  
== Model-Data ==
+
{| class="wikitable"
 
+
! Offset
{| border="1" cellspacing="1" cellpadding="3" align="center" style="border: 1px solid black; border-collapse: collapse;"
+
! Length
! style="background:rgb(204,204,204)" | Offset
+
! Description
! style="background:rgb(204,204,204)" | Length
 
! style="background:rgb(204,204,204)" | Description
 
 
|-
 
|-
 
| 0x00
 
| 0x00
Line 73: Line 71:
 
| Number of Skin objects
 
| Number of Skin objects
 
|-
 
|-
|style="background:rgb(255,255,204)" | 0x18
+
| style="background: rgb(255,255,204)" | 0x18
|style="background:rgb(255,255,204)" | 4 bytes
+
| style="background: rgb(255,255,204)" | 4 bytes
|style="background:rgb(255,255,204)" | Unknown
+
| style="background: rgb(255,255,204)" | Unknown
 
|-
 
|-
 
| 0x1C
 
| 0x1C
Line 85: Line 83:
 
| Quad count
 
| Quad count
 
|-
 
|-
|style="background:rgb(255,255,204)" | 0x20
+
| 0x20
|style="background:rgb(255,255,204)" | 32 bytes
+
| 4 bytes
|style="background:rgb(255,255,204)" | Unknown
+
| Offset of bones
 +
|-
 +
| 0x24
 +
| 4 bytes
 +
| Offset of vertices
 +
|-
 +
| 0x28
 +
| 4 bytes
 +
| Offset of texture animations
 +
|-
 +
| 0x2C
 +
| 4 bytes
 +
| Offset of faces
 +
|-
 +
| style="background: rgb(255,255,204)" | 0x30
 +
| style="background: rgb(255,255,204)" | 4 bytes
 +
| style="background: rgb(255,255,204)" | Offset of unknown data
 +
|-
 +
| 0x34
 +
| 4 bytes
 +
| Offset of skin objects
 +
|-
 +
| 0x38
 +
| 4 bytes
 +
| Offset of animation data
 +
|-
 +
| style="background: rgb(255,255,204)" | 0x3C
 +
| style="background: rgb(255,255,204)" | 4 bytes
 +
| style="background: rgb(255,255,204)" | Unknown
 
|}
 
|}
  
<pre>
+
    Skeleton Data: 0x40 bytes per bone, recurse through number of bones dictated in Header
    Skeleton Data: 0x40 bytes per bone, recurse through number of bones dictated in Header
+
    (for each bone)
    (for each bone)
+
 
+
        SHORT: parent bone (1-based)
        SHORT: parent bone (1-based)
+
        SHORT:  (unknown)
        SHORT:  (unknown)
+
        DWORD:  (unknown)
        DWORD:  (unknown)
+
        SHORT: bone length
        SHORT: bone length
+
        DWORD * 15:  (unknown)
        DWORD * 15:  (unknown)
+
         
         
 
</pre>
 
 
 
<pre>
 
    Vertex Data:
 
    (for each vertex)
 
  
        SHORT * 3: Vertex XYZ Position
+
    Vertex Data:
        SHORT:  (unknown)
+
    (for each vertex)
        DWORD * 4:  (unknown)
+
         
+
        SHORT * 3: Vertex XYZ Position
</pre>
+
        SHORT:  (unknown)
 +
        DWORD * 4:  (unknown)
 +
         
  
<pre>
+
    Texture-animations Data:
    Texture-animations Data:
+
struct
struct
+
{
{
+
byte unknown
byte unknown
+
byte total_textures?
byte total_textures?
+
byte unknown
byte unknown
+
byte uSize
byte uSize
+
byte vSize
byte vSize
+
byte replacement_section_count
byte replacement_section_count
+
UV_pair original_area_coords
UV_pair original_area_coords
+
byte unknown[2]
byte unknown[2]
+
UV_pair replacement_coords[replacement_section_count]
UV_pair replacement_coords[replacement_section_count]
+
};
};
 
</pre>
 
  
<pre>
+
struct face {
struct face {
+
u32 opcode; 0x07060125 = triangle, 0907012d = Quad
u32 opcode; 0x07060125 = triangle, 0907012d = Quad
+
BYTE unk[4];
BYTE unk[4];
+
SHORT unknown; //When bit 0x04 is set, sets semitransparency
SHORT unknown; //When bit 0x04 is set, sets semitransparency
+
BYTE unk[2];
BYTE unk[2];
+
u16 verticies[4]; //vertex id's
u16 verticies[4]; //vertex id's
+
u16 verticies1[4]; //Edge data???
u16 verticies1[4]; //Edge data???
+
u32 Vertex_Colours[4];
u32 Vertex_Colours[4];
+
TextureMap TextureData[4]; // TextureMap = u16 with the first byte = u and the second byte = v
TextureMap TextureData[4]; // TextureMap = u16 with the first byte = u and the second byte = v
+
u16 Padding;
u16 Padding;
+
u16 textureIndex;
u16 textureIndex;
+
u32 padding[2];  
u32 padding[2];  
+
//64 bytes
//64 bytes
+
};
};
 
</pre>
 
  
<pre>
+
    Unknown Data, Seems to split up the skin-objects, triangles, and quads:
    Unknown Data, Seems to split up the skin-objects, triangles, and quads:
+
struct
struct
+
{
{
+
uint16 start_skinobject_index
uint16 start_skinobject_index
+
uint16 skinobject_count
uint16 skinobject_count
+
byte unknown[12]
byte unknown[12]
+
uint16 start_triangle_index
uint16 start_triangle_index
+
uint16 triangle_count
uint16 triangle_count
+
uint16 start_quad_index
uint16 start_quad_index
+
uint16 quad_count
uint16 quad_count
+
byte unknown2[8]
byte unknown2[8]
+
};
};
 
</pre>
 
 
 
<pre>
 
    Skin-Object Data:
 
    (for each skin-object)
 
 
 
        SHORT: index of first vertex
 
        SHORT: number of vertices
 
        SHORT: Bone ID (1-based)
 
        SHORT:  (unknown)
 
       
 
</pre>
 
  
 +
    Skin-Object Data:
 +
    (for each skin-object)
 +
 +
        SHORT: index of first vertex
 +
        SHORT: number of vertices
 +
        SHORT: Bone ID (1-based)
 +
        SHORT:  (unknown)
 +
       
  
 +
<br />
  
 
<small>todo: notes on skinning, animation data</small>
 
<small>todo: notes on skinning, animation data</small>
  
 
+
= MCH Model File List =
 
 
=MCH Model File List=
 
  
 
<small>todo</small>
 
<small>todo</small>

Latest revision as of 05:24, 23 May 2019

Authors: Koral, JWP and 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 4 bytes Offset of bones
0x24 4 bytes Offset of vertices
0x28 4 bytes Offset of texture animations
0x2C 4 bytes Offset of faces
0x30 4 bytes Offset of unknown data
0x34 4 bytes Offset of skin objects
0x38 4 bytes Offset of animation data
0x3C 4 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]
};
struct face {
	u32 opcode; 0x07060125 = triangle, 0907012d = Quad
	BYTE unk[4];
	SHORT unknown; //When bit 0x04 is set, sets semitransparency
	BYTE unk[2];
	u16 verticies[4]; //vertex id's
	u16 verticies1[4]; //Edge data???
	u32 Vertex_Colours[4];
	TextureMap TextureData[4]; // TextureMap = u16 with the first byte = u and the second byte = v
	u16 Padding;
	u16 textureIndex;
	u32 padding[2]; 
	//64 bytes
};
    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: index of first vertex
        SHORT: number of vertices
        SHORT: Bone ID (1-based)
        SHORT:   (unknown)
        


todo: notes on skinning, animation data

MCH Model File List

todo