- Home /
 
               Question by 
               freakatet · Aug 10, 2017 at 09:47 PM · 
                shadersshader programmingshaderlab  
              
 
              shader unlit transparent + tint settings
HI guys, i have an unlit shader, with a separate image as alpha channel and i am trying to add a colour tint setting to it . this is what i have so far, if i take off the pass, the alpha is working but as soon i add the pass i have the tint but the alpha is gone.
what am i doing wrong ?
thanks!
 Shader "Custom/alpha1" {
 
   Properties{ 
        _Color ("Main Color", Color) = (1, 1, 1, 1) 
        _MainTex("Base (RGB)", 2D) = "white" 
        _AlphaTex("Color (RGB)", 2D) = "white" 
   } 
   SubShader{ 
        Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" } 
        LOD 100
        CGPROGRAM 
        #pragma surface surf NoLighting alpha 
        fixed4 LightingNoLighting(SurfaceOutput s, fixed3 lightDir, fixed atten) { 
             fixed4 c; 
             c.rgb = s.Albedo; 
             c.a = s.Alpha; 
             return c; 
        } 
        struct Input { 
             float2 uv_MainTex; 
             float2 uv_AlphaTex; 
        }; 
      
        sampler2D _MainTex; 
        sampler2D _AlphaTex; 
         
        void surf(Input IN, inout SurfaceOutput o) { 
             o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb; 
             o.Alpha = tex2D(_AlphaTex, IN.uv_AlphaTex).rgb;
        } 
        ENDCG 
         Pass {
          Lighting Off
          
          SetTexture [_MainTex] { 
              // Sets our color as the 'constant' variable
              constantColor [_Color]
              
              // Multiplies color (in constant) with texture
              combine constant * texture
          } 
      }
   } 
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                