2018-11-20 07:49:14 +08:00
|
|
|
Shader "Hidden/SoftMask" {
|
|
|
|
|
2020-05-01 17:38:37 +08:00
|
|
|
SubShader {
|
|
|
|
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
|
|
|
|
LOD 100
|
|
|
|
|
|
|
|
Cull Off
|
|
|
|
ZWrite Off
|
|
|
|
Blend SrcAlpha One
|
|
|
|
ColorMask [_ColorMask]
|
2018-11-20 07:49:14 +08:00
|
|
|
|
2020-05-01 17:38:37 +08:00
|
|
|
Pass {
|
|
|
|
CGPROGRAM
|
2018-11-20 07:49:14 +08:00
|
|
|
#pragma vertex vert_img
|
|
|
|
#pragma fragment frag
|
|
|
|
#pragma target 2.0
|
|
|
|
|
|
|
|
#include "UnityCG.cginc"
|
|
|
|
|
|
|
|
sampler2D _MainTex;
|
|
|
|
float _Softness;
|
2019-10-14 23:50:51 +08:00
|
|
|
float _Alpha;
|
2018-11-20 07:49:14 +08:00
|
|
|
|
|
|
|
fixed4 frag (v2f_img i) : SV_Target
|
|
|
|
{
|
2020-09-08 10:33:57 +08:00
|
|
|
half softness = max(_Softness, 0.0001f);
|
|
|
|
return saturate(tex2D(_MainTex, i.uv).a/softness) * _Alpha;
|
2018-11-20 07:49:14 +08:00
|
|
|
}
|
2020-05-01 17:38:37 +08:00
|
|
|
ENDCG
|
|
|
|
}
|
2018-11-20 07:49:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|