- Home /
 
 
               Question by 
               RyanSpicer · Jun 10, 2013 at 05:49 PM · 
                shadertransparencyalpha  
              
 
              Shaders -- Tinting while respecting texture alpha
I'm trying to write an unlit shader that supports both transparency and tinting. I've got tinting working, but right now the shader does not respect the alpha channel of the Base texture. I'm sure this must be a simple fix, but I'm new to Unity shaders.
 // Derived from Unlit/Transparent
 
 Shader "Custom/UnlitTransparentTint" {
 Properties {
     _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     _Color ("Tint Color", Color) = (1,1,1) 
 }
 
 SubShader {
     Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
     LOD 100
     
     ZWrite Off
     Blend SrcAlpha OneMinusSrcAlpha 
 
     Pass {
         Lighting Off
         
         SetTexture [_MainTex] {
             constantColor [_Color]
             combine texture * constant, constant 
         } 
     }
 }
 }
 
 
              
               Comment
              
 
               
              http://docs.unity3d.com/Documentation/Components/SL-SetTexture.html
Separate Alpha & Color computation
Your answer