S3 Texture Compression

from Wikipedia, the free encyclopedia

S3 Texture Compression ( S3TC , sometimes DXTn or DXTC ) is an originally for the Savage 3D developed texture compression system from S3 Graphics . In contrast to image compression algorithms such as JPEG, it is suitable for hardware-accelerated computer graphics , since it has a fixed data compression rate and only requires one memory access per texel . With its inclusion in DirectX 6.0, S3TC was quickly accepted by all manufacturers and is the predominant standard today. The DXT formats are supported as extensions in OpenGL .

Overview

S3TC consists of five formats which were named DXT1 to DXT5 after the FourCC identification assigned to them in DirectX and which differ in the way the alpha channel is handled . DXT2 and DXT4 are rarely used and, unlike the other three formats, are not part of the OpenGL extension for S3TC.

Like any other lossy compression algorithm , S3TC tries to minimize visible artifacts despite the high data pack rate. A texture with a significantly higher resolution can be used with the same memory requirements, which leads to a better result overall. Like most modern algorithms for image compression, S3TC only specifies how the data is unpacked, thus leaving scope for different approaches to compression. However, there are license fees because the basic implementation is covered by a patent.

With Direct3D 10, the five DXT levels were classified as deprecated . The difference between before and after multiplied alpha values ​​is no longer made. DXT1 becomes BC1, DXT2 and DXT3 become BC2, DXT4 and DXT5 become BC3.

Working principle

A total of five algorithms based on the same principle but designed for different types of image data have been developed. The texture is first broken down into 4 × 4 texel blocks. Two 16-bit RGB-565 colors are calculated from the 16 color values. The individual algorithms calculate further color values ​​from these two and save them in a lookup table . As in a graphic with a color palette , only the index of the most suitable color value is saved in the table for each texel and not the color of the texel itself. The entries there can be addressed with just a few bits, so that with 32 bit RGBA textures Compression rates of 8: 1 for DXT1 and 4: 1 for all other codecs result.

DXT1

In addition to the two 16-bit color values ​​per texel, a 2-bit index is calculated for each 4 × 4 texture block. A total of 64 bits are required per block and the lookup table can contain a maximum of four entries.

If the first color value is greater than the second, the other two are:

Otherwise applies:

Compared to the other algorithms, DXT1 compresses twice as much as no alpha values ​​are stored here.

DXT3

DXT3 compresses the color values ​​like DXT1, but there is no distinction between the two schemes, but always the first variant with four opaque colors, transparency is made possible by an additional 4-bit alpha channel. A total of 128 bits are required per block. DXT3 is particularly suitable for textures with hard transitions between transparent and opaque areas.

DXT5

DXT5 compresses the color values ​​like DXT1. Two 8-bit alpha values ​​are stored as well as one 3-bit value per pixel, which is used to interpolate between the alpha values. If the first alpha value is greater than the second, eight alpha values ​​are obtained by linear interpolation. Otherwise, only six alpha values ​​are produced by interpolation, while the other two are 0 and 1. 128 bits per block are required.

criticism

In practice, cartoon- like drawings and normal maps in particular have proven to be problematic. The 3Dc algorithm developed by ATI is based on S3TC, but compresses Normals Maps much more efficiently. Also Id Software dealt with the development of Doom 3 with the issue. The programmers at least partially circumvented the problem by swapping the red color channel with the alpha channel before and after compression.

To be able to use S3TC with Mesa 3D , the library libtxc_dxtn must be installed.

credentials

  1. Patent US5956431 : Fixed-rate block-based image compression with inferred pixel values. Filed October 2, 1997 , published September 21, 1999 .
  2. Deprecated Features (Direct3D 10)
  3. DOOM 3 Video Requirements
  4. S3TC with DRI drivers

Web links