Texture format: Difference between revisions
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
|0x4 | |0x4 | ||
|0x2 | |0x2 | ||
|version, set to 2 for .ps2 files, 3 for .pc, 4 for .dc | |version, set to 2 for .ps2 files, 3 for .pc, 4 for .dc, 5 for .ps2 (w. aplha?) | ||
|- | |- | ||
|0x6 | |0x6 | ||
Line 50: | Line 50: | ||
=== Version 4 (DC) === | === Version 4 (DC) === | ||
* Uses the same compression as | * Uses the same compression as version 3, but the resulting files are swizzled for Dreamcast GPU, so untwiddling is needed | ||
=== Unpacked image data === | === Version 5(PS2) === | ||
* not much is known, might also contain alpha channel data | |||
=== Unpacked image data (PC and DC) === | |||
Uncompressed image data uses 2 bytes for each pixel, in A1 R5 G5 B5 format. In some places game uses additional file with greyscale alpha channel to compensate for 1bit alpha (5 bits instead of 1). | Uncompressed image data uses 2 bytes for each pixel, in A1 R5 G5 B5 format. In some places game uses additional file with greyscale alpha channel to compensate for 1bit alpha (5 bits instead of 1). |
Revision as of 15:14, 3 January 2021
Engine supports maximum size of 256x256 pixels. On Windows textures use .pc extension, on Dreamcast they use .DC extension, and on Playstation2 they use .ps2 extension
Offset | Size | Description |
---|---|---|
0x0 | 0x4 | Magic, T54 4D 21 1A (TM!\x1A )
|
0x4 | 0x2 | version, set to 2 for .ps2 files, 3 for .pc, 4 for .dc, 5 for .ps2 (w. aplha?) |
0x6 | 0x2 | width |
0x8 | 0x2 | height |
0xA | 0x2 | first pixel |
0xC | ?? | Compressed data, until EOF |
- compressed image data starts at 0xA, see pc_unpack.py for implementation details
Version 2 (PS2)
- Not much is known, other that it's vastly different to PC & DC versions
Version 3 (PC)
- Each pixel is written on 2 bytes, little endian, after converting to big endian the algorithm looks like this:
- If the 15th bit is 1, then stream data as long as each compressed pixel 15th bit is set
- Else
- If 14th bit is set copy previously unpacked data
- bits 11-13 - number of pixels to repeat - 2, so if this number is set to 7, then repeat 9 pixels, minimum 2 pixels
- bits 0-10 - offset - back head for copying that many pixels
- else - add transparent pixels
- bits 0-13 - how many transparent pixels to add
- If 14th bit is set copy previously unpacked data
- Else
00 00
marks the end of compressed data
Version 4 (DC)
- Uses the same compression as version 3, but the resulting files are swizzled for Dreamcast GPU, so untwiddling is needed
Version 5(PS2)
- not much is known, might also contain alpha channel data
Unpacked image data (PC and DC)
Uncompressed image data uses 2 bytes for each pixel, in A1 R5 G5 B5 format. In some places game uses additional file with greyscale alpha channel to compensate for 1bit alpha (5 bits instead of 1).