Texture staging and indexed color


We have a special case in a world we are attempting to build in Panda3d. Many of our objects can be seen in two modes: one with their regular texture, and one with a greyscale (one-channel) texture.

Since only one channel is needed for the grey effect, we’ve taken to storing that texture information in the same file as the regular (colored) texture and using the TextureStage system to replace the regular texture with the grey texture when desired. This technique is working pretty well, but ideally I’d like to be able to get away from getting monochrome textures and instead map the alpha values to specific colors looked up from a palette.

Is it possible to use the TextureStage system to lookup texture colors from a palette, or have I officially crossed into “custom shader” country? If so, I may have to put the plan on ice; my computer’s graphics card isn’t beefy enough to handle most Cg language features.

Thank you for your help!

I’m not really sure what you’re asking for, but it is true that the fixed-function texturing pipeline is fairly limited in terms of mapping texture channels to arbitrary colors. The closest thing you’ve got is blend mode, described in the Panda3D manual, with which you can choose your favorite monochrome color in lieu of gray.

Anything fancier than that and you will probably need to write a custom shader.