Model

From owdev
Jump to: navigation, search

To view the old format go to Model/Legacy

Chunks are wrapped in a Common Chunked Format, primary identifier LDOM

UTSM

MSTU

LOCM

big endian - mcol - colission data.

removed as of 1.14

 u16 nr_simple;
 u16 nr_complex;
 u16 nr_desc;
 u16 nr_other;
 u64* simple;
 u64* complex;
 u64* desc;
 u64* other;

simple

 ulong  padding;    // 0xFFFFFFFF FFFFFFFF
 float  matrix[16]; // 4x4? 3x4 + vec3?
 ulong  unknown1;   // zero
 uint   name_id;    // unique?
 uint   id;         // unique?
 ushort unknown2;   // 0xFFFF, 0xFEFF
 ushort unknown3;   // 0x8000
 ushort unknown4;   // 0x0300
 ushort unknown5;   // 0x0400
 byte   unknown6;   // 0x02
 byte   unknown7;   // 0x02
 uint   unknown8;   // zero
 ushort unknown9;   // 0x0100

complex

 u64 ffed
 f32 unk1[10]
 u32 zero // ?
 f32 unk3
 u64 zero // ?
 u32 zero // ?
 f32 unk6
 f32 weight // ?
 u16 ffed2
 u8 unk7
 u8 unk8
 u64 zero // ?
 u16 ffed3
 u8 unk8
 u8 unk9
 u16 unkA
 u8 unkB
 u8 unkC
 u16 zero // ?
 u8 unkE
 u8 unkF
 u8 unk10
 u8 unk11
 u16 zero // ?
 u32 id // ?
 u32 name // hashed?

desc

 u64* floats1 // -> u32 + f32[nr_floats]
 u64* struct2 // -> ?
 u64* struct3[nr_floats] // u8[4]
 u64* struct4[nr_bytes] // u8
 u32 unk1
 f32 unk2
 f32 unk3
 u32 nr_something1
 u32 nr_bytes
 u32 nr_floats
 f32 unk4
 f32 unk5
 u64 ffed
 f32 unk6[14]
 u16 ffed2
 u16 unk7
 u16 unk8
 u16 unk9
 u32 zero
 u16 unkA
 u16 zero
 u32 unkB

other

todo

CLDM

 f32 desc_bbox[16];
 u8 unk1;
 u8 unk2; // same as unk1
 u16 unk3;
 u32 unk4;
 f32 unk5;
 u16 nr_materials;
 u16 unk6;
 u64 unk7;
 u64 unk8;
 u64* material_lookup;

DSEM

emitter s... data? attachements? formerly known as unk_struct1?

 u64* struct1
 u64* struct2
 u32 nr_struct1
 u32 nr_struct2

struct1

 u8[12] unk1
 u32 id // ?
 u16 unk2
 u16 unk3
 u32 zero

struct2

 f32 unk1
 u32 unk2
 u32 unk3
 u32 unk4

PRHM

-> MHRP* = Model Hard Points

 u32 nr_hardpoints;
 u32 nr_unk
 u64* hardpoint_desc;
 u64* unk_desc; // points to nr_unk bytes ?

hardpoint_data

 f32 matrix[16];
 u8 hex[4]; // hex representation of the hard point name
 u32 unk;
 u8 parent_id[4]; // lookup name of the parent bone
 u32 unk[5]


  • All chunk headers should be read in reverse, this is the case in many Blizzard file formats

LDGR

ragdoll?

 u64* unk1_data;
 u64 zero;
 u64* unk2_data;
 u64 zero;
 u64 unk1_count;
 u64 unk2_count;

unk1_data

 u64 ffed
 f32 unk1[7]
 uint unk2
 f32 unk3[4]
 u32 id1
 u32 id2
 u64 zero1
 u64 zero2

unk2_data

 u64 ffed
 f32 unk1[15];
 uint unk2;
 u32 id1;
 u32 id2;

MNRM

main mesh data

