DXTC: DXTC Examples and Technical Comparison
Document Summary: Comparison between DirectX Texture compression types with uncompressed and palettized. Excellent for all skill and experience levels.
Document Changelog: Last updated by Tom Lin (DemiurgeStudios?), for document summary. Original author was Lucas Alonso.
Introduction
Purpose
The purpose of this document is to enlighten you, the content creator, on when it is appropriate to use the DXTC format to compress your textures, and in which cases they're better left uncompressed, or palettized using Bright.
DXTC Fundamentals
The portion of the DXTC algorithm that concerns us for this document is the part that compresses color information, because this is done the same way in
ALL DXTC variants (DXT1-5). Color information is stored in a similar fashion as standard palettized bitmaps, but instead of storing a 256 color palette for the whole image, DXTC stores a small palette for every 4x4 block of pixels. Each of these mini-palettes can represent up to four colors, but two of the colors are interpolated from the other two and are not actually stored with the file. This allows you to compress a bitmap that would have normally been 65k into merely 32k, and therefore allows you to store twice the amount of textures in video memory, or store the same amount of textures but at double the resolution.
NVIDIA DXT1 Issue
The hardware implementation of the DXT1 decompressor on NVidia hardware has some problems with quality. This is because the texture is processed internally in 16bit color instead of 32bit, and therefore quality, particularly that of darker shades, suffers considerably. All the other DXTC formats (DXT2-5) are not affected by this problem, but they store alpha information, which isn't so great if the texture you're trying to compress doesn't even utilize the alpha channel. But since the only format that doesn't store alpha information has quality issues, you're limited to using it in very specific cases.
Examples
Texture 1
While you can't really tell the difference between the 3 textures with this example at normal scale, by zooming in we can begin to see the artifacts caused by DXTC compression (small blocks of uniform colors). In this case, the artifacting is barely appreciable even when magnified, so this type of texture would be ideal to use with DXTC. The in-game NVidia DXT1 looks quite blurry, so unless you don't mind the lost clarity, you might consider using DXT3.
Gradient
However, in this case you can plainly see the banding in the DXTC texture, while the Bright example retains full quality. Again, this is because the DXTC algorithm can only use 4 colors per 4x4 block of pixels, which means if there's enough color variation within the blocks, you get output like this. Definitely don't use DXT1 for this type of thing.
Texture 2
Like Example 1, this is the type of texture you would normally use DXTC on. It's very difficult to appreciate the lost quality of the DXTC compressed texture.
Texture 3
Again, a standard texture. While the DXTC artifacting is easily visible in the magnified texture, you would be hard pressed to tell the difference between the SOURCE texture and the DXTC compressed one. Bright does a great job as well.
Rainbow Gradient
In this example, you can plainly see that Bright is having a hard time turning the 42,000 colors used in this texture into just 256. While Bright's attempt is impressive, the DXTC compressed or the uncompressed 32bit texture are better choices in this type of situation. You should avoid DXT1.
Text/HUD Art
For composite text/hud images and related textures, you probably don't want to use DXTC, as this example shows. The block artifacting around the text makes it quite ugly. Bright or the uncompressed texture are better options.
DXTC Nightmare
This is truly unfair :-). With 16 unique colors in each 4x4 block, there's no way DXTC can even come close to compressing this in an acceptable manner. Bright has no problem, since there are only 16 unique colors in the whole texture.
Conclusions
- Avoid DXT1 when guaranteed quality is needed - choose another DXTC variant that doesn't have issues on NVidia hardware, and check your DXT1 textures on NVidia hardware before committing to them.
- Don't use DXTC for special purpose textures where quality is of utmost importance, like text and height maps.
- Do use DXTC when compressing normal textures, the quality degradation is barely noticeable (DXT3/5).
- Since 8bit palettized textures are converted to 32bit before uploading, there's no benefit to them except the smaller stored size on disk. Use only when they look the same as an uncompressed 32bit.