TEX0 (File Format)
This page describes the Mario Kart Wii TEX0 file format, as found within BRRES files. TEX0 files are texture files.
File Format
File Header
Offset | Type | Description |
---|---|---|
0x00 | String | The magic "TEX0" to identify the sub file. See »BRRES Sub Files« for other magics. |
0x04 | UInt32 | Length of the sub file. |
0x08 | UInt32 | Sub file version number. The number of sections (N) is dependent of this version number. See »BRRES Sub Files« for details. |
0x0C | Int32 | Offset to outer BRRES File. |
0x10 | Int32[N] | N section offsets. N is implied in the version number (offset 0x08). |
0x10+N*4 | Int32 | String offset to the name of this sub file. This name equal to the name of the entry name of the BRRES Index Group pointing to this data. |
0x14+N*4 | End of this header |
TEX0 Header
The TEX0 header follows direct behind the file header. For TEX0 version 3 it starts at offset 0x18 and has the following layout:
Offset | Size | Description |
---|---|---|
0x00 | 4 | Unknown, always 0 in MKW |
0x04 | 2 | Pixel width of the image |
0x06 | 2 | Pixel height of the image |
0x08 | 4 | Image format |
0x0c | 4 | Number of images (=N; 1..8 seen in MKW). In the data area the main image comes first followed by N-1 mipmaps. Each mipmap has half the width and half height of the previous image, rounded down. |
0x10 | 4 | Unknown, always 0 in MKW |
0x14 | 4 | The number of images minus 1 (= the number of mipmaps = N-1) as single precision floating point. |
0x18 | 4 | Unknown, always 0 in MKW |
0x1c | End of header / Start of a filler |
Image Data (Section 0)
The start of section 0 is defined in the file header. It contains the image data (see »TPL« and »Image Formats« for details).
Most TEX0 files contain additional mipmaps after the main image. These mipmaps have the same image format as the main image. Each mipmap has half the width and height of the previous image rounded down.
During rendering the mipmaps are used for textures that are distant. To render a given texture, the Wii generally computes how big it appears on screen, and then interpolates between the mipmap bigger and smaller than this size to produce texture information quickly. This behavior can be controlled by the materials sections within BRRES files. See Mipmap - Wikipedia, the free encyclopedia for more details.
ID | Name | Bits per pixel | Block width | Block height | Block size | Type |
---|---|---|---|---|---|---|
0x00 | I4 | 4 | 8 | 8 | 32 bytes | Gray |
0x01 | I8 | 8 | 8 | 4 | 32 bytes | Gray |
0x02 | IA4 | 8 | 8 | 4 | 32 bytes | Gray + Alpha |
0x03 | IA8 | 16 | 4 | 4 | 32 bytes | Gray + Alpha |
0x04 | RGB565 | 16 | 4 | 4 | 32 bytes | Color |
0x05 | RGB5A3 | 16 | 4 | 4 | 32 bytes | Color + Alpha |
0x06 | RGBA32 (RGBA8) | 32 | 4 | 4 | 64 bytes | Color + Alpha |
0x08 | C4 (CI4) | 4 | 8 | 8 | 32 bytes | Palette (IA8, RGB565, RGB5A3) |
0x09 | C8 (CI8) | 8 | 8 | 4 | 32 bytes | Palette (IA8, RGB565, RGB5A3) |
0x0A | C14X2 (CI14x2) | 16 | 4 | 4 | 32 bytes | Palette (IA8, RGB565, RGB5A3) |
0x0E | CMPR | 4 | 8 | 8 | 32 bytes | Color + optional Alpha (compressed) |
Tools
The following tools can handle TEX0 files:
- BrawlBox, by BlackJax
- BrawlCrate, by soopercool101.
- CTools Pack, by Chadderz
- SZS Modifier, by Chadderz
- Wiimms SZS Tools, by Wiimm