struct mesh_desc
{
	u32	nr_vertices;
	u8	nr_submesh_desc;
	u8	nr_somethings1;
	u8	nr_somethings2;
	u8	nr_somethings3;
	u8	nr_materials;
	u8	nr_somethings4;
	u8	nr_vertex_buffer_desc;
	u8	nr_index_buffer_desc;
	u32	unk5;
	f32	unk678[12];
	u32	unk9[4];
	f32	unkA[4];
	u32	unkB[4];
	u64*	vertex_buffer_desc;
	u64*	index_buffer_desc;
	u64*	submesh_desc;
	u64*	unk_desc;
};

vertex_buffer_desc

struct vertex_buffer_desc
{
	u32	nr_input_elements;
	u32	unk0;
	u8	stride_stream1;
	u8	stride_stream2;
	u8	nr_vertex_elements_desc;
	u8	unk1;		
	u32	unk2;
	u64*	vertex_elements_desc;	// array of nr_
	u64*	data_stream1;		// see vertex_element_desc
	u64*	data_stream2;		// see vertex_element_desc
};

vertex_element_desc

struct vertex_element_desc		// similarity to D3D11_INPUT_ELEMENT_DESC 
{
	u8	semantic_type;		
	u8	semantic_index;		// example 1st, 2nd, 3rd pair of UVs
	u8	data_format;			
	u8	stream_number;
	u16	classification;		// assumed D3D11_INPUT_CLASSIFICATION
	u16	stride_offset;
};

semantic_type

enum semantic_type			// semantics names can be found in DXBC files. not relevant here.
{
	POSITION	= 0,
	NORMAL		= 1,
	COLOR		= 2,		// unknown/unused
	TANGENT		= 3,
	BONE_INDICES	= 4,
	BONE_WEIGHT	= 5,
	UNKNOWN1	= 6,
	UNKNOWN2	= 7,
	UNKNOWN3	= 8,
	TEXCOORD	= 9,
	VERTEX_ID	= 10
};

data_format

enum data_format			// DXGI_FORMAT_s. RGBA == XYZW. known format behaviours.
{
	R32G32B32_FLOAT	= 2,
	R16G16_FLOAT	= 4,
	R8G8B8A8_UINT	= 6,
	R8G8B8A8_UNORM	= 8,
	R8G8B8A8_SNORM	= 9,
	R32_UINT	= 12
};

index_buffer_desc

struct index_buffer_desc
{
	u32	nr_indices;
	u32	format;			// or nothing. common 16-bit indices
	u64*	data_streami;		
};

submesh_desc

struct submesh_desc			// 'drawcall' assembly info
{
	f32	unk2[10];
	s64	index_something;	// purpose unknown.
	f32	unk1;
	u32	vertex_id_start;	// mul vertex buffer stream stride(s) to get releative offset(s).
	u16	index_id_start;
	u16	pad1;
	u32	unk3[3];
	u16	index_count;
	u16	nr_indices_to_draw;	// 'draw' means div 3 -> triangles to assemble.
	u16	nr_vertices_to_draw;	// 'draw' means run thru vertex shader. index relative.
	u16	offset_bone_id;
	u8	index_buffer_used;	// ? *shrugs*
	u8	pad3[7];
	u8	vertex_buffer_used;
	u8	flags;			// relevant? see submesh_enum
	u8	material;		// see material_lookup
	u8	LOD_flags;		// bit 1 = highest LOD
	u32	unk4;
};

lksm

skeleton (bone data)

 u64* bone_hierarchy1; // size = nr_bones_abs
 u64* bone_matrices; // size = nr_bones_abs
 u64* bone_matrices_inverted; // size = nr_bones_abs
 u64* bone_matrices3x4; // size = nr_bones_abs
 u64* bone_matrices3x4_inverted; // size = nr_bones_abs
 u64* unk_struct_6;
 u64* bone_id;
 u64* bone_names;
 u64* bone_system;
 u64* bone_id_remapping;
 u64* bone_hierarchy2; // size = nr_bones_abs
 u32 unk1;
 u16 nr_bones_abs;
 u16 nr_bones_rigid; // nr bones for the rigid body
 u16 nr_bones_cloth; // probably nr bones used in the cloth engine (HTLC/CLTH chunk)
 u16 nr_bone_id_remapping; // nr of animated bones?
 u16 nr_bone_ids;
 u16 nr_unk_struct_6;
 u16 unk4;
 u16 nr_bone_names; // [NOTE] - This seems to be incorrect, size of bone_names = nr_bones_abs
 u16 nr_bones_system; // nr of bones
 u16 unk5;
 u16 padding; 

