Awesome answer.
I verified and it is colorspace indeed.
I was not aware of such mechanism (I am not into shaders that deep).
Also I found Your posts from 2012 where You described its mechanisms.
So I assume that when I set any kind of Color (via Color Picker or sRGB texture) it is converted to Linear in shader (on shader input). So when I get channel in Shader and it returns 0.2 (while having 0.5 in color picker) it is because it was recalculated to linear on input to shader. And it is real linear value.
So my problem is that I form my input as Gamma and await it to be the same in shader while it is recalculated to linear.
So to get back value that was encoded in gamma channel I had to use LinearToGammaSpace?
It is for the case if I want to retrieve channel data (to modify position or uvs for example).
Am I right?
So simple fast fix (for current situation) is (if I get it right) to check if colospace is not gamma and convert linear color value to gamma to get appropriate color channel value (that was encoded in gamma color or texture), I updated code in dummy shader to:
worldPos.y = _MyColor.r * 10;
#if !defined(UNITY_COLORSPACE_GAMMA)
worldPos.y = LinearToGammaSpace(_MyColor.rgb).r * 10;
#endif
And it now works well. Note that I use opposite method then You specified.
Is it correct?
As of worldPos modification - I do modification, I use textures as displacement maps in world space.
As of UNITY_MATRIX_VP usage - right it would give the one line conversation.
I just stick to it as it gives me more concise way of writing. (ConvertOToW → ConvertWtoO → ConvertToClipPos). I would consider using one line. Thank You.