Gamma correction


Is there a way (or what is the way) in Panda to implement gamma correction? (for the whole scene)

That is possible by creating a postprocessing filter with a shader applied.

using a shader would be the most platform independant, but maybe not hardware? just wondering how this is could be done in for low-end gfx-cards. isnt applying a post effect shader a quite processing intensive method for such a task?

most probably there are driver/system interfaces for doing something like this. for example this page mentions such a interface for osx: … vices.html
however implementing this on a panda window may be pretty difficult…

I’m sure you could create a limited implementation by using a postprocessing filters without shaders, but using texture combine modes.

You can use to set the gamma correction function to t^(1/value). This uses a direct hook into the hardware table, and doesn’t rely on shader support. I believe this is currently implemented on Windows only.


Just for reference, if someone ever decides to implement it under Linux, it can be done using the XF86VidModeSetGamma function in the XFree86-VidModeExtension x11 extension.

note… setting the gamma under linux and not un-doing the changes can be quite annoying >.< wc3 did it and once it crashed it stayed like this for the entire desktop until rebooting.

Thanks, i tried it on windows and works fine.

The same problem happens on Windows–if Panda crashes hard while you’ve got the gamma set funny, the OS won’t set it back for you. It’s a problem in general. Panda will set it back automatically when you exit in any of the normal ways, including a Python exception; but if you get a segment fault or bus error, you’re done.