Skip to content

Commit fa0aa3e

Browse files
authoredNov 19, 2024
Merge pull request #56 from nostek/fix/UIVertexColorAlwaysGammaSpace
Fix for "Vertex Color Always In Gamma Color Space"
2 parents 5260864 + 5ada4cb commit fa0aa3e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎UiRoundedCorners/ShaderSetup.cginc

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ struct v2f {
1313
UNITY_VERTEX_OUTPUT_STEREO
1414
};
1515

16+
int _UIVertexColorAlwaysGammaSpace;
17+
1618
v2f vert (appdata v) {
1719
v2f o;
1820
UNITY_SETUP_INSTANCE_ID(v);
@@ -22,11 +24,14 @@ v2f vert (appdata v) {
2224
o.vertex = UnityObjectToClipPos(v.vertex);
2325
o.uv = v.uv;
2426
o.color = v.color;
27+
if (_UIVertexColorAlwaysGammaSpace)
28+
if(!IsGammaSpace())
29+
o.color = float4(UIGammaToLinear(o.color.xyz), o.color.w);
2530
return o;
2631
}
2732

2833
inline fixed4 mixAlpha(fixed4 mainTexColor, fixed4 color, float sdfAlpha){
2934
fixed4 col = mainTexColor * color;
3035
col.a = min(col.a, sdfAlpha);
3136
return col;
32-
}
37+
}

0 commit comments

Comments
 (0)