The most important compression types:
|DXT1||RGB||5-6-5||No alpha channel|
|DXT1 (a)||RGBA||5-6-5||1 bit alpha|
|DXT3||RGBA||5-6-5||4 bit alpha|
|DXT5_NM||XY||0-6-0-A||X is moved to G and Y to alpha|
|3Dc||XY||For normal maps|
The texture is divided into 4x4 pixel blocks, so-called texels. Under normal circumstances, these would occupy 16x32 (=512) bit. For 24 bit textures, the 8 empty bits are usually filled internally. A texel block is comprised of the following information: 2x16 bits for 2 colors (RGB565: red 5 bit, green 6 bit, blue 5 bit) and a section with 2 bit per pixel, so 16x2 bit. These 2 bit represent a color matrix of the 2 16 bit colors (these are again upsampled to 24 bit).
The following is true when an alpha channel is saved:
|01||2/3 color1 + 1/3 color2|
|10||1/3 color1 + 2/3 color2|
With DXT1 + alpha, colors 1 and 2 play an additional role. If color2 has a higher value, then the following is true:
|01||1/2 color1 + 1/2 color2|
Here every texel with a size of 4x4 pixels has access to 128 bits. The first coding is done in the first 64 bit of the alpha channel (4 bit per pixel = 16 gradients per pixel). The second block of 64 bit corresponds to DXT1 without an alpha channel.
It makes sense to use DXT3 for alpha channels with sharp boundaries. Soft blends are not as easily displayed.
Also makes 128 bits available, but only the alpha channel is interpolated. The first 64 bits are again used by the alpha channel. For colors, two 8 bit values are saved, followed by a block of 16x3 bits for values that are structured similarly to the table for DXT1.
If the value of color 1 is larger than the value of color 2, then following grades are applicable:
|001||6/7 color1 + 1/7 color2|
|010||5/7 color1 + 2/7 color2|
|011||4/7 color1 + 3/7 color2|
|100||3/7 color1 + 4/7 color2|
|101||2/7 color1 + 5/7 color2|
|110||1/7 color1 + 6/7 color2|
If the value of color 2 is larger, the following is applicable:
|001||2/5 color1 + 3/5 color2|
|010||3/5 color1 + 2/5 color2|
|011||4/5 color1 + 1/5 color2|
That means, DXT5 is meant for finer gradients and displays curves better. However, compared to DXT3 , it isn't as sharp and can sometimes lead to blocky artefacts. Most likely you will have to experiment with the types of compression to figure out which one works best for you.
The compression quality depends on the compression tool itself: how it defines the two colors and how it arranges them.
4 Normal maps
Normal maps are a bit more of a challenge. The compression algorithm of DXT often adds unwanted artefacts that can lead to diffused or even destroyed normal maps. To combat that, ATI developed an specific extension.
A normal map is made up of 3 coordinates (X, Y and Z), to better simulate the refraction of light on a surface, therefore enhancing the detail of the surface. For 3Dc only X and Y are saved, as Z can be reconstructed easily, because the length of the vector on normal maps is always equal to 1. That means, for the same compression rate, more space is available per pixel, compared to DXT.
To make it even more confusing, there are 2 versions of 3Dc. However, the only difference between them is the sequence of the X and Y alignments. The original variant uses FourCc ATI2 (this becomes clear after opening the file in a hex editor). If the channels are switched, then the ATI2 is followed by A2XY. But seeing as this doesn't belong to FourCc, neither Train Fever, nor most tools in general can differentiate. This leads to incorrect normal maps in the game itself. Another downside, is that only very few tools support the format, such as the standalone version of nVidia's DDS compressor or Intel's Texture Works plugin for Adobe Photoshop. NVidia's Photoshop plugin only supports ATI2.
3Dc ATI2A2XY is the Transport Fever standard used for normal maps. To use these compressions, one of the new PHYSICAL_ materials must be used.
6 Why do I need to know this?
Good question. If some areas are extremely smeared or a certain label or inscription is no longer legible, then using certain properties of the DXT format can be very useful. The texel size of 4 is the first way: simply moving the label or sharp edge by one or perhaps two pixels can already change the way it is being compressed. Overfilling the UV area by 8 pixels or more, along with optimizing same colors at seams is recommended. These areas also influence the two reference colors.
7 Which format is used for what?
DXT1 has the best compression ratio (6:1 for 24 bit textures, 8:1 for 32 bit textures), but can only offer a 'yes' or 'no' in your alpha channel. For textures with an alpha channel it is best to only use it if a transparency of 100% is desired. For textures without an alpha channel (dirt, rust, CBlend, METAL, GLOSS, AO, etc.) it is definitely the best choice because of the effective compression.
If an alpha channel is a requirement, then you'll have to decide if you want to use DXT3 or DXT5. Both compress in the same 4:1 ratio. Another possibility is to create a separate window or glass texture (for example: 16x16 pixels) in another file, so the rest can be compressed with DXT1. The downside to that is, you'll need a more detailed mesh, which also can hinder performance. It's up to you.
For normal maps, 3Dc is the way to go. But if you aren't using the new PHYSICAL_ materials, sticking to DT1 or TGA is better. DXT5_NM is not supported by Transport Fever.
8 Compression tools
|Tool||3Dc - version|
|NVIDIA Texture Tools||Photoshop Plugin|
Paint Shop Pro plugin
|Intel Texture Works||Photoshop plugin||ATI2A2XY||Download|
|Gimp DDS||Gimp plugin||ATI2||Download|
|NVIDIA DDS Utilities||Standalone||ATI2A2XY||Download|
|AMD Compress||Standalone / GUI||ATI2|
9 Additional links