There are five variations of the S3TC algorithm (named DXT1 through DXT5, referring to the FOURCC code assigned by Microsoft to each format), each designed for specific types of image data. All convert a 4x4 block of pixels to a 64-bit or 128-bit quantity, resulting in compression ratios of 8:1 or 4:1 with 32-bit RGBA input data. S3TC is a lossy compression algorithm, resulting in image quality degradation, an effect which is minimized by the ability to increase texture resolutions while maintaining the same memory requirements. Hand-drawn cartoon-like images do not compress well, nor does normal map data, both of which usually generate artifacts. ATI's 3Dc compression algorithm is a modification of DXT5 designed to overcome S3TC's shortcomings with regard to normal maps. Id Software worked around the normalmap compression issues in Doom 3 by moving the red component into the alpha channel before compression and moving it back during rendering in the pixel shader.
Like many modern image compression algorithms, S3TC only specifies the method used to decompress images, allowing implementers to design the compression algorithm to suit their specific needs, although the patent still covers compression algorithms. The early compression routines were not optimal, and although since greatly improved, hindered early adoption of S3TC by developers. The nVidia GeForce 1 through to GeForce 4 cards also used 16 bit interpolation to render DXT1 textures, which resulted in banding when unpacking textures with color gradients. Again, this created an unfavorable impression of texture compression, not related to the fundamentals of the codec itself.
If the first color value () is numerically greater than the second color value (), then two other colors are calculated, such that and . This mode operates similarly to mode 0xC0 of the original Apple Video codec.
Otherwise, if , then and is transparent.
The lookup table is then consulted to determine the color value for each pixel, with a value of 0 corresponding to and a value of 3 corresponding to . DXT1 does not store alpha data enabling higher compression ratios.
If , then six other alpha values are calculated, such that , , , , , and .
Otherwise, if , four other alpha values are calculated such that , , , and with and .
The lookup table is then consulted to determine the alpha value for each pixel, with a value of 0 corresponding to and a value of 7 corresponding to . DXT4's color data is premultiplied by alpha, whereas DXT5's is not. Because DXT4/5 use an interpolated alpha scheme, they generally produce superior results for alpha (transparency) gradients than DXT2/3. Some consider DXT5 to be the most flexible general purpose compression codec.
|FOURCC||DX 10 Name||Description||Alpha premultiplied?||Compression ratio||Texture Type|
|DXT1||BC1||1-bit Alpha / Opaque||N/A||8:1||Simple non-alpha|
|DXT2||(none)||Explicit alpha||Yes||4:1||Sharp alpha|
|DXT3||BC2||Explicit alpha||No||4:1||Sharp alpha|
|DXT4||(none)||Interpolated alpha||Yes||4:1||Gradient alpha|
|DXT5||BC3||Interpolated alpha||No||4:1||Gradient alpha|