skurmedel Stuff

A nitpicky explanation of sRGB gamma correction

What is sRGB?

sRGB is a colour space, and a standard that is probably the most common colour space for computer displays. Wikipedia explains this better than me. If your stuff will be displayed on the internet, you are most likely targeting sRGB. This applies to virtually all PC games as well.

Why do we gamma correct?

Here are some good explanations:

  • http://www.cambridgeincolour.com/tutorials/gamma-correction.htm
  • http://www.cgsd.com/papers/gamma_intro.html

In the future I wish to put together an artist-friendly explanation with some interactive aids to explain the whole idea behind a linear workflow.

The power function

Now, after reading the above two links, you might think that gamma correction is simply raising each pixel p:s value by some number: and undoing the operation is simply .

As I’ll explain, for sRGB, this is not really correct. It works, but it is an approximation. If you want to be totally compliant with the standard, you need to use the functions below, which you’ll note is actually a piecewise function.

Linear to corrected

blabla

Corrected to linear

The reasoning behind the piecewise function

Using 2.2 as an approximation

Comparisons

GLSL code

Note about Rec709 and Rec2022