Any graphics cards support 8-bit palettized (indexed) textures?

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
This would be a really handy feature for a program I'm trying to write, but none of my cards support this.

I currently have to use ARGB textures - which would be fine apart from the fact the textures I'd like to work with are several hundred megatexels in size.

Any ideas?

Any clever tricks to emulate this - pixel shaders, etc.?
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
This describes some formats for mobile applications. Not sure if PC GPUs/drivers implement them but you could give the P8 format a try.

P8: An 8-bit format, color-indexed.
http://msdn2.microsoft.com/en-US/librar...le.directx.direct3d.format(VS.80).aspx

Also: A8P8: An 8-bit format, color-indexed with 8 bits of alpha.

I have seen somebody's MX440 video card log of some sort where it says supports texture format P8. I think you'll have to load your pallete into a LPDIRECTDRAWPALETTE or PaletteEntry structure. Not sure if this stuff is still supported in DX9.
 

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
Originally posted by: xtknight
This describes some formats for mobile applications. Not sure if PC GPUs/drivers implement them but you could give the P8 format a try.

Thanks. I'd already tried the P8 and A8P8 formats, and the texture creation call fails on all my cards, so I guess it isn't supported.

Anyway, I wanted the palette to provide a continuous tone throgh colourspace (like the 'heat signature' effect rather than to just provide 256 arbitary colours.

This slightly unusual use made it possible to use a custom pixel shader. I build a ramp lookup table in an 256x1 pixel HDR texture, and put my raw data in an L8 texture. I use my pixel shader to take the transformed, filtered pixel value and perform a filtered lookup on my ramp. The overall results are excellent.

However, because the pixel shader receives a filtered pixel from the texturing pipeline, this wouldn't work with arbitrary colour palettes - as you'd be performing filtering between arbitary colours, and then looking up the result.