Can Panda give me ...

the intensities (RGB values) of the pixels of an image read off disk? Since it can load texture images I assume that it has a lot of smarts with regards to image file formats. I just want to gain access to the pixel values so I can load a JPG or PNG to be used as a heightmap.


Is PNMImage what I want? … Mage_Class

Yes. :slight_smile:


jep you are right. panda can give you direct access on single pixel of images. have a look at the showcase. someone postet a heighmap loader there using the thing you are looking for. you can also modify images while they are in memory.



How about this. If I want to give some visual effect for the entire screen (framebuffer), i.e. shifting the colors down into grayscale. Then I need to flush the framebuffer into texture and shift the colors down, and slap it onto a fullscreen card ?

That would be one sensible approach. Probably easiest to render directly to a texture via, as shown in examples throughout the forums and in some of the the downloadable demos. Of course, it will be relatively expensive to copy the pixels of the texture into the CPU for desaturating, then writing them back out again. But if you’ve got the CPU cycles to spare, it’s perfectly doable, especially if you write the per-pixel desaturation loop in C, rather than in Python.

A faster approach, if you want to use shaders, is to write a shader that will desaturate the colors of the texture as its card is rendered, then apply that shader to the card that renders the texture onscreen. This keeps all the work on the graphics card, and avoids the need to copy the texture pixels in and out of video ram.

If your scene is simple enough (not too many different kinds of states in the scene), you might even write a shader that would desaturate your scene directly as it is rendered, and forego the render-to-texture completely.

Of course, don’t overlook cheesy effects like manipulating the vertices (or textures) of your scene directly to make it go all black-and-white. Or, if you can be satisfied with simply darkening your screen, you can just put a half-transparent black card in front of the camera.


Thanks for your reply. For reliable performance for any scene (simple-complicated) is desaturating the card using shader. It must be nice for a slow motion effect.
Thanks again.