an attempt to separate out the alpha channel from the mainTex

greeting
i am desperate to find out a solution to make animated material transition effect, and i know very little about shader writing, so i attempt to modify one from a built in shader

my goal is to hav the alpha channel to use a separate texture slot on its own, so that my sprite animation script can work with it

i modified from the alpha test difuse shader

Shader "Turbojoys/turboShaders/TB_M_AlphaTest_Diffuse" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
	_Alpha ("Alpha", 2D) = "white" {}      //add in
	_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
}

SubShader {
	Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
	LOD 200
	
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff

sampler2D _MainTex;
sampler2D _Alpha;             //add in
fixed4 _Color;

struct Input {
	float2 uv_MainTex;
	float2 uv_Alpha;        //add in
};

void surf (Input IN, inout SurfaceOutput o) {
	fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
	fixed4 ca = tex2D(_Alpha, IN.uv_Alpha);        //add in
	o.Albedo = c.rgb;
	o.Alpha = ca.a;                //add in
}
ENDCG
}

Fallback "Transparent/Cutout/VertexLit"
}

with this i did get a separate slot for controlling the alpha , and the tile and offset did work as expected,

but the problem was the shadow would give no respect to the alpha generated by this shader,

now its completely like using depth map shadow in maya

can anyone help me with this.

anyhow, i made this attempt only for animated matt trans effect, so if there is some other better techniques or solutions out there, plz point me to them

thx in advance

Try changing your fallback shader to:

FallBack "Transparent/Cutout/Diffuse"

I don’t think the vertexlit stuff has the correct shadow pass collector. I could be wrong though.

i dont think that is the case, jRocket

at first, i modified from the built in Alpha_Diffuse shader, which i realize the no shadow situation after modified, then i look here 1487403--82825--$pic01.jpg

and realized this shader is not suppose to have shadow at all

then i took a look at the built in AlphaTest-Diffuse, and 1487403--82826--$pic02.jpg

this one has shadow by default, so i thought may i was modifying the wrong one from the start

but as you know, the problem just like i stated.

the one with shadow by default casts shadow fine without modified, but once i modified, the shadow would disregard my alpha