Processing Gamma Correction Function

edited May 2016 in GLSL / Shaders

I am doing some programming in Processing with P3D/OpenGL that involves color manipulations in linear RGB space. I need to convert the Processing color into linear RGB by removing the gamma correction. Are Processing colors in sRGB or is there a gamma function with a gamma of 2.2 or some other value?



  • Answer ✓

    I haven't looked at the source for this but I would suspect that the color in Processing canvas is sRGB (though antialias is done in linear space) and OpenGL window works in linear color.

    There is a tiny tiny chance that the textures are represented in sRGB space through conversion in OpenGL, but my guess is that they are in linear space.

    You can test this by generating your own gradient ramp and feeding it through your workflow. Then sample the gradient blocks and see what happens to it.

    I did a POC image processor that works in 32-bit float / channel mode and I used linearization in it - seemed to give visually correct results (for blur etc), though I didn't measure the values.

  • Great, thank you!

Sign In or Register to comment.