I’m in the process of wrapping my head around linear and gamma color spaces so to convince myself that I understand it I created super simple shader that, from my understanding, should result in the same color.
fixed4 frag(v2f IN) : SV_Target
{
fixed3 startColor = fixed3(1, 1, 1) * 0.1;
fixed3 multiplyColor;
#if UNITY_COLORSPACE_GAMMA
multiplyColor = LinearToGammaSpace(startColor);
// None of these work either
// multiplyColor = fixed3(1, 1, 1) * LinearToGammaSpaceExact(0.1);
// multiplyColor = pow(startColor, 1 / 2.2);
#else
multiplyColor = startColor;
#endif
multiplyColor *= multiplyColor;
return fixed4(multiplyColor.rgb, 1);
}
But it doesn’t! The result of the shader (it’s on a sprite stretched to fill the screen) is below.

But shouldn’t this result in the same output? My understanding of how the gamma and linear workflows work is well represented by the image below.

Assuming that image is correct (which if it isn’t would be fantastic information!) then the flows and result should be the following:
Linear
Shader
result = 0.1 * 0.1 = 0.01
Step Before Display
final = 0.01 ^ (1 / 2.2) = 0.123284674
Final A = 0.123284674
Gamma
Shader
gammaCol = 0.1 ^ (1 / 2.2) = 0.351119173
result = gammaCol * gammaCol = 0.123284674
Step Before Display
Final B = 0.123284674
In the end Final A = Final B which is the value before we hand off to the display to apply its correction. But the end result is different? I’m not sure where I’m not following correctly or if something is going on that I do not understand. Any help would be appreciated!