Hello all,
I am making a painting system, where you are able to use a brush and paint onto a render texture. I’ve made a shader that handles that and overall, it is quite a simple system. Everything works great when the color space is set to Gamma. However, if color space is Linear instead, there are a bunch of issues.
This snake looking thing is actually me painting with a normal brush. With gamma space, this whole thing would be all white, but with color space set to linear, there are some weird issues that create such a weird result.
I know that I might need to convert from linear to gamma or vice versa, but I am not sure where this conversion needs to happen.
This is pretty much how I am handling painting:
When I am painting, I am firstly creating an area map, like so:
fixed4 col = tex2D(_MainTex /* <-- Brush Mask */, i.uv);
col *= _OpacityJitter;
return saturate(col);
And then I tint this area map in another shader, like so:
fixed4 col = tex2D(_Source, i.uv);
col.rgb /= col.a;
col.rgb *= _Color.rgb;
col.rgb *= col.a;
col *= _Opacity;
return saturate(col);
I am also always using premultiplied alpha Blend One OneMinusSrcAlpha
What is the cause of this issue and what steps should I take to solve this problem?
Any help would be appreciated! Thank you!
