0
\$\begingroup\$

I have a 3D volume where every voxel is 16 bits. Is there anyway I can use some kind of compression to store the data so I can use less video ram? Webgl supported different compressiosn if you enable them with extension, but can I use them for a one channel data?

Like WEBGL_compressed_texture_s3tc only supports rgb and rgba data:

COMPRESSED_RGB_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT1_EXT
COMPRESSED_RGBA_S3TC_DXT3_EXT
COMPRESSED_RGBA_S3TC_DXT5_EXT

If its not possible in webgl, is it supported in OpenGL to compress a 16 bit values with one channel?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

In short: no.

S3TC and other compression formats will destroy your 16bit values.

Texture compression formats have a fixed compressed size and therefore need to be lossy in order to ensure this.

If you need 16bits of lossless data you must use a non-compressed format. Ideally GL_R16UI.

\$\endgroup\$
2
  • \$\begingroup\$ But if its ok with a little loss, can I use the S3TC with just a 16 bit value or is it just for compression rgb values of floats? \$\endgroup\$
    – hidayat
    Jan 15, 2015 at 7:21
  • \$\begingroup\$ Most compression methods compress a 4x4 block of 24bit RGB values into a 4x4 block of TWO 15bit RGB (5bit of red) values and 2 in-betweens colors for a total of 4 colors in a 4x4 block. Try it and see if it's acceptable for your project to cut down 16 bits down to 5, with only 4 values per 4x4 block. \$\endgroup\$ Jan 16, 2015 at 16:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .