Advertisement
Guest User

WaveDoublePass

a guest
Aug 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/WavingDoublePass"
  2. {
  3.     Properties
  4.     {
  5.         _WavingTint("Fade Color", Color) = (.7,.6,.5, 0)
  6.         _MainTex("Base (RGB) Alpha (A)", 2D) = "white" {}
  7.         _WaveAndDistance("Wave and distance", Vector) = (12, 3.6, 1, 1)
  8.         _Cutoff("Cutoff", float) = 0.5
  9.         _Cutoff2("Cutoff2", float) = 0.5
  10.     }
  11.  
  12.     SubShader
  13.     {
  14.         Tags
  15.         {
  16.             "Queue" = "Geometry+200"
  17.             "IgnoreProjector" = "True"
  18.             "RenderType" = "Grass" 
  19.         }
  20.         Cull Off
  21.         LOD 200
  22.         ColorMask RGB
  23.  
  24.         CGPROGRAM
  25. #pragma surface surf Lambert vertex:WavingGrassVert addshadow alphatest:_Cutoff2
  26. #pragma exclude_renderers flash
  27. #include "TerrainEngine.cginc"
  28.  
  29.         sampler2D _MainTex;
  30.         fixed _Cutoff;
  31.  
  32.         struct Input
  33.         {
  34.             float2 uv_MainTex;
  35.             fixed4 color : COLOR;
  36.         };
  37.  
  38.         void surf(Input IN, inout SurfaceOutput o)
  39.         {
  40.             fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
  41.             fixed4 d = tex2D(_MainTex, IN.uv_MainTex);
  42.             o.Albedo = c.rgb;
  43.             o.Alpha = d.a;
  44.             clip(o.Alpha - _Cutoff);
  45.         }
  46.         ENDCG
  47.     }
  48.  
  49.     SubShader
  50.     {
  51.         Tags
  52.         {
  53.             "Queue" = "Geometry+200"
  54.             "IgnoreProjector" = "True"
  55.             "RenderType" = "Grass"
  56.         }
  57.         Cull Off
  58.         LOD 200
  59.         ColorMask RGB
  60.  
  61.         Pass
  62.         {
  63.             Tags{ "LightMode" = "Vertex" }
  64.             Material
  65.             {
  66.                 Diffuse(1,1,1,1)
  67.                 Ambient(1,1,1,1)
  68.             }
  69.             Lighting On
  70.             ColorMaterial AmbientAndDiffuse
  71.             AlphaTest Greater[_Cutoff]
  72.             SetTexture[_MainTex]{ combine texture * primary DOUBLE, texture }
  73.         }
  74.         Pass
  75.         {
  76.             Tags { "LightMode" = "VertexLMRGBM" }
  77.             AlphaTest Greater[_Cutoff]
  78.             BindChannels
  79.             {
  80.                 Bind "Vertex", vertex
  81.                 Bind "texcoord1", texcoord0 // lightmap uses 2nd uv
  82.                 Bind "texcoord", texcoord1 // main uses 1st uv
  83.             }
  84.             SetTexture[unity_Lightmap]
  85.             {
  86.                 matrix[unity_LightmapMatrix]
  87.                 combine texture * texture alpha DOUBLE
  88.             }
  89.             SetTexture[_MainTex]{ combine texture * previous QUAD, texture }
  90.         }
  91.     }
  92.     Fallback Off
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement