Skip to content
Simon B edited this page Jul 6, 2016 · 4 revisions

TMD

Container for 3D-Model Data.
Shoutout to User RandomTBush on the XeNTaX Forums for his Research on this!

Header

Fields marked with an Asterix are just some educated guesses but need further investigation.
Ranges may be viewed as a Combination of a Start-Offset and an Instance-Count.

Type Description Note
uint32_t Magic# ("tmd0" / 0x30646D74)
uint16_t Unknown
FeatureLevel_t TMD-Feature-Level
uint16_t Unknown
uint16_t Unknown
uint16_t Unknown
uint16_t Unknown
Bounds_t Bounding Box
Range_t BVH-Data Range - see BVH_t
Range_t Loading Operations - see Operation_t
Range_t Unkown Range
Range_t Rigging-Data Range - see Rig_t
Range_t Unkown Range
Range_t PolyGroup-Data Range - see Polygroup_t
Range_t Face-Data Range - see Face_t
RangeInv_t Vertex-Data Range - see Vertex_t Count and Offset are switched on this one, thus RangeInv_t
uint32_t Unknown
uint32_t Unknown
uint32_t Unknown
uint32_t Unknown
uint32_t Unknown
uint32_t Unknown
uint32_t Unknown
Range_t Bone-Data Range - Bone_t
Range_t Bone-Hierarchy-Data Range - BoneHierarchy_t
Range_t Texture-Info Range - Texture_t
uint32_t Blank-Terminator*

FeatureLevel_t

Feature-Level of the Vertex-Format.

Type Description
uint8_t Feature-Level LSB
uint8_t Feature-Level MSB

The LSB may be viewed as a C-Style Bitfield which encodes the presence of the following Vertex-Data Features in this order:

Type Description
uint8_t:1 Positions*
uint8_t:1 Normals
uint8_t:1 UV-Coordinates_0
uint8_t:1 UV-Coordinates_1
uint8_t:1 UV-Coordinates_2*
uint8_t:1 Colors
uint8_t:1 Unknown (always on)*
uint8_t:1 Rigging

Bounds_t

Bounding Box Type

Type Description
float Min-X
float Min-Y
float Min-Z
float Max-X
float Max-Y
float Max-Z

Range_t

Range Interpretation of a Start and Count.

Type Description
uint32_t Start
uint32_t Count

RangeInv_t

Range Interpretation of a Start and Count but with inverted Order of Elements.

Type Description
uint32_t Count
uint32_t Start

BVH_t

Type Description Note
Bounds_t Bounding Box
uint32_t Some sort of Offset Monotonically increasing from one Entry to the next
uint16_t Unknown
uint16_t Unknown

Face_t

Type Description
uint16_t[3] Vertex Indices representing a Face

##Operation_t Instruction on how to Load the Raw-Data to Memory

Type Description
uint8_t Operation-Value
uint8_t Operation-Type
Operation-Type Meaning
0x20 Set active Material to Operation-Value
0x30 Load Polygroup[Operation-Value]
0x40 Set active Rig to Operation-Value

##Rig_t

Type Description
int32_t Value
int32_t Bones

##Bone_t

Type Description
float[4][4] Transformation Matrix

##BoneHierarchy_t

Type Description
uint32_t Hash*
float[3] Bone-Head Position
int32_t Bone-Parent
uint32_t Bone-Head

##PolyGroup_t

Type Description
uint16_t Face-Count
uint16_t Unknown
uint16_t Face-Offset

Vertex_t

Type Description Note
float[3] Vertex Coordinates
uint8_t[4] Vertex Weights Only present if Feature-Level Rigging is on
uint8_t[4] Rig-Relative Bone Ids Only present if Feature-Level Rigging is on
int8_t[4] Vertex Normals Only present if Feature-Level Normals is on
uint8_t[4] Vertex Color Only present if Feature-Level Color is on
int16_t[2] UV Coordinates Only present if Feature-Level UV-Coordinates_0 is on
int16_t[2] UV Coordinates Only present if Feature-Level UV-Coordinates_1 is on