- Home /
 
Color changing texture and blending it with another texture
I'm currently trying to do a custom shader that lets me change the color of the texture and later uses the color changed texture to blend with another texture. Individually both of these functions worked, but when I try to combine them in one shader script the latter(blending) stopped working. My knowledge on shader is really minimum so detailed guidelines are appreciated.
 Shader "Custom/AlphaBlendTransition" 
 {
     Properties
     {
         //FOR COLOR
         _Color("Color",COLOR) = (1,1,1,1.0)
 
         //FOR BLENDING
         _Blend("Blend", Range(0, 1)) = 0.0
         _BaseTexture("Base Texture", 2D) = "white" {}
         _OverlayTexture("Texture 2 with alpha", 2D) = "white" {}
 
     }
 
     SubShader
     {
         Tags{ "RenderType" = "Opaque" }
         LOD 150
         CGPROGRAM
 #pragma surface surf Lambert finalcolor:mycolor
 
         struct Input //REFERENCE BASETEXTURE UV
         {
             float2 uv_BaseTexture;
         };
 
         fixed4 _Color;
 
         void mycolor(Input IN, SurfaceOutput o, inout fixed4 color) //GET THE CHANGED COLOR VALUE
         {
             color *= _Color;
         }
 
         sampler2D _BaseTexture;
 
         void surf(Input IN, inout SurfaceOutput o) //APPLY CHANGED COLOR VALUE TO BASETEXTURE
         {
             o.Albedo = tex2D(_BaseTexture, IN.uv_BaseTexture).rgb;
         }
         ENDCG
 
         Pass
         {
             SetTexture[_BaseTexture]
             SetTexture[_OverlayTexture]
             {
                 ConstantColor(0,0,0,[_Blend])
                 combine texture Lerp(constant) previous
             }
         }
     }
 }
 
              
               Comment
              
 
               
              Your answer