---------------------------------------------------------------- |Syndicate Wars PRIMVEH.OBJ File Format | |Current Version: v1.0 | |Written by Marco Castrucci in 2006 | ---------------------------------------------------------------- Version History =================== v.1.0: First Draft File Blocks =================== 0x00000 - 0x00011 Header 0x00012 - 0x049A9 Vertices; block [A] 0x049AA - 0x08349 Triangular Faces; block [B] 0x0834A - 0x13B31 Quadrate Faces; block [C] 0x13B32 - 0x140D1 Mesh Definitions; block [D] 0x140D2 - 0x186FD Quadrate UV Faces; block [E] 0x186FE - 0x19D1D Triangular UV Faces; block [F] =================== Header (18 bytes) =================== full header: 6600 0000 5C07 CD01 9904 2800 E603 6201 0000 6600 ??? 0000 5C07 n° vertices; number of objects in block [A] CD01 n° tri-faces; number of objects in block [B] 9904 n° quad-faces; number of objects in block [C] 2800 n° meshes; number of objects in block [D] E603 n° quad-uv-faces; number of objects in block [E] 6201 n° tri-uv-faces; number of objects in block [F] 0000 BLOCK [A] =================== Vertices (10 bytes each) =================== what is: contains the whole vertices some samples: 0100 A1FF 7600 F3FF 0040 0500 A1FF 7600 3F00 0040 0600 C1FF 7600 6700 0040 0100 ? some sort of index A1FF X coordinate (signed 16 bit) 7600 Y coordinate (signed 16 bit) F3FF Z coordinate (signed 16 bit) (height from ground) 0040 ? always 0040 or 0044 notes: -the first vertex is all 0 -it seems the vertices are grouped in blocks separated by three rows of 0, probably to separate the vertices used by each mesh. -the vertices are in object space, so the mesh is centered at (0,0,0) BLOCK [B] =================== Tri-Faces (32 bytes each) =================== what is: contains the whole triangular faces (faces composed by 3 vertices) some samples: 1400 3A00 3500 0100 0005 1800 6400 0000 0000 0000 2213 0000 0000 0000 0000 0000 1800 1600 1500 0200 8005 1800 6400 0000 0000 0000 3E13 0000 0000 0000 0000 0000 1500 3400 3800 0300 0005 1800 6400 0000 0000 0000 6713 0000 0000 0000 0000 0000 1400 vertex0 index 3A00 vertex1 index 3500 vertex2 index 0100 tri-uv-face index (used to access the face uvmap properties in the apposite array) 00 ? material type, 0x00 is normal, 0x80 used for an environment map material 05 ? material type, tested from 0x00 to 0x19 (otherwise the game crashes). Examples: normal, colored, activate transparencies, etc 1800 ? 6400 ? 0000 ? always 0 0000 ? always 0 0000 ? always 0 2213 ? 0000 ? always 0 0000 ? always 0 0000 ? 0000 ? always 0 0000 ? always 0 notes: -same pattern as block [C] -the unknown values does not seem to break the meshes, but what do they mean? BLOCK [C] =================== Quad-Faces (40 bytes each) =================== what is: contains the whole quadrate faces (faces composed by 4 vertices) some samples: 0800 0700 0100 0600 0100 0005 3700 6300 0000 0000 0000 0000 6C13 0000 0000 0000 0100 0000 0000 0000 0600 0500 0100 0200 0200 0005 3700 6300 0000 0000 0000 0000 9513 0000 0000 0000 0100 0000 0000 0000 0300 0200 0400 0500 0300 0005 3700 6300 0000 0000 0000 0000 9813 0000 0000 0000 0100 0000 0000 0000 0800 vertex0 index 0700 vertex1 index 0100 vertex2 index 0600 vertex3 index 0100 quad-uv-face index (used to access the face uvmap properties in the apposite array) 00 ? material type, 0x00 is normal, 0x80 used for an environment map material 05 ? material type, tested from 0x00 to 0x19 (otherwise the game crashes). Examples: normal, colored, activate transparencies, etc 3700 ? 6300 ? 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 6C13 ? 0000 ? always 0 0000 ? always 0 0000 ? always 0 0100 ? 0000 ? always 0 0000 ? always 0 0000 ? always 0 notes: -same pattern as block [B] -the unknown values does not seem to break the meshes, but what do they mean? BLOCK [D] =================== Mesh Definitions (36 bytes each) =================== what is: contains the mesh definitions (parameters and indices) some samples: 0100 0000 0000 0100 0E00 0000 0000 0000 0000 0000 0000 0000 0100 1100 0300 0000 0000 0000 0100 2600 0000 0F00 1B00 0000 0000 0000 0000 0000 0000 0000 1400 4400 0300 0000 0000 0000 0100 first triangular face index 0000 n° of triangular faces 0000 ? always 0 0100 first quadrate face index 0E00 n° of quadrate faces 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 0100 first used vertex index 1100 last used vertex index (actually it's 1 more, so last_index - first_index gives the n° of vertices used?) 0300 ? always 3 0000 ? always 0 0000 ? always 0 0000 ? always 0 BLOCK [E] =================== Quad-UV-Faces (18 bytes each) =================== what is: contains the whole uv mapping and texture parameter used by quad-faces some samples: 9665 8565 9E6D 806D 0100 0000 0000 0000 0000 806B 8076 9E6B 9E76 0100 0000 0000 0000 0000 997F 9F73 857F 8073 0100 0000 0000 0000 0000 96 u0 coordinate (unsigned 8 bit) (it's the X pixel coordinate in the TEX??.DAT files, that are 256x256 pixels) 65 v0 coordinate (unsigned 8 bit) (it's the Y pixel coordinate in the TEX??.DAT files, that are 256x256 pixels) 85 u1 65 v1 9E u2 6D v2 80 u3 6D v3 0100 texture index; Example: 1 means the face will use the texture TEX01.DAT 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 notes: -same pattern as block [F] -probable diagram of coordinates orientation uv0 uv2 ------- | | | | ------- uv1 uv3 BLOCK [F] =================== Tri-UV-Faces (16 bytes each) =================== what is: contains the whole uv mapping and texture parameter used by tri-faces some samples: 807E 8B60 8060 0100 0000 0000 0000 0000 8058 9158 8A40 0300 0000 0000 0000 0000 9E7F 9E60 9360 0100 0000 0000 0000 0000 80 u0 coordinate (unsigned 8 bit) (it's the X pixel coordinate in the TEX??.DAT files, that are 256x256 pixels) 7E v0 coordinate (unsigned 8 bit) (it's the Y pixel coordinate in the TEX??.DAT files, that are 256x256 pixels) 8B u1 coordinate (unsigned 8 bit) 60 v1 coordinate (unsigned 8 bit) 80 u2 coordinate (unsigned 8 bit) 60 v2 coordinate (unsigned 8 bit) 0100 texture index; Example: 1 means the face will use the texture TEX01.DAT 0000 ? always 0 0000 ? always 0 0000 ? always 0 0000 ? always 0 notes: -same pattern as block [E]