## Re: Rigorious gamma bookeeping

I would like to weigh in and say that sRGB is all about being approximately correct instead of exactly wrong. The point of sRGB is not about exact color reproduction (despite what they say in the spec), but it is about coping with a freaking power law to a first order approximation.

For instance, take the distance attenuation of a light source. It should be 1/r^2, so the distance attenuation is a power law itself. But if you output the calculated values into a framebuffer that is going to be displayed by a monitor with gamma 2.2, your distance attenuation (against a black background) would be 1/r^4.4, way to steep than what you had in mind. Another point would be addition of light contributions, say, diffuse plus specular, or the sum of multiple light sources. So you enable your trusty GL_ONE, GL_ONE blending function, but strangely, the lighting is all washed out and saturates way too fast, and that's because you are not calculating C = A + B, but what you are really doing is C = ( A^0.4545 + B^0.4545 )^2.2. Good luck with that blending function.

So sRGB came to the rescue of this. And it really doesn't matter if the true gamma is 2.1, 2.2 or 2.3. sRGB is inherently approximate because it's very birth consists of declaring the average 1998 CRT display as the standard.

I find It very sad that the language of the OpenGL spec seems to miss the point by hinting that sRGB is about a precision thing and "lower than 8-bit precision sRGB conversion would not be needed". That is exactly what I needed when I had dynamically baked terrain textures in 5/6/5 bit (to save on memory). I remember that the ATI 9700 would sRGB convert these, but that suddenly newer cards silently didn't do the conversion anymore. So I had to manually convert in the pixel shader, which I think is bad because it breaks orthogonality (in the same way as when the shader has to divide short texture coords by 32767). I didn't even do pow(2.2), I used a simple square *= (which amounts to gamma 2.0) which is entirely sufficient, the users wouldn't notice a difference visually.