Choose the right DXTC compression algorithm

Revision as of 09:54, 23 November 2006 by imported>Blade9722

--Blade9722 07:33, 23 November 2006 (EST)


Preface.

Altough most of what I'm describing should appear obvious and trivial to those skilled in the arts, I noticed there are some common mistakes which regularly appears also in the work coming from well-experienced texturers, so I think there's need for some clarifications.


Brief description of most common DXTC compression formats.

DXT1C/DXT1A.

Channels bit depth: 8:8:8:1 RGBA.

Compression ratio: 8:1.

The DXT1A is often described as "RGB texture with one-bit-depth alpha". Actually, for each pixel there are two available configurations: if the alpha channel is set to 1 (white), RGB channels store usual color info if the alpha channel is set to 0 (black), upon saving the texture RGB channel are set to 0 as well. In other words, each pixel could contain color info only if the alpha channel is set to white. This makes a sense, as a black alpha channel usually means that the pixel is completely transparent (invisible), so there's no need to store color info. This algorithm is tipically used for icons, decals, blood, tatoos, i.e. texture with a completely transparent part.

Instead, DXT1C is often described as "RGB texture withouth alpha channel". This is not true: the alpha channel is still present, but it completely white. Actually, there's no physical distinction between this and DXT1A, simply upon choosing DXT1C as compression algorithm the alpha channel is set to be completely white just before saving. This is tipically used for common completely opaque textures.

DXT3.

Channels bit depth: 8:8:8:8 RGBA.

Compression ratio: 4:1.

This is often described as "RGB texture with explicit alpha". It's commonnly used for partially transparent textures. There application field is the same of DXT5, theoretically you should use this when alpha channel is featuring steep variations. However, I must point out that from my personal experience in 99% of cases DXT5 will preserve better alpha channel detail, so if you don't have time enough to make a comparison, I recommend using DXT5 instead.

DXT5.

Channels bit depth: 8:8:8:8 RGBA.

Compression ratio: 4:1.

This is often described as "RGB texture with interpolated alpha". The application field is the same of DXT3, theoretically this should be chosen if alpha channel is featuring slow gradients. Again, from my personal experience this algorithm is better than DXT3 in most cases, so I recommend using DXT5 when a comparison is not available.

Notice that DXT1 compression ratio is double than DXT3,DXT5, and so it generates half size dds files. The three algorithms are different only for the alpha channel compression, the RGB part is exactly the same for all three. So if you don't need alpha blending you should use DXT1, as using DXT3 or DXT5 will only double dds file size without any improvement in visual quality. Instead, I regularly find out in texture replacement lots of DXT5 compressed textures with the default white alpha channel.

The most common mistake is this: some modders probably that DXT5 is increasing RGB visual quality, so they systematically use it caring whether alpha channel is used or not



Color map

Normal map

Glow map

- To be continued (later, I'm leaving now)