FANDOM


UI AddOn

A TEX file is a texture file format used to store images for the game WildStar, and is fairly similar to other game texture file formats using DXT compression.

The TEX file structure consists of a constant size header, and then a number of pre-rendered 'mipmaps', stored smallest to largest, and all in the same format. Texture sizes must be powers of two, with a smallest dimension size of 4, though the two dimensions do not have to be equal; 512x256 is valid, but 512x200 is not. The first mipmap ('mipmap' level 0) is the smallest pre-rendered image; and each subsequent mipmap basically doubles both dimensions. The final 'mipmap' is the full size image with the size denoted in the header.

Structure Edit

TEX version 1 header Edit

struct tex1header {
  uint8_t    ident[4]; // "XFG\0" magic number (GFX)
  uint32_t   type;     // always type 0
  uint32_t   width;    // width in pixels, power of 2
  uint32_t   height;   // height in pixels, power of 2
  uint32_t   unk1;     // depth
  uint32_t   unk2;     // sides
  uint32_t   mips;     // count of stored mipmaps
  uint32_t   format;   // 0,1 = uncomp, 13 = dxt1, 14 = dxt3, 15 = dxt5
} tex1header;

Notes Edit

  • The actual number of 'mip' levels determined by the 'mips' field
  • For WildStar the 'type' should always be 0.
  • Some images do not contain the full compliment of pre-rendered mips, many only 1.
  • Each mip is stored in the same format, denoted by 'format'.
  • Format 0 and 1 'uncompressed' is stored canonical A8R8G8B8, which is essentially uncompressed 24-bit color with 8-bit alpha.
  • The header always fixed size 32-byte, and has no special data sections.

Compression Edit

DXT1, DXT3, DXT5 or Uncompressed 8-bit per channel ARGB.

Uncompressed Edit

If 'format' is 1 or 2, each mipmap contains plain 32-bit BGRA data.

DXTC compression Edit

DXT is an industry standard texture compression format, designed originally for efficiency in real time graphics rendering and decompression in hardware. Most current 3D hardware supports loading some form of DXTC data directly. See Wikipedia's entry on DXT compression for more detail.

If 'format' is 13, 14, or 15, each mipmap is composed of 4×4 blocks of pixels. The blocks and the pixels within each block are ordered from left to right, top to bottom.

DXT1 Edit

If 'format' is 13, then DXT1 compression is used.

Each block is 64 bits and begins with two 16 bit values, and are used to derived a 4 color palette. The values are interpreted as 565 RGB colors, with the least significant bits corresponding to blue, to create the first two colors in the palette.

DXT3 Edit

If 'format' is 14, then DXT3 compression is used.

Each block is 128 bits and begins identically to DXT1, except that no special color is reserved in the palette. It is followed by 16 4-bit values corresponding to the alpha values for each of the pixels in the block.

DXT5 Edit

If 'format' is 15, then DXT5 compression is used.

Each block is 128 bits and begins with two 8-bit values to create an 8 element lookup table for alpha values. The first two elements in the lookup table are copies of those values. If the first value is less than or equal to the second, the final two entries of the lookup table are reserved for transparent and opaque. The remaining entries are created by interpolating between the first two entries in the lookup table. The next 48 bits make up 16 3-bit values acting as lookups specifying the alpha values for each of the pixels in the block. The remaining 64 bits are identical to DXT1, except that no special color is reserved in the palette.

Tools Edit

  • Houston - the client AddOn editor that comes with WildStar can view TEX files
  • various third party tools

See Also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.