Hello,
I have used this shader from this thread:
Shader "Sprites/AlphaCutoff"
{
Properties
{
_MainTex ("Sprite Texture", 2D) = "white" {}
_CutOff ("Cutoff", Range (0, 1)) = 0.5
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
half2 texcoord : TEXCOORD0;
};
fixed _CutOff;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = UnityObjectToClipPos(IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color;
return OUT;
}
sampler2D _MainTex;
fixed4 frag(v2f IN) : COLOR
{
fixed4 tex = tex2D(_MainTex, IN.texcoord);
if (tex.a > _CutOff) {
tex.a = 1;
return tex * IN.color;
} else {
return 0;
}
}
ENDCG
}
}
}
The code works as expected in uGUI, but Shader Instancing does not work as of 5.6. My shader-fu is weak, so if anybody can help out that would be greatly appreciated.
Thank you,
Ryan