Similar to weapon models.
They all have a header that starts with '01 00 00 80', a group of faces and a vertex buffer. There're no bones/transforms, so they are just generic mesh type (a weapon model is mesh itself).
They are pretty easy to find, just search for 01 00 00 80, if found, check offset 0x10 from there, there should be a 14 00 00 00 followed by a xx 00 00 00.
header example (Einlanzer model)
- 01 00 00 80 signature bytes maybe
- 41 00 how many vertex (0x41)
- 5B 00 how many faces (triangles+squads=0x5b)
- 34 0B 00 00 offset to vertex data (0xb34)
- 28 00 00 00 offset to face data (0x28)
- 14 00 00 00 offset to face group header (0x14)
face group header
- 02 00 00 00 how many groups (2)
- 34 00 face type of group 1 (0x34)
- 38 00 how many faces does group 1 have (0x38)
- 28 00 00 00 offset to face group 1 data (0x28)
- 3C 00 face type of group 2 (0x3c)
- 23 00 how many faces does group 2 have (0x23)
- 48 06 00 00 offset to face group 2 data (0x648)
The types of faces, however, are much more complex than I expected.
- 0x34 Triangle, has vetex colors of all 3 vertices, a uv map(see texture uv format for more informations) and a list of 3 vertex indices.
- 0x3c Quad, has vetex colors of all 4 vertices, a uv map and a list of 4 vertex indices.
- 0x24 Triangle, has only 1 vertex color value for all 3 vertices, a uv map and a list of 3 vertex indices.
- 0x2c Quad, has only 1 vertex color value for all 4vertices, a uv map and a list of 4 vertex indices.
- 0x20 Triangle, has only 1 vertex color value (perhaps always zero and unused) , a list of 3 vertex indices, and a '00 00' at the end which makes me wonder whether it is another vertex, but it could be just a trick to make the total length a multiple of 4.
- 0x28 Quad, has only 1 vertex color value (perhaps always zero and unused) and a list of 4 vertex indices.
- 0x30 Triangle, similar to 0x20, but has 3 vertex colors.
- 0x38 Quad, similar to 0x28, but has 3 vertex colors.
Note: un-textured triangles seem to have different vertex color orders. For example, if the vertices are (a,b,c), then the vertex colors are arrange in an order of (b,c,a).
Breaking the byte down into bits:
7 6 5 4 3 2 1 0
4: vertex color type
3: face type (triangle or quad)
2: texture type (textured or textureless)
texture uv format:
- triangle: UVCCUVTTUV (10 bytes)
- quad: UVCCUVTTUVUV (12 bytes)
- UV: U and V value, in pixels
- CC:CLUT info
- TT:Texture info
- CLUT info:used to find clut (palette) offset in vram
clutx = (clut&0x3f)<<4 cluty = (clut>>6)
- Texture info:texture page, texture mode, transparency
mode = ((tpage)>>7)&0x003 abr = ((tpage)>>5)&0x003 tpx = ((tpage)<<6)&0x7c0 % 1024 tpy = ((((tpage)<<4)&0x100)+(((tpage)>>2)&0x200))
mode: color mode. 0: 4bit, 1: 8bit, other: not used in game
abr: transparent mode
tpx: texture page x
tpy: texture page y
For more informations, check here: http://psx.rules.org/gpu.txt