MT7
MT7 is an model container format for Shenmue II.
There are 4 different types of MT7 files (MDCX/7, MDPX/7, MDOX/7, MDLX/7) which are very similar.
The model format is based on an node based hierarchy tree.
For an C# implementation based on this documentation look here.
Header
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (MDCX, MDPX, ...) |
0x04 | 0x04 | uint | Size in bytes |
0x08 | 0x04 | uint | First node offset |
0x0C | 0x04 | uint | Texture count |
Texture Entry List
After the header there is an optional texture entry list when the model uses textures.
These texture entries are used to list all textures the model uses which can be in the TXT7 section or even somewhere else.
Example: For the map files there is an PKS which holds the meshes and some other files, each PKS has an PKF which holds the textures for the models inside the PKS.
Texture Entry
Each entry has an texture ID/Name after the texture entries.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x02 | ushort | Width |
0x02 | 0x02 | ushort | Height |
0x04 | 0x04 | ? | Unknown |
0x08 | 0x04 | ? | Unknown |
0x0C | 0x04 | ? | Index? |
Texture ID/Name
The ID and the name are used to uniquely identify the texture.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | ID? |
0x04 | 0x04 | string | Name? |
Node Location Dictionary
After the texture entry list there is an dictionary with all the offsets to the nodes.
The use is not clear of this dictionary. Possible usage could be an fast view of the hierarchy without parsing the nodes or maybe for rigging.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | Offset |
MT7 Node
Each node holds the hierarchy information and transform values.
Not all nodes have to contain an offset to any mesh data but they still can have an effect on the child nodes meshes with their transform values.
That means every child goes up the hierarchy tree and applies the transform values of the parents (and it's own of course).
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | ID |
0x04 | 0x0C | float | Position/Translate (X, Y, Z) |
0x10 | 0x0C | short | Rotation (X, Y, Z) |
0x1C | 0x0C | float | Scale (X, Y, Z) |
0x28 | 0x04 | uint | XB01 Offset |
0x2C | 0x04 | uint | Child Offset |
0x30 | 0x04 | uint | Sibling Offset |
0x34 | 0x04 | uint | Parent Offset |
0x38 | 0x08 | ? | Reserved |
Hierarchy
├ Parent
├── Child
├── Sibling
General Node IDs
ID | Description |
---|---|
65535 | Static mesh (casting shadows?) |
5000 | Cloth (for interacting with wind physics) |
458751 | Mostly shadow |
Char Node IDs
ID | Description |
---|---|
1 | Upper torso (Root) |
5 | Right upper arm (includes shoulder) |
6 | Right middle arm |
7 | Right lower arm |
65471 | Right hand |
25 | Right thumb |
28 | Right index finger upper |
29 | Right index finger lower |
31 | Right fingers upper |
32 | Right fingers lower |
10 | Left upper arm (includes shoulder) |
11 | Left middle arm |
12 | Left lower arm |
65470 | Left hand |
40 | Left thumb |
43 | Left index finger upper |
44 | Left index finger lower |
46 | Left fingers upper |
47 | Left fingers lower |
14 | Lower torso |
16 | Right upper leg |
17 | Right lower leg |
18 | Right foot |
19 | Right foot tip |
21 | Left upper leg |
22 | Left lower leg |
23 | Left foot |
24 | Left foot tip |
70 | Head |
81 | Right eye |
82 | Left eye |
65445 | Top hair |
65446 | Back hair |
65455 | Jacket collision |
65456 | Jacket |
MDCX/7
The MDCX or MDC7 files are mainly used for character models. These files do have special sub nodes that extend the base node.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (MDCX) |
0x04 | 0x40 | float | 4x4 Matrix |
0x44 | 0x04 | uint | Entry count |
0x48 | 0x0? | ? | Entries |
MDCX/7 Entry
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | ? | ? |
0x04 | 0x04 | ? | ? |
MDPX/7
The MDCX or MDC7 files are mainly used for prop models. These files do have special sub nodes that extend the base node.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (MDPX) |
0x04 | 0x04 | uint | Size in bytes |
0x08 | 0x04 | string | Name? |
0x0C | 0x0? | ? | Data |
MDOX/7
The MDOX or MDO7 files are mainly used for map geometry. These files do not have any special sub node.
MDLX/7
THe MDLX or MDL7 files are mainly used for map geometry. These files do not have any special sub node.
MDH7
Unknown node found only on Dreamcast.
XB01
The XB01 sections hold the mesh data (vertices, strips and material metadata).
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (XB01) |
0x04 | 0x04 | ? | Unknown |
0x08 | 0x0C | float | Mesh center (X, Y, Z) |
0x14 | 0x04 | float | Mesh radius |
0x18 | 0x04 | uint | First instruction entry offset |
0x1C | 0x04 | uint | Vertices offset |
Intructions
These instructions are state machine like. Each instruction changes the state of how to render the strip.
Each instructions consists out of an 1 byte identifier and 1-2 bytes as the size of the instructions in words(2 bytes) including itself.
Group
An group can hold multiple instructions. The reason for grouping is unknown.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | ID |
0x04 | 0x04 | uint | Group size in bytes |
0x08 | 0x08 | ? | Unknown |
Floats (0x04)
Unknown floats.
Texture (0x0B)
Sets the texture to use for the next instructions.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | Texture count |
Texture Attributes (0x0D)
Sets the texture attributes to use for the next instructions. Example: Transparency, Texture Wrapping, Unlit, ...
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | Attribute count |
Strip (0x10)
Draws an strip with the given vertex indices.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | Primitiv type? (Triangles or Triangle strip) |
0x00 | 0x04 | uint | Vertex index count |
Vertices
Header
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | ? | Unknown |
0x04 | 0x04 | ? | Unknown |
0x08 | 0x02 | ushort | Vertex size in bytes |
0x0A | 0x02 | ? | Unknown |
0x0C | 0x04 | uint | Vertex count |
Vertex
Example vertex with an size of 32 bytes.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x0C | float | Position (X, Y, Z) |
0x0C | 0x0C | float | Normals (X, Y, Z) |
0x18 | 0x08 | float | Texture Coordinates (U, V) |
TXT7
The TXT7 sections hold PVRT textures used for the model.
Header
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (TXT7) |
0x04 | 0x04 | uint | Size in bytes |
0x08 | 0x04 | uint | Texture entry count |
TXT7 Entry
The entries consist of an offset to the PVRT texture and just like in the texture entry list an ID/Name to identify those offsets.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | Offset |
After the texture offsets come the corresponding texture ID and name to identify them.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | uint | ID? |
0x04 | 0x04 | string | Name? |
FACE
Unknown.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (FACE) |
0x04 | 0x04 | uint | Size in bytes |
CLSG
Unknown.
Position | Length | Type | Description |
---|---|---|---|
0x00 | 0x04 | string | Identifier (CLSG) |
0x04 | 0x04 | uint | Size in bytes |
0x08 | 0x04 | ? | Unknown |
0x0C | 0x04 | uint | CLTH Offset |
0x10 | 0x04 | uint | OSAG Offset |
0x14 | 0x04 | uint | CLCL Offset |
CLTH
Unknown.
OSAG
Unknown.
CLCL
Unknown.