Why doesn't this specific shader work on Mobile?
Hey, I kind of mixed a transparency shader, with a cutout shader, so far with good results! However, once I build it for iOS, transparency seems to be binary. (0% or 100%) Any idea why?
Shader "Transparent/TransparentCutout" {
Properties{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_CutTex("Cutout (A)", 2D) = "white" {}
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader{
Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _CutTex;
fixed4 _Color;
float _Cutoff;
struct Input {
float2 uv_MainTex;
float2 uv_CutTex;
};
void surf(Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
float ca = tex2D(_CutTex, IN.uv_CutTex).a;
o.Albedo = c.rgb;
if (ca > _Cutoff)
o.Alpha = c.a;
else
o.Alpha = 0;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
Comment