Skip to main content
gamedev.net
🔒 Locked

Compression Formats

Started by Last Attacker 3 replies 550+ views
Original Post
Last Attacker
Last Attacker
I''ve been working on OpenGL for quite some time but I would like to know how the following texture compression formats work on your video card : * 16-bit * 32-bit (No compression here, right? Normal size) * Compressed (How?) * DXT1 (What is it? How does it work?) * DXT3 (Ditto) This is not important, just something of intrest I would like to know. Well I checked out these stuff when I was tuning the settings of my card through RivaTuner. Thanks // Last Attacker \\---=( LA )=---// LA Extreme \\

ICQ Number : 120585863

E-mail: laextr@icqmail.com

"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
mirex
mirex
As far as i know DXT means Direct-X DDS image compression, but I dont know about any desription of it ... im looking for it too.
Last Attacker
Last Attacker
Cool! Is that for Direct3D only! Or can OpenGL use it too!

// Last Attacker \\---=( LA )=---// LA Extreme \\

ICQ Number : 120585863

E-mail: laextr@icqmail.com

"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Excors
Excors
The actual compression part of DDS files is DXTC, or S3TC in the OpenGL part of the world, which works something like this:

4x4-pixel blocks are processed individually. For each block, two colours are chosen by the compressor, and stored in the compressed file. Two other colours are calculated from these -- 33% colour 1 plus 66% colour 2, and then 66% colour 1 plus 33% colour 2 -- and each pixel in the block is converted to the closest of these four colours. Since each pixel is then one of four colours, it only takes two bits to store that pixel.

The difficult part when compressing is choosing the initial two colours so that the compressed image looks as close as possible to the original image - it''s lossy compression, but unnoticeable (hopefully) on smoothly shaded textures.

Assuming a 16-bit input image, each uncompressed block would be 2 (bytes per pixel) * 16 (pixels) = 32 bytes. The compressed block is 2 (bytes per colour) * 2 (stored colours) + 0.25 (bytes per pixel) * 16 (pixels) = 8 bytes -- a quarter of the original size.

Decoding can be done fairly easily in hardware, since it''s just interpolating two colours and then doing a lookup for each pixel. Compression takes a lot longer, but it''s not a problem when the textures are stored already compressed (e.g. in DDS files).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.