View Full Version : size of compressed texture in memory

11-12-2002, 01:24 AM
Hi! I'd like to know how much memory does an s3tc compressed texture consume in the vgacard's texture memory? 32bit and 24bit textures also. Can someone help me?

11-12-2002, 05:26 AM
Normally you get a ratio from 1:4 to 1:6 compared to uncompressed textures. The size taken by an uncompressed texture depends on its resolution, but also internal format.

For example, GL_RGBA8 should take 4 bytes per texel. If your texture is 512x512, it's 1 Mb of memory. If it's compressed, it's probably taking around 200 Kb.


11-12-2002, 05:33 AM
And using mipmaps, the used space is 1.3333333 times the level 0 mipmap (for all levels together!) for uncompressed textures.


11-12-2002, 07:21 AM
The compression ratio depends what you're comparing with what.

Lets take for example a GeForce (1/2/3/4, the whole familly...). Pixels are either encoded in 16bits or 32bits (in uncompressed formats).

So this give:

DXT1/DXT1a (aka S3TC) compared to RGB (16bits) has a compression ratio of 1:4
DXT1/DXT1a compared to RGB (24bits) and RGBA (32bits) has a ratio of 1:8
(compared to 24bits it would be 1:6 but on GeForce 24bits pixels are aligned on 32bits boundaries)

DXT3 and DXT5 have a compression ratio of 1:4 compared to RGB (24bits) and RGBA (32bits), and 1:2 compared to RGB (16bits)
(Note it doesn't make much sense to use DXT3 or DXT5 when working with RGB and not RGBA)

To put it in another way:

DXT1/DXT1a/S3TC stores 16 pixels in 64 bits.
DXT3/DXT5 stores 16 pixels in 128 bits.

[This message has been edited by GPSnoopy (edited 11-12-2002).]

11-13-2002, 12:24 AM
Thanks a lot!

11-13-2002, 07:55 AM
You simply might ask OpenGL. See http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_compression.txt

If you call glGet...() with parameter GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB it returns "the size (in ubytes) of the compressed texture image" [from the mentioned spec].


11-14-2002, 02:10 AM
Just what I need! http://www.opengl.org/discussion_boards/ubb/smile.gif Thanks!