Hi guys.
I was reading a book and doing some exercices, when I ran into the topic of gamma correction.
This is what I understood:
- in the old days monitors where not able to display 'gamma correct' / realistic looking lighting
- LCD and later/ newer monitors can do this without any problems
- the 'default' gamma correction for PC's can be achieved by raising color to the power of 2.2 (or 2 for practical/ performance reasons).
For mac that would be 1.8.
The general approach which delivers realistic/ gamma correct lighting:
- input textures (with colors, no normals/displacement etc.) and handpicked light colors are mostly in gamma space
- before doing calculations with them in your shaders, you convert them to linear space (by raising it to the power of 2)
- do all lighting calculations in linear space
My questions;
A - what do you think about the above/ is this the/ a good approach?
B - if so, how do you handle making the textures 'gamma-incorrect':
**. realtime in the shader directly after sampling the pixel?
**. in the asset pipeline, so the source textures with colors are already gamma-incorrect in the input?
Option 2 sounds better performance wise, because no 'decoding' is done in realtime.
C - would you convert light colors to linear space before or after multiplying it with it's intensity?
D - will the final output color be OK / gamma correct if all calculations are done in linear space?
Any input is appreciated.