I have the following shader:
Shader"Crop/TransparentWithAlphaMask"
{
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_AlphaTex ("Alpha (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent"}
LOD200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _AlphaTex;
structInput {
float2 uv_MainTex : TEXCOORD0;
float2 uv2_AlphaTex : TEXCOORD1;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
fixed4 alpha = tex2D(_AlphaTex, IN.uv2_AlphaTex);
o.Albedo = c.rgb * alpha.a;
o.Alpha = alpha.a;
}
ENDCG
}
Fallback "Diffuse"
}
It is supposed to mask the texture _MainTex with the alpha channel of texture _AlphaTex. They both require different UV sets (UV1 for _MainTex and UV2 for _AlphaTex)
This shader works perfectly in the editor but not when deployed to an iOS device. Does anyone know what is causing this issue? What renders in a black version of the alpha mask and nothing else (because of this I know it is using the correct UV’s for the mask texture).
The mesh I’m using for this is a dynamically built mesh generated at runtime, with shadows casting/receiving/light probes disabled.
Any help would be greatly appreciated.