bone_hierarchy1

 u8 unk1;
 u8 unk2;
 i16 parentId;

I believe this is incorrect, should be

 u8 unk[4];
 u16 parent_id; // -1 means no parent id

bone_matrices

 f32 matrix[16]; // 4x4

bone_matrices_inverted

 f32 matrix[16] ;; // 4x4

bone_matrices3x4

 f32 matrix[12] ;; // 3x4 / 4x3

bone_matrices3x4_inverted

 f32 matrix[12] ;; // 3x4 / 4x3

unk_struct_6

 u32 unk1;
 f32 unk2[4]; 
 u32 pad[3];

bone_id

 u32 value;

bone_names

 u64* bone_name_packet;

bone_name_packet

 u8 value[14]; // ??

bone_system

 u16 value;

unk_struct_A

 u16 value;

bone_hierarchy2

 u16 value;

HTLC

Cloth

 struct header {
   u64 nr_cloth_desc;
   u64* cloth_desc; // there's some data after this array. sizeof uint16 * lksm->nr_bones_cloth 
 }

cloth_desc

 struct cloth_desc {
   u64* unk1;
   u64* unk2;
   u64* unk3;
   u64* unk4;
   u64* system_map;    // uint16 array, use in relation to lksm?
   u64* unk6;
   u64* unk7;          // haven't found a chunk that has this yet
   u64* hierarchy_map; // uint16 array
   u64* unk9;          // uint16 array
   char[32] name;
   u32 nr_unk1;        // also nr_system_map, nr_hierarchy_map
   u32 nr_unk2;        //
   u32 unknown_nr;     // ?
   u32 nr_unk3;        //
   u32 nr_unk4;        //
   u32 unknown_nr;     // ?
   u32 unknown_nr;     // ?
   u32 nr_unk9;        // ?
   u32 unknown_nr;     // ?
   u32 nr_unk6;
   u32 zero;
   f32 float;
   u64* unkB;
   u32 unkC;
   u16 unkE;
   u16 unkF;
   record_t unk10;
   u64 unk11;
   record_t unk11;
 }

unk1

Physics settings?

 struct unk1 {
   float[4] unknown;
   float[4] unknown;
   float[8] unknown;  // zero
   float[16] matrix1; // 4x4
   float[16] unknown; // zero
   float[12] matrix2; // 3x4
   float[4] unknown;  // zero 
   float[22] unknown;
   ushort index;      // ?
   ushort index;      // ?
   ushort index;      // ?
   ushort index;      // ?
   float[8] unknown;  // zero 
 }

unk2

Hierarchy net?

 struct unk2 {
   float[4] unknown;
   float weight;
   ushort index;
   ushort index;
   ushort index;
   ushort unknown; // zero
   uint padding;
 }

unk3

 struct unk3 {
   float weight;
   float[3] unknown;
   float[4] unknown;
   ushort index;
   ushort index;
   uint padding;
   uint padding;
 }

unk4

 struct unk4 {
   float[4] unknown; // zero
   ushort unknown;   // zero
   ushort index;
   float[2] unknown;
   float[4] unknown; // zero
   ushort unknown;   // zero
   ushort index;
   ushort index;
   ushort index;
   ulong padding;
 }

unk6

 struct unk6 {
   float[4] unknown;
   float[4] unknown;
   float[16] matrix; // 4x4?
   float[16] matrix; // 4x4?
   ushort index;
   ushort index;
   ulong padding;
   uint padding;
 }

TODO