Texture data seems to be the same for all TEngine variants except the Dinosaur Hunter E3 1996 prototype, which is still TODO and the text below doesn't apply to it.
Each texture has an eight byte header:
typedef struct __attribute__((__packed__)) s_T2FSTextureHeader {
uint8_t type;
uint8_t unk1;
uint8_t width, height;
uint16_t unk2;
uint16_t unk3;
} T2FSTextureHeader;
Four types of textures have been spotted.
- Type 0x00: 8 bit indexed with 16 bit RGBA5551 palette. The palette usually is 512 bytes in size which is good for 256 colors but some textures only have 32 bytes palette, which is good for only 16 colors.
- Type 0x01: 4 bit indexed with 16 bit RGBA5551 palette. The palette size is 32 bytes in size, which is good for 16 colors.
- Type 0x02: Not encountered.
- Type 0x03: Is guessed that it's an 8 bit alpha value. These are probably used for effects. There is a 32 bytes palette defined tho. Setting the 8bit value for the alpha channel and using the color defined inside the model material yields good results.
- Type 0x04: MIPMAPS data.
The width and height defined in the header are shift values. Note that for some reason we need to subtract one from the width shift value for texture type 3.
if (texture->header->type == 3) {
texture->width = 1 << (texture->header->width - 1);
}
else {
texture->width = 1 << texture->header->width;
}
texture->height = 1 << texture->header->height;
It is usefull to understand what image formats the N64 supports, for that see https://n64squid.com/homebrew/n64-sdk/textures/image-formats/