TEX0 (File Format)

From Custom Mario Kart
(Redirected from TEX0)
Jump to: navigation, search

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 Size Description
0x00 4 The magic "TEX0" to identify the sub file. See »BRRES Sub Files« for other magics.
0x04 4 Length of the sub file.
0x08 4 Sub file version number. The number of sections (N) is dependent of this version number. See »BRRES Sub Files« for details.
0x0C 4 Offset to outer BRRES File (negative value).
0x10 N*4 N section offsets. N is implied in the version number (offset 0x08).
0x10+N*4 4 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.

Image Formats
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
(only 14 used)
4 4 32 bytes palette (IA8,RGB565,RGB5A3)
0x0E CMPR 4 8 8 32 bytes mini palettes in each block
RGB565 or transparent


The following tools can handle TEX0 files:


All about BRRES files

BRRES fileIndex GroupSub Files