Skip to content

TEX Format

Niema Moshiri edited this page May 27, 2019 · 17 revisions

TEX is a texture format and is used throughout Final Fantasy VII. The TEX format consists of a header, an optional palette, and bitmap data. Usually, data are stored as a palletized picture, with bitmap pixels referencing the palette. The color #000000 is often used to denote transparency (but not always; it depends on the color key status; more info later). The TEX format is very flexible and can take almost any non-paletted format as long as it is described properly in the header. This wiki might help decode the format.

Section 1: File Header

A TEX file's header gives general information about the TEX file.

4 bytes: Version

  • This is an unsigned integer and must always equal 1 for Final Fantasy VII to load

4 bytes: Unknown 1

  • These 4 bytes have unknown function

4 bytes: Color Key Flag

  • This is an unsigned integer
  • According to this, this must be 1 (i.e., 00000001) to enable transparent color
    • All the **ac files have it as 1

4 bytes: Unknown 2

  • These 4 bytes have unknown function

4 bytes: Unknown 3

  • These 4 bytes have unknown function

4 bytes: Minimum Number of Bits per Color

  • This is an unsigned integer
  • The D3D driver uses this to determine which texture format to convert to on load

4 bytes: Maximum Number of Bits per Color

  • This is an unsigned integer

4 bytes: Minimum Number of Alpha Bits

  • This is an unsigned integer

4 bytes: Maximum Number of Alpha Bits

  • This is an unsigned integer

4 bytes: Minimum Number of Bits per Pixel

  • This is an unsigned integer

4 bytes: Maximum Number of Bits per Pixel

  • This is an unsigned integer

4 bytes: Unknown 4

  • These 4 bytes have unknown function

4 bytes: Number of Palettes

  • This is an unsigned integer