GlitcherOG (talk | contribs) No edit summary |
GlitcherOG (talk | contribs) No edit summary |
||
Line 188: | Line 188: | ||
|- |
|- |
||
|UInt32 |
|UInt32 |
||
|Group Type (1 Standard, 17 Shadow, 256 Morph) |
|||
|ID (?) |
|||
|- |
|- |
||
|UInt32 |
|UInt32 |
||
Line 215: | Line 215: | ||
|} |
|} |
||
==== Mesh/Morph Data Group ==== |
==== Mesh/Morph Data Group ==== |
||
Each one of these in order references a Weight Reference and all points within it will use that weight reference |
|||
{| class="wikitable" |
{| class="wikitable" |
||
!Type |
!Type |
||
Line 277: | Line 278: | ||
==== <u>Mesh Data</u> ==== |
==== <u>Mesh Data</u> ==== |
||
The mesh data within the mpf can be very complex and is chunked meaning there can be multiple data chunks within a Mesh/Morph Data Group |
|||
Depending on the group type (Located in the mesh group) can effect what information is in here. |
|||
* If Group Type is Standard there will be UV/Weight Block, Normal Block and, Vertex Block. |
|||
* If Group Type is Shadow There will be Shadow Vertex Block |
|||
* If Group Type is Morph the data will be the same as standard however there will be no data chunking |
|||
Bytes[48] Unimportant Data for Exporting |
Bytes[48] Unimportant Data for Exporting |
||
{| class="wikitable" |
{| class="wikitable" |
||
Line 289: | Line 298: | ||
|- |
|- |
||
|UInt32 |
|UInt32 |
||
|Unknown2 (If group type is shadow this will be 0) |
|||
|Unknown1 (Seems to have some relation to Normals) |
|||
|- |
|- |
||
|UInt32 |
|UInt32 |
||
Line 295: | Line 304: | ||
|} |
|} |
||
===== Tristrip Data ===== |
|||
{| class="wikitable" |
|||
!Type |
|||
!Description |
|||
|- |
|||
|UInt32 |
|||
|Count of vertices |
|||
|- |
|||
|Bytes[12] |
|||
|Padding |
|||
|} |
|||
==== UV/Weight Block ==== |
|||
{| class="wikitable" |
|||
!Type |
|||
!Description |
|||
|- |
|||
|Bytes[16] |
|||
|Header of UV Block (Hex: 00100000 00100000 00000020 50505050) |
|||
|- |
|||
|Bytes[12] |
|||
|Unknown |
|||
|- |
|||
|Byte |
|||
|Unknown |
|||
|- |
|||
|Byte |
|||
|Prefix List Start (0x80) |
|||
|- |
|||
|Byte |
|||
|Count of UVs |
|||
|- |
|||
|Byte |
|||
|Suffix of UV count (0x6D) |
|||
|- |
|||
|List of '''''UV value''''' |
|||
|List Of UV/Weights Values |
|||
|} |
|||
'''''UV value''''' |
|||
{| class="wikitable" |
|||
!Type |
|||
!Description |
|||
|- |
|||
|UInt16 |
|||
|UV map U (X translation) (In order to get the float value you do Number / 4096) |
|||
|- |
|||
|UInt16 |
|||
|UV map V (Y translation) (In order to get the float value you do Number / 4096) |
|||
|- |
|||
|UInt16 |
|||
|Bone Weight Ref ID (In order to get ID you do (Number - 14)/4) |
|||
|- |
|||
|Uint16 |
|||
|Bone Weight Ref ID (In order to get ID you do ???) |
|||
|} |
|||
===== Normal Block ===== |
|||
- **Triangle Strip Count Row** |
|||
{| class="wikitable" |
|||
!Type |
|||
!Description |
|||
|- |
|||
|Bytes[16] |
|||
|Header of normal Block (Hex: 00000000 00800000 00000020 40404040) |
|||
|- |
|||
|Bytes[12] |
|||
|Unknown |
|||
|- |
|||
|Byte |
|||
|Unknown |
|||
|- |
|||
|Byte |
|||
|Prefix List Start (0x80) |
|||
|- |
|||
|Byte |
|||
|Count of Normals |
|||
|- |
|||
|Byte |
|||
|Suffix of Normal count (??) |
|||
|- |
|||
|List of Vector 3 (3 Int16s) |
|||
|List of normals (In order to get the float value you do Number / 4096(???)) |
|||
|} |
|||
==== Vertex Block ==== |
|||
The amount of triangle strip rows can be found inside Mesh Info Row 2 |
|||
{| class="wikitable" |
|||
!Type |
|||
!Description |
|||
|- |
|||
|Bytes[16] |
|||
|Header of Vertex Block (Hex: 00000000 0000803F 00000020 40404040) |
|||
|- |
|||
|Bytes[12] |
|||
|Unknown |
|||
|- |
|||
|Byte |
|||
|Unknown |
|||
|- |
|||
|Byte |
|||
|Prefix List Start (0x80) |
|||
|- |
|||
|Byte |
|||
|Count of Vertices |
|||
|- |
|||
|Byte |
|||
|Suffix of Vertex count (0x78) |
|||
|- |
|||
|List of Vector 3 (3 Float32) |
|||
|List Of Vertex values |
|||
|} |
|||
==== Shadow Vertex Block ==== |
|||
_First type is assumed to be either UInt32 or Byte_ |
|||
{| class="wikitable" |
|||
!Type |
|||
| Offset | Type | Description | Key | |
|||
!Description |
|||
|- |
|||
|--------|-----------|-----------------------------------------------------------------------------------------------------------------|-----| |
|||
|Bytes[16] |
|||
|Header of Vertex Block (Hex: 00000000 0000803F 00000020 40404040) |
|||
| 0x00 | UInt24 | Count of total rows | | |
|||
|- |
|||
|Bytes[12] |
|||
| 0x03 | Byte | Size of individual rows (Always 16) | | |
|||
|Unknown |
|||
|- |
|||
| 0x04 | Bytes[12] | Unknown (Filler/Padding) | | |
|||
|Byte |
|||
|Unknown |
|||
| 0x10 | Bytes[13] | Unknown (Always 0x00000000010100010000000000) | | |
|||
|- |
|||
|Byte |
|||
| 0x1D | Byte | Prefix of count (0x80) | | |
|||
|Prefix List Start (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) | | |
|||
|Byte |
|||
|Count of Vertices |
|||
| 0x1F | Byte | Suffix of count (0x6c) | | |
|||
|- |
|||
|Byte |
|||
| 0x20 | Bytes[16] | Mesh Info Row 1 | | |
|||
|Suffix of Vertex count (??) |
|||
|- |
|||
| 0x30 | Bytes[16] | Mesh Info Row 2 | | |
|||
|List of '''''Shadow Vertex''''' |
|||
|List Of Shadow Vertex values |
|||
| | List | List of Triangle Strip Count Rows | | |
|||
|} |
|||
'''''Shadow Vertex value''''' |
|||
{| class="wikitable" |
|||
| Type | Description | |
|||
!Type |
|||
!Description |
|||
|-----------|-----------------------------------------| |
|||
|- |
|||
|Vector 3 (3 Float32) |
|||
| UInt32 | Count of vertices | |
|||
|Location XYZ |
|||
|- |
|||
| Bytes[12] | Padding/Unknown | |
|||
|Uint16 |
|||
|Bone Weight Ref ID (In order to get ID you do (Number - 14)/4) |
|||
_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 | |
|||
<nowiki><br></nowiki> |
|||
<nowiki>##</nowiki> 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 | | |
|||
<nowiki>**</nowiki>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 | |
|||
<nowiki><br></nowiki> |
|||
<nowiki>##</nowiki> 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 | | |
|||
<nowiki>**</nowiki>Normal value:** |
|||
| Type | Description | |
|||
|-----------|-------------------------------| |
|||
| UInt16 | Normal X direction | |
|||
| UInt16 | Normal Y direction | |
|||
| UInt16 | Normal Z direction | |
|||
<nowiki><br></nowiki> |
|||
<nowiki>##</nowiki> 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 | | |
|||
<nowiki>**</nowiki>Vertex value:** |
|||
| Type | Description | |
|||
|-----------|-------------------------------| |
|||
| Float32 | Location X | |
|||
| Float32 | Location Y | |
|||
| Float32 | Location Z | |
|||
<nowiki>##</nowiki> 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 | | |
|||
<nowiki>**</nowiki>Vertex value:** |
|||
| Type | Description | |
|||
|-----------|-------------------------------| |
|||
| Float32 | Location X | |
|||
| Float32 | Location Y | |
|||
| Float32 | Location Z | |
|||
| UInt32 | Unknown | |
|||
<nowiki><br></nowiki> |
|||
<nowiki>***</nowiki> |
|||
<nowiki><br></nowiki> |
|||
<nowiki>**</nowiki>End of MPF Structure** |
|||
<nowiki><br></nowiki> |
Revision as of 09:03, 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 Float32s) | XYZ Radian 2 |
6 Float32s | 6 Floats either being -1 or 1 |
IK Points
Type | Description |
---|---|
Vector 3 (3 Float32s) | Location XYZ |
UInt32 | Unknown (Filler) |
Group Main
Group Main Header
Type | Description |
---|---|
UInt32 | Group Type (1 Standard, 17 Shadow, 256 Morph) |
UInt32 | Material ID |
UInt32 | Unknown (Always -1) |
UInt32 | Sub Group Offset |
UInt32 | Sub Group Count |
Sub Group
Type | Description |
---|---|
UInt32 | Mesh Group Offset |
UInt32 | Mesh Group Count |
Mesh/Morph Data Group
Each one of these in order references a Weight Reference and all points within it will use that weight reference
Type | Description |
---|---|
UInt32 | Model Offset |
UInt32 | Morph Target Offset Relative to Model Offset |
UInt32 | Morph Target Entry Size |
Bone Weight
Bone Weight Header
Type | Description |
---|---|
UInt32 | Length of array/list |
UInt32 | Offset to Bone weight list |
UInt32 | Unknown (Always 36) |
Bone Weight
Type | Description |
---|---|
UInt16 | Bone weight (0 to 100) |
UInt16 | Bone ID |
UInt16 | Bone Internal File ID |
Weight List Ref
Type | Description |
---|---|
UInt32 | Weight Reference Count |
UInt32 | Weight Reference Offset |
Int32 List | WeightIDs |
Mesh Data
The mesh data within the mpf can be very complex and is chunked meaning there can be multiple data chunks within a Mesh/Morph Data Group
Depending on the group type (Located in the mesh group) can effect what information is in here.
- If Group Type is Standard there will be UV/Weight Block, Normal Block and, Vertex Block.
- If Group Type is Shadow There will be Shadow Vertex Block
- If Group Type is Morph the data will be the same as standard however there will be no data chunking
Bytes[48] Unimportant Data for Exporting
Type | Description |
---|---|
UInt32 | Strip Count |
UInt32 | Unknown1 |
UInt32 | Unknown2 (If group type is shadow this will be 0) |
UInt32 | Vertex Count |
Tristrip Data
Type | Description |
---|---|
UInt32 | Count of vertices |
Bytes[12] | Padding |
UV/Weight Block
Type | Description |
---|---|
Bytes[16] | Header of UV Block (Hex: 00100000 00100000 00000020 50505050) |
Bytes[12] | Unknown |
Byte | Unknown |
Byte | Prefix List Start (0x80) |
Byte | Count of UVs |
Byte | Suffix of UV count (0x6D) |
List of UV value | List Of UV/Weights Values |
UV value
Type | Description |
---|---|
UInt16 | UV map U (X translation) (In order to get the float value you do Number / 4096) |
UInt16 | UV map V (Y translation) (In order to get the float value you do Number / 4096) |
UInt16 | Bone Weight Ref ID (In order to get ID you do (Number - 14)/4) |
Uint16 | Bone Weight Ref ID (In order to get ID you do ???) |
Normal Block
Type | Description |
---|---|
Bytes[16] | Header of normal Block (Hex: 00000000 00800000 00000020 40404040) |
Bytes[12] | Unknown |
Byte | Unknown |
Byte | Prefix List Start (0x80) |
Byte | Count of Normals |
Byte | Suffix of Normal count (??) |
List of Vector 3 (3 Int16s) | List of normals (In order to get the float value you do Number / 4096(???)) |
Vertex Block
Type | Description |
---|---|
Bytes[16] | Header of Vertex Block (Hex: 00000000 0000803F 00000020 40404040) |
Bytes[12] | Unknown |
Byte | Unknown |
Byte | Prefix List Start (0x80) |
Byte | Count of Vertices |
Byte | Suffix of Vertex count (0x78) |
List of Vector 3 (3 Float32) | List Of Vertex values |
Shadow Vertex Block
Type | Description |
---|---|
Bytes[16] | Header of Vertex Block (Hex: 00000000 0000803F 00000020 40404040) |
Bytes[12] | Unknown |
Byte | Unknown |
Byte | Prefix List Start (0x80) |
Byte | Count of Vertices |
Byte | Suffix of Vertex count (??) |
List of Shadow Vertex | List Of Shadow Vertex values |
Shadow Vertex value
Type | Description |
---|---|
Vector 3 (3 Float32) | Location XYZ |
Uint16 | Bone Weight Ref ID (In order to get ID you do (Number - 14)/4) |