3D model format: Difference between revisions

From Trickstart wiki
No edit summary
No edit summary
Line 1: Line 1:


 
Stores 3D models, more investigation needed.
tores 3D models, more investigation needed


Thanks to Martin for initial format reversing.
Thanks to Martin for initial format reversing.


* Magic - <code>PMD V1.83</code>
* Magic - <code>PMD V1.83</code>
** some files use version 1.82 instead, but they aren't used by the game, the engine won't recognise anything other than 1.83
** some files use version 1.82 instead, but they aren't used by the game, the engine in PC version won't recognise anything other than 1.83
** There is one unused mention of "PMD V1.71" in the game binary
** There is one unused mention of <code>PMD V1.71</code> in the game binary


{| class="wikitable"
{| class="wikitable"
Line 16: Line 15:
|0x0
|0x0
|0x18?
|0x18?
|Magic - "PMD V1.83"
|Magic - <code>PMD V1.83</code>
|-
|-
|0x18
|0x18
Line 45: Line 44:
All blocks (or at least 0-11) are 32-bytes aligned, 12 is aligned so that the next block is 32-bit aligned
All blocks (or at least 0-11) are 32-bytes aligned, 12 is aligned so that the next block is 32-bit aligned
{| class="wikitable"
{| class="wikitable"
!id
!ID
!offset
!offset
!Description
!Description
Line 55: Line 54:
|1
|1
|0x24
|0x24
|according to martinz it holds polygons data
|polygons data?
|-
|-
|2
|2
|0x28
|0x28
|according to martinz it holds uv texture data
|UV texture data?
|-
|-
|3
|3
|0x2c
|0x2c
|according to martinz it holds vertex data
|vertex data?
|-
|-
|4
|4
|0x30
|0x30
|Mesh data? Always points to 0x1E, according to martinz it holds faces data0
|faces data?
|-
|-
|5
|5
Line 87: Line 86:
|9
|9
|0x44
|0x44
|according to martinz it holds surface transforms data
|surface transforms data?
|-
|-
|10
|10
|0x48
|0x48
|according to martinz it holds surfaces data
|surfaces data?
|-
|-
|11
|11
|0x4c
|0x4c
|Offset is 0x160, size 0x68
|
|-
|-
|12
|12

Revision as of 17:48, 31 December 2020

Stores 3D models, more investigation needed.

Thanks to Martin for initial format reversing.

  • Magic - PMD V1.83
    • some files use version 1.82 instead, but they aren't used by the game, the engine in PC version won't recognise anything other than 1.83
    • There is one unused mention of PMD V1.71 in the game binary
Offset Size Description
0x0 0x18? Magic - PMD V1.83
0x18 0x4 Type - 0 = shadow & skybox; 1 = track; 2 = car
0x1C 0x4 Zeroes?
0x20 0x94? offsetsTable? array of 37 ints, might need to add constant 0x148 for elements 0-12
0xB4 0x94? Sizes of data chunks ,array of 37 ints

offsets1Table

  • Looks like indexes 12, 13, 19, 34, and 35 are always set to 0 in all known models
  • 14-33 (minus 19 of course) is only set if the type is set to track (1)
  • I was off by 3 bytes, need to redo that part

You have to add 0x148 to each value to get proper pointers (works with elements 0-12, later ones will probably need different bias)

All blocks (or at least 0-11) are 32-bytes aligned, 12 is aligned so that the next block is 32-bit aligned

ID offset Description
0 0x20
1 0x24 polygons data?
2 0x28 UV texture data?
3 0x2c vertex data?
4 0x30 faces data?
5 0x34 Textures names
6 0x38 Offsets to texture names, absolute addresses in file
7 0x3c Each element is 16B long, ?, ?, float, float
8 0x40 Holds IDs of elements in 7
9 0x44 surface transforms data?
10 0x48 surfaces data?
11 0x4c
12 0x50 Offset is 0x0; the size is non-zero, for shadow it's 1, with one 00 byte
13 0x54
14 0x58
15 0x5c
16 0x60
17 0x64
18 0x68
19 0x6c
20 0x70
21 0x74
22 0x78
23 0x7c
24 0x80
25 0x84
26 0x88
27 0x8c
28 0x90
29 0x94
30 0x98
31 0x9c
32 0xa0
33 0xa4
34 0xa8
35 0xac
36 0xb0