Guest User

Untitled

a guest
Sep 21st, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. Shader "Hidden/Nature/Tree Soft Occlusion Leaves Rendertex" {
  2.     Properties {
  3.         _Color ("Main Color", Color) = (1,1,1,0)
  4.         _MainTex ("Main Texture", 2D) = "white" {}
  5.         _Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
  6.         _HalfOverCutoff ("0.5 / Alpha cutoff", Range(0,1)) = 1.0
  7.         _BaseLight ("Base Light", Range(0, 1)) = 0.35
  8.         _AO ("Amb. Occlusion", Range(0, 10)) = 2.4
  9.         _Occlusion ("Dir Occlusion", Range(0, 20)) = 7.5
  10.        
  11.         // These are here only to provide default values
  12.         _Scale ("Scale", Vector) = (1,1,1,1)
  13.         _SquashAmount ("Squash", Float) = 1
  14.     }
  15.     SubShader {
  16.  
  17.         Tags { "Queue" = "Transparent-99" }
  18.         Cull Off
  19.         Fog { Mode Off}
  20.        
  21.         Pass {
  22.             Lighting On
  23.             ZWrite On
  24.  
  25.             CGPROGRAM
  26.             #pragma vertex leaves
  27.             #pragma fragment frag
  28.             #pragma glsl_no_auto_normalization
  29.             #define USE_CUSTOM_LIGHT_DIR 1
  30.             #include "SH_Vertex.cginc"
  31.            
  32.             sampler2D _MainTex;
  33.             fixed _Cutoff;
  34.            
  35.             fixed4 frag(v2f input) : COLOR
  36.             {
  37.                 fixed4 col = tex2D( _MainTex, input.uv.xy);
  38.                 col.rgb *= 2.0f * input.color.rgb;
  39.                 clip(col.a - _Cutoff);
  40.                 col.a = 1;
  41.                 return col;
  42.             }
  43.             ENDCG
  44.         }
  45.     }
  46.     SubShader {
  47.         Tags { "Queue" = "Transparent-99" }
  48.         Cull Off
  49.         Fog { Mode Off}
  50.        
  51.         Pass {
  52.             CGPROGRAM
  53.             #pragma exclude_renderers shaderonly
  54.             #pragma vertex leaves
  55.             #define USE_CUSTOM_LIGHT_DIR 1
  56.             #include "SH_Vertex.cginc"
  57.             ENDCG
  58.            
  59.             Lighting On
  60.             ZWrite On
  61.            
  62.             // We want to do alpha testing on cutoff, but at the same
  63.             // time write 1.0 into alpha. So we multiply alpha by 0.25/cutoff
  64.             // and alpha test on alpha being greater or equal to 1.0.
  65.             // That will work for cutoff values in range [0.25;1].
  66.             // Remember that color gets clamped to [0;1].
  67.             AlphaTest GEqual 1.0
  68.             SetTexture [_MainTex] {
  69.                 combine primary * texture double, primary * texture QUAD
  70.             }
  71.         }
  72.     }
  73.    
  74.     Fallback Off
  75. }
Advertisement
Add Comment
Please, Sign In to add comment