Skip to content

Commit

Permalink
Merge pull request #39 from ArthurD/support_rounded_masks
Browse files Browse the repository at this point in the history
Adds support for a mask itself to have 'rounded corners'.
  • Loading branch information
kirevdokimov authored Apr 4, 2023
2 parents 10116ba + b130613 commit 9f538c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UiRoundedCorners/IndependentRoundedCorners.shader
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
}

float alpha = CalcAlphaForIndependentCorners(i.uv, _halfSize.xy, _rect2props, _r);

#ifdef UNITY_UI_ALPHACLIP
clip(alpha - 0.001);
#endif

return mixAlpha(tex2D(_MainTex, i.uv), i.color, alpha);
}

Expand Down
5 changes: 5 additions & 0 deletions UiRoundedCorners/RoundedCorners.shader
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ Shader "UI/RoundedCorners/RoundedCorners" {
}

float alpha = CalcAlpha(i.uv, _WidthHeightRadius.xy, _WidthHeightRadius.z);

#ifdef UNITY_UI_ALPHACLIP
clip(alpha - 0.001);
#endif

return mixAlpha(tex2D(_MainTex, i.uv), i.color, alpha);
}

Expand Down

0 comments on commit 9f538c7

Please sign in to comment.