GlitcherOG (talk | contribs) No edit summary |
GlitcherOG (talk | contribs) No edit summary |
||
Line 3: | Line 3: | ||
Here is the structure made in programming languages for easy code implementation: |
Here is the structure made in programming languages for easy code implementation: |
||
- [SSX Tricky mpf GO struct by Erick](<nowiki>https://github.com/Erickson400/TheTrickyModels/blob/main/mpf/MpfStructure.go</nowiki>) |
|||
- [SSX Tricky mpf C# handler by GlitcherOG](<nowiki>https://github.com/GlitcherOG/SSX-PS2-Collection-Modder/blob/main/FileHandlers/Models/TrickyMPFModelHandler.cs</nowiki>) |
- [SSX Tricky mpf C# handler by GlitcherOG](<nowiki>https://github.com/GlitcherOG/SSX-PS2-Collection-Modder/blob/main/FileHandlers/Models/TrickyMPFModelHandler.cs</nowiki>) |
||
- [SSX Tricky mpf GO struct by Erick](<nowiki>https://github.com/Erickson400/TheTrickyModels/blob/main/mpf/MpfStructure.go</nowiki>) |
|||
== Structure == |
== Structure == |
||
Line 103: | Line 103: | ||
All Offsets Unless Stated Otherwise are relative to the start of model data |
All Offsets Unless Stated Otherwise are relative to the start of model data |
||
==== Material Data ==== |
==== <u>Material Data</u> ==== |
||
Unused Slots use 0x00202020 as a place holder |
Unused Slots use 0x00202020 as a place holder |
||
{| class="wikitable" |
{| class="wikitable" |
||
Line 134: | Line 134: | ||
|} |
|} |
||
==== Bone Data ==== |
==== <u>Bone Data</u> ==== |
||
Location and Rotation are relative to parent |
Location and Rotation are relative to parent |
||
{| class="wikitable" |
{| class="wikitable" |
||
Line 161: | Line 161: | ||
|XYZ Radian Rotation of the bone |
|XYZ Radian Rotation of the bone |
||
|- |
|- |
||
|Vector 3 (3 |
|Vector 3 (3 Flo |
||
|}boots stick on |
|||
|XYZ Radian 2 |
|||
|- |
|||
|6 Float32s |
|||
|Contains 6 float values with either -1.0 or 1.0 |
|||
|} |
|||
==== IK Point (Inverse Kinematic) ==== |
|||
Inverse Kinematic Targets this is a list which usually contains 2 points boards use them so the character's boots stick on |
|||
{| class="wikitable" |
{| class="wikitable" |
||
|+ |
|+ |
||
Line 182: | Line 175: | ||
|} |
|} |
||
==== Group Main ==== |
==== <u>Group Main</u> ==== |
||
===== Group Main Header ===== |
===== Group Main Header ===== |
||
Line 241: | Line 234: | ||
|} |
|} |
||
==== <u>Bone Weight</u> ==== |
|||
<nowiki><br></nowiki> |
|||
Bone Weight |
|||
<nowiki>###</nowiki> Bone Weight Header |
|||
===== Bone Weight Header ===== |
|||
| Offset | Type | Description | Key | Rel | |
| Offset | Type | Description | Key | Rel | |
||
Line 257: | Line 247: | ||
| 0x08 | UInt32 | Unknown | | | |
| 0x08 | UInt32 | Unknown | | | |
||
===== Bone Weight ===== |
|||
<nowiki><br></nowiki> |
|||
<nowiki>###</nowiki> Bone Weight |
|||
| Offset | Type | Description | Key | Rel | |
| Offset | Type | Description | Key | Rel | |
||
Line 271: | Line 258: | ||
| 0x03 | UInt8 | Unknown | | | |
| 0x03 | UInt8 | Unknown | | | |
||
< |
==== <u>Number List Ref</u> ==== |
||
<nowiki>###</nowiki> Number List Ref Header |
|||
===== Number List Ref Header ===== |
|||
| Offset | Type | Description | Key | Rel | |
| Offset | Type | Description | Key | Rel | |
||
Line 285: | Line 271: | ||
<nowiki><br></nowiki> |
<nowiki><br></nowiki> |
||
===== Sub Number List Ref ===== |
|||
| Offset | Type | Description | Key | Rel | |
| Offset | Type | Description | Key | Rel | |
||
Line 297: | Line 282: | ||
<nowiki><br></nowiki> |
<nowiki><br></nowiki> |
||
<!-- |
|||
Row Count Header |
|||
Hex examples: |
|||
01000010 00000000 00000000 00000000 |
|||
^ 1 row |
|||
06000096 00000000 00000000 00000000 |
|||
^ 6 rows |
|||
--> |
|||
<!-- THIS IS ALSO A COMMENT |
|||
Model Data List[ |
|||
Model Data 1 [ |
|||
Material Data List[ |
|||
Material 1 |
|||
Material 2 |
|||
] |
|||
Bone Data List[ |
|||
Bone 1 |
|||
Bone 2 |
|||
] |
|||
Bone Weights List 1[ |
|||
] |
|||
Bone Weights List 2[ |
|||
] |
|||
Offsets/Count List[ |
|||
Offset/Count 1 List[ |
|||
] |
|||
Offset/Count 1 List[ |
|||
] |
|||
] |
|||
Mesh Data List[ |
|||
Mesh Data 1 List[ |
|||
Mesh 1 |
|||
Mesh 2 |
|||
] |
|||
Mesh Data 2 List[ |
|||
Mesh 1 |
|||
Mesh 2 |
|||
] |
|||
] |
|||
] |
|||
] |
|||
There's multiple mesh groups in the mesh section |
|||
Mesh Data List [ # the model's header leads here |
|||
Mesh Data 1 List [ # offset/count section leads here |
|||
Mesh 1 # mesh info, tristrips, uvs, nrm, vtx |
|||
Mesh 2 |
|||
etc... |
|||
] # footer Hex: 00000000 00000010 00000000 00000014 |
|||
Mesh Data 2 List[ # offset/count section leads here |
|||
Mesh 1 |
|||
etc... |
|||
] # footer Hex: 00000000 00000010 00000000 00000014 |
|||
Test |
|||
--> |
|||
<nowiki>##</nowiki> Mesh Data |
<nowiki>##</nowiki> Mesh Data |
Revision as of 07:28, 5 January 2023
Overview
An MPF file contains model names, bones, UV maps, normals, vertices and other model data.
Here is the structure made in programming languages for easy code implementation:
- [SSX Tricky mpf C# handler by GlitcherOG](https://github.com/GlitcherOG/SSX-PS2-Collection-Modder/blob/main/FileHandlers/Models/TrickyMPFModelHandler.cs)
- [SSX Tricky mpf GO struct by Erick](https://github.com/Erickson400/TheTrickyModels/blob/main/mpf/MpfStructure.go)
Structure
File Header
Section 0 - Bytes[12]
Type | Description |
---|---|
Byte[4] | Unknown (Possibly version or magic) |
UInt16 | Model Header Count |
UInt16 | Offset To Model Headers |
UInt32 | Offset To Model Data List Start |
Model Header
All Offsets Within the file are relative to the start of the Model Data
Type | Description |
---|---|
Bytes[16] | Name of Model (ASCII string with a max length of 16 bytes) |
UInt32 | Offset to Model Data which is relative to Model Data List Start Offset |
UInt32 | Size of model in bytes |
UInt32 | Offset of **Bone Data List** |
UInt32 | Offset of **IK Point List** |
UInt32 | Offset of **Mesh Group Offset** |
UInt32 | Offset of **Mesh Data** |
UInt32 | Offset Of **Material Data** |
UInt32 | Offset of Weight List Reference |
UInt32 | Offset of Bone Weights |
UInt32 | Unknown (Unused/Filler) |
UInt32 | Unknown (Unused/Filler) |
UInt16 | Num of Bone Weights |
UInt16 | Num of Weight List Refrence |
UInt16 | Num Of Mesh Groups |
UInt16 | Num Of Bone Data |
UInt16 | Num Of Materials |
UInt16 | Num Of IK Points |
UInt16 | Num Of Morph Keys |
UInt16 | Internal File ID. This is used in conjunction with weights so that it can access bones within another file |
UInt32 | Filler/Padding |
Model Data
All Offsets Unless Stated Otherwise are relative to the start of model data
Material Data
Unused Slots use 0x00202020 as a place holder
Type | Description |
---|---|
Bytes[4] | Name of Main Texture map/file |
Bytes[4] | Name/Type of Texture (Unused In PS2) |
Bytes[4] | Name/Type of Texture (Unused In PS2) |
Bytes[4] | Name/Type of Texture (Unused In PS2) |
Bytes[4] | Name/Type of Texture (Unused In PS2) |
Float32 | Unknown float value |
Float32 | Unknown float value |
Float32 | Unknown float value |
Bone Data
Location and Rotation are relative to parent
Type | Description |
---|---|
Bytes[16] | Name of Bone (ASCII string with a maximum length of 16 bytes) |
UInt16 | Internal File ID of Parent Bone(First bone always has 0xFFFF) |
UInt16 | ID of Parent Bone (First bone always has 0xFFFF) |
UInt16 | Bone ID (?) |
UInt16 | Unknown |
Vector 3 (3 Float32s) | XYZ Position Of the Bone |
Vector 3 (3 Float32s) | XYZ Radian Rotation of the bone |
Vector 3 (3 Flo |
boots stick on
Type | Description |
---|---|
Vector 3 (3 Float32s) | Location XYZ |
UInt32 | Unknown (Filler) |
Group Main
Group Main Header
Type | Description |
---|---|
UInt32 | ID (?) |
UInt32 | Material ID |
UInt32 | Unknown |
UInt32 | Sub Group Offset |
UInt32 | Sub Group Count |
Sub Group
Type | Description |
---|---|
UInt32 | Mesh Group Offset |
UInt32 | Mesh Group Count |
| Offset | Type | Description | Key | Rel |
|-------- |-------- |---------------------- |----- |----- |
| 0x00 | UInt32 | Mesh Group Offset | | |
| 0x04 | UInt32 | Mesh Group Count | | |
Mesh/Morph Data Group
Type | Description |
---|---|
UInt32 | Model Offset |
UInt32 | Morph Target Offset Relative to Model Offset |
UInt32 | Morph Target Entry Size |
Bone Weight
Bone Weight Header
| Offset | Type | Description | Key | Rel |
|--------|--------|----------------------------|-----|-----|
| 0x00 | UInt32 | Length of array/list | | |
| 0x04 | UInt32 | Offset to Bone weight list | | |
| 0x08 | UInt32 | Unknown | | |
Bone Weight
| Offset | Type | Description | Key | Rel |
|--------|--------|------------------------|-----|-----|
| 0x00 | UInt16 | Bone weight (0 to 100) | | |
| 0x02 | UInt8 | Bone ID | | |
| 0x03 | UInt8 | Unknown | | |
Number List Ref
Number List Ref Header
| Offset | Type | Description | Key | Rel |
|--------|--------|-----------------------------|-----|-----|
| 0x00 | UInt32 | Sub Number List Ref Count | | |
| 0x04 | UInt32 | Sub Number List Ref Offset | | |
<br>
Sub Number List Ref
| Offset | Type | Description | Key | Rel |
|--------|--------|------------------------|-----|-----|
| | UInt16 | Unknown | | |
| | UInt16 | Unknown2 | | |
<br>
## Mesh Data
| Offset | Type | Description | Key |
|--------|-----------|-----------------------------------------------------------------------------------------------------------------|-----|
| 0x00 | UInt24 | Count of total rows | |
| 0x03 | Byte | Size of individual rows (Always 16) | |
| 0x04 | Bytes[12] | Unknown (Filler/Padding) | |
| 0x10 | Bytes[13] | Unknown (Always 0x00000000010100010000000000) | |
| 0x1D | Byte | Prefix of count (0x80) | |
| 0x1E | Byte | Count of total mesh info rows (sum of the amount of mesh info rows and the amount of triangle strip count rows) | |
| 0x1F | Byte | Suffix of count (0x6c) | |
| 0x20 | Bytes[16] | Mesh Info Row 1 | |
| 0x30 | Bytes[16] | Mesh Info Row 2 | |
| | List | List of Triangle Strip Count Rows | |
- **Triangle Strip Count Row**
The amount of triangle strip rows can be found inside Mesh Info Row 2 <br>
_First type is assumed to be either UInt32 or Byte_
| Type | Description |
|-----------|-----------------------------------------|
| UInt32 | Count of vertices |
| Bytes[12] | Padding/Unknown |
_mesh data continued:_
| Type | Description |
|-----------|-----------------------------------------|
| UInt24 | Count of rows |
| Byte | Unknown (Always 16) |
| Bytes[12] | Unknown |
| List | UV Block |
| List | Normal Block |
| List | Vertex Block |
<br>
## UV Block
| Type | Desc | Key |
|-----------|----------------------------------------------------------------|-----|
| Bytes[16] | Header of UV Block (Hex: 00100000 00100000 00000020 50505050) | |
| Bytes[12] | Unknown | |
| Byte | Unknown | |
| Byte | Prefix of UV count (0x80) | |
| Byte | Count of UVs | |
| Byte | Suffix of UV count (0x6D) | |
| List | List of UV values | |
**UV value**
| Type | Description |
|-----------|-----------------------------------------|
| UInt16 | UV map U (X translation) |
| UInt16 | UV map V (Y translation) |
| UInt16 | UV map U distance |
| UInt16 | UV map V distance |
<br>
## Normal Block
| Type | Desc | Key |
|-----------|-------------------------------------------------------------------|-----|
| Bytes[16] | Header of normal Block (Hex: 00000000 00800000 00000020 40404040) | |
| Bytes[12] | Unknown | |
| Byte | Unknown | |
| Byte | Prefix of Normal Count (0x80) | |
| Byte | Count of Normals | |
| Byte | Suffix of Normal count (0x79) | |
| List | List Normal values | |
**Normal value:**
| Type | Description |
|-----------|-------------------------------|
| UInt16 | Normal X direction |
| UInt16 | Normal Y direction |
| UInt16 | Normal Z direction |
<br>
## Vertex Block
| Type | Desc | Key |
|-----------|-------------------------------------------------------------------|-----|
| Bytes[16] | Header of Vertex Block (Hex: 00000000 0000803F 00000020 40404040) | |
| Bytes[12] | Unknown | |
| Byte | Unknown | |
| Byte | Prefix of Vertex count (0x80) | |
| Byte | Count of Vertices | |
| Byte | Suffix of Vertex count (0x78) | |
| List | List Vertex values | |
**Vertex value:**
| Type | Description |
|-----------|-------------------------------|
| Float32 | Location X |
| Float32 | Location Y |
| Float32 | Location Z |
## Shadow Vertex Block
| Type | Desc | Key |
|-----------|-------------------------------------------------------------------|-----|
| Bytes[16] | Header of Vertex Block (Hex: 00000000 0000803F 00000020 40404040) | |
| Bytes[12] | Unknown | |
| Byte | Unknown | |
| Byte | Prefix of Vertex count (0x80) | |
| Byte | Count of Vertices | |
| Byte | Suffix of Vertex count (0x6C) | |
| List | List Vertex values | |
**Vertex value:**
| Type | Description |
|-----------|-------------------------------|
| Float32 | Location X |
| Float32 | Location Y |
| Float32 | Location Z |
| UInt32 | Unknown |
<br>
***
<br>
**End of MPF Structure**
<br>