Deathtrack Model Format
| Format type | 3D Model |
|---|---|
| Model type | Polygon |
| Maximum number of polygons | Unknown |
| Maximum number of vertices | 255 |
| Games |
All 3D objects in Deathtrack – cars, buildings, roadside objects – are polygon meshes stored in .TBL files. SHAPE.TBL holds 124 models; each of the nine driver files (SLY, MEGA, ANGEL, LURKER, MENACE, CRIMSON, MANIAC, WRECKER, MELISSA) and the three player-car files (MYCAR0–2) holds one model. The 13 files contain 136 models, 1,195 groups and 3,525 faces in total.
In a race, every car and object is taken from SHAPE.TBL; the driver and car files are only used for the previews in the shops. The files do not contain car statistics.
The files are not compressed and do not use the chunk format. The .TRK files refer to the models of SHAPE.TBL by index.
File format
Model table
The file starts with a table of far pointers, ended by a zero dword:
| Data type | Name | Description |
|---|---|---|
| UINT16LE | offset | Offset part |
| UINT16LE | paragraph | Paragraph part. The model's file offset is paragraph × 16 + offset
|
SHAPE.TBL has 124 entries (paragraph:0000, the table is padded to 0x200); a car or driver file has one entry (0001:0000). The game relocates the table to real segments after loading.
Model
All offsets below are relative to the start of the model.
| Offset | Data type | Name | Description |
|---|---|---|---|
| 0 | INT16LE | radius | Bounding radius |
| 2 | UINT8 | reserved | Always 0 |
| 3 | UINT8 | vertexCount | Number of vertices including normal vectors |
| 4 | UINT16LE | vertexOffset | Offset of the vertex array (always the last block) |
| 6 | LOD[] | lods | Level-of-detail entries, ended by 0xFFFF
|
LOD entry
| Data type | Name | Description |
|---|---|---|
| INT16LE | threshold | The first entry whose threshold is less than or equal to the current detail setting is used |
| UINT16LE | detailOffset | Offset of the detail block |
Every shipped model has exactly one entry: (1, 0x000C).
Vertex array
vertexCount records of three INT16LE values (x, y, z). Normal vectors are stored as vertices too and are referenced by faces.
Detail block
| Data type | Name | Description |
|---|---|---|
| UINT8 | flags | Bit 7 = draw nothing |
| UINT8 | referenceVertex | Reference vertex |
| UINT16LE[] | groupOffsets | Offsets of the groups, ended by 0xFFFF
|
Group
| Data type | Name | Description |
|---|---|---|
| UINT8 | flags | 0, 0x80 or 0xC0; no reader has been found |
| UINT8 | sortVertex | Vertex used to sort the groups from far to near (32-bit dot product) |
| UINT16LE[] | faceOffsets | Offsets of the faces, ended by 0xFFFF
|
Face
| Data type | Name | Description |
|---|---|---|
| UINT8 | normal | Index of the normal vertex used for the back-face test; 0xFF = two-sided
|
| UINT8 | colour1 | Colour, through the model's colour map |
| UINT8 | colour2 | Second colour (dither pair) |
| UINT8[] | indices | Vertex indices, ended by 0xFF
|
A face is drawn when the dot product of the normal with the viewing vector is negative.
Rendering
Vertices are rotated with a Q14 3×3 matrix and projected with sx = cx + (x' << s) / y', sy = cy − (z' << s) / y' (s is set to 7 when SHAPE.TBL is loaded); faces nearer than the near plane are clipped.
Source code
From re-deathtrack, the open-source browser port:
src/viewer/decode.js–models()validating parsersrc/viewer/geometry.js– orthographic inspection renderersrc/game/render3d.js– translated transform and projection (2c46)docs/re/resources.mddocs/vehicle-editor.md– Vehicle Foundry editor
Credits
This file format was reverse engineered by VorticonCmdr. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)