Jump to content
  • Advertisement
Sign in to follow this  
Aidman

OpenGL Paletted textures

This topic is 4904 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have been wondering if index colored textures (less or equal to 8 bit) have any performance gain over “regular” 16/24/32 bit textures? Clearly there is a reduction in data size, if the driver doesn’t try to store all textures in a common bit-depth (does it?), but how much is really gained considering it has to convert to regular depth (which I presume it does at some point when rendered) In opengl there seem to be at least two ways to implement paletted textures. Is there a difference between using glPixelMapfv and glColorTableEXT, since most ATI cards don’t support GL_EXT_paletted_texture? I would guess that glPixelMapfv is software based, but does that mean it has no gain over regular textures, are there other differences? I am thankful for any input.

Share this post


Link to post
Share on other sites
Advertisement
There is no real advantage in terms of performance, at least when comparing to other low bandwidth texture formats (16bit rgb and dxtc/s3tc). Paletted textures are usually faster than raw 32bit ones, but pretty much anything is. They are slightly slower than a DXTC compressed texture of equal size.

So, the only reason to use them is the memory saving. And they have considerable advantages over other formats from this point of view. Compared to a 16 bit texture, they take only half of the memory, and can offer higher visual quality on smooth gradients (especially in the blue and red channels). Compared to DXTC/S3TC, while being larger, paletted textures offer significantly better quality if a good quantization algorithm is used.

Unfortunately, ATI doesn't support them, so they won't make a good general purpose texture format.

Only glColorTableEXT is the "real thing", since only the GL_EXT_paletted_texture extension will allow the GPU to directly store an indexed textures format in video memory. glPixelMapfv will simply blow a paletted texture up to raw 32bit image data, and further processing will continue as if you supplied this 32bit data directly.

Note that if your original texture data is already paletted, then you can use glPixelMapfv as a fallback path. If GL_EXT_paletted_texture is available, store it as indexed texture. And if it's not, then use glPixelMapfv in combination with a compressed texture format such as S3TC.

Share this post


Link to post
Share on other sites
not only ati but also the latest nvidia cards nv4X (and i suppose ALL future nvidia cards) dont support palletted textures.

also aidman, performance is the last thing to worry about :)

Share this post


Link to post
Share on other sites
Thanks for your replies.

I am looking into DXTC/S3TC compression, seems rather easy to implement compared to other image formats (not counting bmp) since ogl does most of the work. While paletted textures don't look as tempting anymore. Although it would have been nice to rapidly change color schemas form a pure fx standpoint.

As for performance, you have a good point zedzeek, but unfortunately it isn’t that easy for all boost techniques, since they might require heavy overhead which your application design ultimately needs to support. Even thought there is a risk of falling into a optimization frenzy and never coming out. Maybe I’m already down there :)

[Edited by - Aidman on January 18, 2005 4:14:09 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!