- Home /
 
               Question by 
               karl_ · Nov 27, 2011 at 10:45 PM · 
                shadertransparencyunlit  
              
 
              Add Color Property to Unlit Alpha?
I'm attempting to add a Color field to the existing Unlit/Transparent shader. Here is what I have so far (Compiles, but does not actually modify the color):
 Shader "Custom/Unlit Transparent Color"
 {
     Properties 
     {
         _Color ("Main Color", COLOR) = (1,1,1,1)
         _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
     }
     
     SubShader 
     {
         Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
         LOD 100
         
         ZWrite Off
         Blend SrcAlpha OneMinusSrcAlpha 
         
         Material
         {
                Diffuse [_Color]
         }
         
         Pass
         {            
             Lighting Off
             SetTexture [_MainTex] { combine texture }
         } 
 
     }
 }
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by karl_ · Nov 27, 2011 at 11:44 PM
Found an answer at the Unify Wiki: http://www.unifycommunity.com/wiki/index.php?title=UnlitAlphaWithFade
Code:
 Shader "Unlit/UnlitAlphaWithFade"
 {
     Properties
     {
         _Color ("Color Tint", Color) = (1,1,1,1)   
         _MainTex ("Base (RGB) Alpha (A)", 2D) = "white"
     }
 
     Category
     {
         Lighting Off
         ZWrite Off
                 //ZWrite On  // uncomment if you have problems like the sprite disappear in some rotations.
         Cull back
         Blend SrcAlpha OneMinusSrcAlpha
                 //AlphaTest Greater 0.001  // uncomment if you have problems like the sprites or 3d text have white quads instead of alpha pixels.
         Tags {Queue=Transparent}
 
         SubShader
         {
 
              Pass
              {
                         SetTexture [_MainTex]
                         {
                     ConstantColor [_Color]
                    Combine Texture * constant
                 }
             }
         }
     }
 }
Your answer
 
 
             Follow this Question
Related Questions
Unlit Shader With Texture, Color, Overbrightness, and Alpha-based Transparency 0 Answers
How do I add transparency to a cg vertex lit shader 2 Answers
Transparent Diffuse Specular Normal Shader problem 1 Answer
Is there a way to have a transparent vertex shader recieve and cast Shadows? 0 Answers
transparent object: everything behind it appears in grayscale 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                