Skip to content

Commit

Permalink
feat: option to disable softening completely
Browse files Browse the repository at this point in the history
close #98
  • Loading branch information
mob-sakai committed Sep 8, 2020
1 parent e035e87 commit dedd847
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Packages/SoftMaskForUGUI/Scripts/SoftMask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public enum DesamplingRate
[SerializeField, Tooltip("The desampling rate for soft mask buffer.")]
private DesamplingRate m_DesamplingRate = DesamplingRate.x1;

[SerializeField, Range(0.01f, 1), Tooltip("The value used by the soft mask to select the area of influence defined over the soft mask's graphic.")]
[SerializeField, Range(0, 1), Tooltip("The value used by the soft mask to select the area of influence defined over the soft mask's graphic.")]
private float m_Softness = 1;

[SerializeField, Range(0f, 1f), Tooltip("The transparency of the whole masked graphic.")]
Expand Down
3 changes: 2 additions & 1 deletion Packages/SoftMaskForUGUI/Shaders/Resources/SoftMask.shader
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Shader "Hidden/SoftMask" {

fixed4 frag (v2f_img i) : SV_Target
{
return saturate(tex2D(_MainTex, i.uv).a/_Softness) * _Alpha;
half softness = max(_Softness, 0.0001f);
return saturate(tex2D(_MainTex, i.uv).a/softness) * _Alpha;
}
ENDCG
}
Expand Down

0 comments on commit dedd847

Please sign in to comment.