Game dev
Saved & recent

Gamma

Related terms: linear color space, sRGB, gamma correction

Image files and screens do not store brightness evenly. They use a curve called sRGB that spends more values on dark tones, where the eye is more sensitive.

Lighting math is only correct on real, linear light values. So color textures are decoded to linear when read, all shading happens in linear space, and the final frame is encoded back for the screen. Skipping this gives lighting that looks too dark and blends that look muddy.

Further reading
LearnOpenGL: gamma correction
0 0.25 0.5 0.75 1 0 0.25 0.5 0.75 1 linear light L encoded sRGB S 0 0.25 0.5 0.75 1 0 0.25 0.5 0.75 1 encoded sRGB S linear light L S 0.735 L 0.214 encode decode linear toe linear-light blend equal inputs50:50 encoded-value blend
Per channel on [0,1], sRGB encodes L as S = 12.92L when L ≤ 0.0031308, otherwise S = 1.055L^(1/2.4) − 0.055. It decodes S as L = S/12.92 when S ≤ 0.04045, otherwise L = ((S + 0.055)/1.055)^2.4. The swatches blend the same dark and light theme colors 50:50 in linear light (left) or encoded sRGB (right).

View in the full Game dev collection