Page 6 of 6

Re: SW Battlefront 2015 model files

Posted: Sat Jan 28, 2017 4:27 pm
by Acewell
parzivail wrote:Would there happen to be a complete file format description, or a Maya importer?
there is that maxscript linked in this post but i can't make heads or tails from most of it
viewtopic.php?f=33&t=13145

i know enough about it to draw the meshes with UVs in Noesis and i will post my notes soon
:D

Code: Select all

# stardestroyer_detailsside_07_right_mesh.meshset sample
# http://forum.xentax.com/viewtopic.php?p=123087#p123087
# this is a single file and needs to be split at 0x1fd0 into a chunk file
	
header	
	0x20 - 4bytes - start LOD offsets for up to 7 LOD levels, 56 bytes total
				--offset for LOD0 data = 0x90

LOD0 data (0x90)
	0x90 - offset for first LOD data (LOD0)
	0x98 - 4bytes - num submeshes in LOD0 or maybe material groups (*see Checks)
	0x9c - 4bytes - offset to LOD0 section data (0x450)
	0xec - 4bytes - offset to start of face indices in *.chunk file

LOD0 section data (0x450)
	0x450 - start of LOD0 first submesh data
	0x458 - 4bytes - offset to first submesh name
	0x468 - 4bytes - num faces for first submesh --multiply by 3
	0x474 - 4bytes - num verts for first submesh
	0x484 - 2bytes - flag to indicate vertex type (0x701 = 1793 = HalfFloat)  (see vertex type table)
	0x486 - 2bytes - position in vertex format
		  --loop through these flag/pos shorts (total 64 bytes)
	0x4c4 - 2bytes - vertex stride for first submesh

	0x510 - start of LOD0 second submesh data
	#0x528 - num faces for second submesh --multiply by 3
	#0x534 - num verts for second submesh

	0x5d0 - start of LOD0 last submesh data
	#0x5e8 - num faces for third submesh --multiply by 3
	#0x5f4 - num verts for third submesh


--------------Vertex type table----------------------------------------------------------------
   Vert_Pos_Float           = 769  (0x301)
   Vert_Pos_HalfFloat       = 1793 (0x701)
   Vert_Pos_HalfFloat_plus  = 2049 (0x801) - add 2 to face indice offset only for z depth model 
   Vert_BiNormals           = 2054 (0x806)
   Vert_Tangents            = 2055 (0x807)
   Vert_Normals_UV          = 1569 (0x621) 
   Vert_Diffuse_UV          = 1570 (0x622) 
   Vert_Bone_Indices        = 3074 (0xc02)         
   Vert_Blend_Weights       = 3332 (0xd04)
   Vert_Unk_Flag1           = 1289 (0x509)
   Vert_Unk_Flag2           = 3358 (0xd1e) - for vehicles (?)
   Vert_Unk_Flag3           = 2056 (0x808)
   Vert_Unk_Flag4           = 1571 (0x623) - could be UV related
-----------------------------------------------------------------------------------------------


Checks
    Calculate length of LOD section data blocks for looping by number of submeshes
        0x28 read offset for LOD1 data 
        goto LOD1 data + 12 and read offset for LOD1 section data
        subtract LOD0 section data offset from LOD1 section data offset
        divide result by num of LOD0 submeshes

    Face indices could be word or dword
        read first 4 bytes of indices, if int > 0 they are word else dword
  
    The num submeshes may include collision etc and could be more than you need
        goto submesh name offset and read the string, if == 0 (zero), skip it
edit
there is another pretty good outline of the format for another frostbite game here
http://zenhax.com/viewtopic.php?p=23000#p23000

Re: SW Battlefront 2015 model files

Posted: Sat Jan 28, 2017 8:49 pm
by Wobble
[out]