View source: MT5 (revision 322)
Jump to navigation
Jump to search
2018-12-26T14:36:27Z · PhilYeahz · Download source
[[Category:Shenmue]]
[[Category:Files]]
[[Category:Models]]
MT5 is an model container format for Shenmue I.<br>
The model format is based on an node based hierarchy tree.<br>
For an C# implementation based on this documentation look [https://github.com/philyeahz/ShenmueDKSharp/blob/master/Files/Models/MT5.cs here].
===Header===
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || string || Identifier (HRCM)
|-
| 0x04 || 0x04 || uint || TEXD offset
|-
| 0x08 || 0x04 || uint || First node offset
|}
===MT5 Node===
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || uint || ID
|-
| 0x04 || 0x04 || uint || Mesh offset
|-
| 0x08 || 0x0C || short || Rotation (X, Y, Z)
|-
| 0x14 || 0x0C || float || Scale (X, Y, Z)
|-
| 0x20 || 0x0C || float || Position/Translate (X, Y, Z)
|-
| 0x2C || 0x04 || uint || Child offset
|-
| 0x30 || 0x04 || uint || Sibling offset
|-
| 0x34 || 0x04 || uint || Parent offset
|-
| 0x38 || 0x04 || string || Node name
|-
| 0x3C || 0x04 || ? || Reserved
|}
===Mesh Data===
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || uint || Polytype?
|-
| 0x04 || 0x04 || uint || Vertices offset
|-
| 0x08 || 0x04 || uint || Vertex count
|-
| 0x0C || 0x04 || uint || Instructions offset
|-
| 0x10 || 0x0C || float || Mesh center (X, Y, Z)
|-
| 0x1C || 0x04 || float || Mesh radius
|}
====Instructions====
These instructions are state machine like. Each instruction changes the state of how to render the strip.<br>
Each instruction identifier is 2 bytes long.
=====(0x0E00, 0x0F00)=====
Ignored. Skip 10 bytes.
=====(0x8000, 0xA000)=====
Ignored. Skip 2 bytes.
=====(0x0B00)=====
Unknown.
=====Strip Attributes (0x0200, 0x0300)=====
First byte holds UV flag for how they are interpreted.
Holds information about the texture UV wrap modes.
=====Texture (0x0900)=====
Sets the texture to use for the next instructions.
=====Strip Group (0x1000 - 0x1400, 0x1800 - 0x1C00)=====
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x02 || ushort || Strip count
|}
These strip groups have the following vertex data based on the identifiers:
{| class="wikitable"
|-
! Identifier !! Vertex Size !! Description
|-
| 0x1000, 0x1300, 0x1800, 0x1B00 || 2 Bytes (Index) || Vertex index
|-
| 0x1200, 0x1A00 || 2 Bytes (Index) + 4 Bytes (BGRA) || Vertex index, Color
|-
| 0x1100, 0x1900 || 2 Bytes (Index) + 4 Bytes (UV) || Vertex index, UV
|-
| 0x1400, 0x1C00 || 2 Bytes (Index) + 4 Bytes (UV) + 4 Bytes (BGRA) || Vertex index, UV, Color
|}
======Strip======
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x02 || short || Strip vertex count (sometimes negativ, just abs() it)
|}
Often the vertex index can be negativ, this is an optimization and is used to point to the parents vertices.
======Strip "Vertex"======
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x02 || short || Vertex index
|-
| 0x02 || 0x04 || short || Texture Coordinate (UV)
|-
| 0x06 || 0x04 || byte || BGRA Color
|}
The UV coordinates are UVH (UV high-resolution) and need to be divided by 1024 to get normalized UV coordnates.
=====End (0x0080)=====
Defines the end of instructions.
====Vertices====
The vertices only hold the position and normal of an vertex.
=====Vertex=====
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x0C || float || Position (X, Y, Z)
|-
| 0x0C || 0x0C || float || Normals (X, Y, Z)
|}
===TEXD===
This sections holds textures for the model.
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || string || Identifier
|-
| 0x04 || 0x04 || uint || Header size (or offset to first entry)
|-
| 0x08 || 0x04 || uint || Texture count
|}
====TEXD Entry====
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || string || Identifier (TEXN, NAME)
|-
| 0x04 || 0x04 || uint || Entry size in bytes
|}
=====TEXN=====
This entry defines an actual PVRT texture.
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || uint || ID
|-
| 0x04 || 0x04 || string || Name
|-
| 0x08 || 0x0? || PVRT || Texture
|}
=====NAME=====
This entry is used to define used textures outside of the MT5.
{| class="wikitable"
|-
! Position !! Length !! Type !! Description
|-
| 0x00 || 0x04 || uint || ID
|-
| 0x04 || 0x04 || string || Name
|}