Hyluss

[Shader] Transparent with background color tint

Oct 18th, 2019
578
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.04 KB | None | 0 0
  1. Shader "Unlit/UnlitAlphaWithFade"
  2. {
  3.     Properties
  4.     {
  5.      
  6.         _Color("Color Tint", Color) = (1,1,1,1)
  7.      //   _Color2("Color Tint2", Color) = (1,1,1,1)
  8.         _MainTex("Base (RGB) Alpha (A)", 2D) = "white"
  9.     }
  10.  
  11.     Category
  12.     {
  13.         Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Opaque" "DisableBatching" = "True" }
  14.         Lighting Off
  15.         ZWrite Off
  16.         //ZWrite On  // uncomment if you have problems like the sprite disappear in some rotations.
  17.         Cull back
  18.         Blend SrcAlpha OneMinusSrcAlpha
  19.        
  20.         //AlphaTest Greater 0.001  // uncomment if you have problems like the sprites or 3d text have white quads instead of alpha pixels.
  21.         Tags {Queue = Transparent}
  22.  
  23.      
  24.  
  25.         SubShader
  26.         {
  27.            
  28.  
  29.                 Pass
  30.                 {
  31.              
  32.                         SetTexture[_MainTex]
  33.                         {
  34.                             ConstantColor[_Color]
  35.                             Combine Texture * constant
  36.                         }
  37.                 }
  38.  
  39.                 Pass
  40.                 {
  41.                         SetTexture[_MainTex]
  42.                         {
  43.                             ConstantColor[_Color2]
  44.                             Combine Texture * constant
  45.                         }
  46.                 }
  47.  
  48.                      
  49.  
  50.                  
  51.  
  52.                          // Use texture alpha to blend up to white (= full illumination)
  53.  
  54.                          /*
  55.                            SetTexture [_MainTex]
  56.                         {
  57.                            ConstantColor[_Color]
  58.                            
  59.                               Combine Texture * constant
  60.                         }
  61.  
  62.                         SetTexture [_MainTex] {
  63.                             constantColor (1,1,1,1)
  64.                             combine constant lerp(texture) previous
  65.                         }
  66.                         // Multiply in texture
  67.  
  68.                           SetTexture [_MainTex] {
  69.                            
  70.                             combine constant lerp(texture) previous
  71.                         }
  72.                         */
  73.                      
  74.                
  75.         }
  76.     }
  77. }
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment