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