Edited wiki page through web user interface.

import/raw
castano 17 years ago
parent 9d74211cf2
commit bc72f1342b

@ -1,6 +1,6 @@
#summary Various DXT compression tricks.
=== Pure Greys ===
== Pure Greys ==
A typical problem when using DXT compression is that it's not possible to obtain pure greys (the same applies to any format that stores RGB colors in 565 bits). This is usually a problem when compressing lightmaps, since white light results in colored patches. However, that can be avoided transforming the colors to YCoCg-R color space as follows:
@ -52,11 +52,19 @@ for(int i = 0; i < 256; i++)
Note that signed components are packed as unsigned integers, so they need to be scaled and biased. In order to obtain pure greys, the bias that you have to use to reconstruct the color is equal to 255/2 quantized to 5 bits, that's why 123 is used. While this method allows you to obtain pure greys, it introduces more errors in the colors away from grey. So, it may not always be a good idea to use it.
=== Higher Quality Compression ===
== Higher Quality Compression ==
=== YCoCg-DXT5 ===
A simple way of obtaining higher quality compression is also using the YCoCg color space, but encoding the Y component in the in the alpha channel of a DXT5 block, and the !CoCg components in the RGB channels. That was originally suggested by Waveren in [http://www.intel.com/cd/ids/developer/asmo-na/eng/dc/index.htm Real-Time DXT Compression]. This approach was described in more detail by Waveren and Castano in [http://developer.nvidia.com/object/real-time-ycocg-dxt-compression.html Real-Time YCoCg-DXT Compression].
[http://www.humus.ca Emil Persson (aka Humus)] also has [http://www.humus.ca/index.php?page=3D&ID=68 a demo] that implements a similar idea, but using YCbCr color space instead. He is actually using two textures, either one ATI1N (DXT5A) texture to store the luma (Y) and one ATI2N (3Dc) texture to store the chroma (!CbCr), or one DXT1 texture to store the luma and one DXT5 (really DXT5nm) texture to store the chroma. The second texture that stores the chroma is a quarter the size to achieve a compression to 6 bits per pixel, as opposed to 8 bits per pixel for YCoCg DXT5. Although the compression ratio is good, you end up with two texture lookups.
=== Humus' Compression ===
[http://www.humus.ca Emil Persson (aka Humus)] also has [http://www.humus.ca/index.php?page=3D&ID=68 a demo] that implements a similar idea, but using YCbCr color space instead. He is actually using two textures, either one ATI1N (BC4/DXT5A) texture to store the luma (Y) and one ATI2N (BC5/3Dc) texture to store the chroma (!CbCr), or one DXT1 texture to store the luma and one DXT5 (really DXT5nm) texture to store the chroma. The second texture that stores the chroma is a quarter the size to achieve a compression to 6 bits per pixel, as opposed to 8 bits per pixel for YCoCg DXT5. As shown in the table below, the compression ratio is not as good as YCoCg-DXT5. It also has lower performance, since it requires two texture lookups.
[http://transfer.idsoftware.com/private/jan/publications/Rage/YCoCgDXT/images/humus.png]
=== Tom Forsyth's Compression ===
Another alternative is one suggested by [http://www.eelpi.gotdns.org/ Tom Forsyth]:

Loading…
Cancel
Save