DXT compression explained
| This page is a work-in-progress. Generic message - Please note some detail may possibly be missing or incorrect. |
Since the introduction of the compressed DXT texture types in Flight Simulator, choosing the right type of compression has often lead to discussion. What are the differences between DXT1 and DXT3 for example? The latter one gives me a bigger filesize, so does that not mean better quality of my texture?
This article hopes to explain the differences between the different formats, so that you can make a good choice which compression to use. Also will it explain how the compression itself works, so that you understand the influence it has on the quality of your texture.
DXT1
The first compression we will look at is DXT1. This is the most simple compression and also the basis for the other types.
But let's start with a note about compression itself. You have probably noticed that the DXT compressed textures always have the same size. This is because they have a fixed compression ratio. Because the resulting size is fixed, it also means that the quality loss of the compression depends on the original texture you used.
When storing the RGBA information of your texture each pixel requires 32 bit to store the information. For DXT compressions the texture is split into segments of 4x4 pixels which are then compressed. These 16 pixels take 512 bits to store without the compression.
When compressing a 4 colour palette is determined for these 16 pixels. Afterwards each pixel will get an index into this palette, which only requires 2 bit per pixel. For the palette only two colours are stored, the two extremes, and the other two colours are interpolated between these extremes. The colour information is also stored with a compression so that only 16 bits are used per colour. This means that these 16 pixels of the texture only take 64 bits to store (32 for the palette and 32 for the indexing). That is a compression ratio of 1:8.