Guest User

WavingGrassBillboard.shader

a guest
Mar 14th, 2016
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. Shader "Hidden/TerrainEngine/Details/BillboardWavingDoublePass" {
  2. Properties {
  3. _WavingTint ("Fade Color", Color) = (.7,.6,.5, 0)
  4. _MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
  5. _WaveAndDistance ("Wave and distance", Vector) = (12, 3.6, 1, 1)
  6. }
  7.  
  8. CGINCLUDE
  9. #include "UnityCG.cginc"
  10. #include "TerrainEngine.cginc"
  11. #pragma glsl_no_auto_normalization
  12.  
  13. struct v2f {
  14. float4 pos : SV_POSITION;
  15. fixed4 color : COLOR;
  16. float4 uv : TEXCOORD0;
  17. };
  18. v2f BillboardVert (appdata_full v) {
  19. v2f o;
  20. WavingGrassBillboardVert (v);
  21. o.color = v.color;
  22.  
  23. o.color.rgb *= ShadeVertexLights (v.vertex, v.normal);
  24.  
  25. o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
  26. o.uv = v.texcoord;
  27. return o;
  28. }
  29. ENDCG
  30.  
  31. SubShader {
  32. Tags {
  33. "Queue" = "Transparent+200"
  34. "IgnoreProjector"="True"
  35. "RenderType"="GrassBillboard"
  36. }
  37. Cull Off
  38. LOD 200
  39. ColorMask RGB
  40.  
  41. CGPROGRAM
  42. #pragma surface surf Lambert vertex:WavingGrassBillboardVert alpha
  43. #pragma exclude_renderers flash
  44.  
  45. sampler2D _MainTex;
  46.  
  47. struct Input {
  48. float2 uv_MainTex;
  49. fixed4 color : COLOR;
  50. };
  51.  
  52. void surf (Input IN, inout SurfaceOutput o) {
  53. fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
  54. o.Albedo = c.rgb;
  55. o.Alpha = c.a * IN.color.a;
  56. }
  57.  
  58. ENDCG
  59. }
  60.  
  61. SubShader {
  62. Tags {
  63. "Queue" = "Transparent+200"
  64. "IgnoreProjector"="True"
  65. "RenderType"="GrassBillboard"
  66. }
  67.  
  68. ColorMask RGB
  69. Cull Off
  70. Lighting On
  71.  
  72. Pass {
  73. CGPROGRAM
  74. #pragma vertex BillboardVert
  75. #pragma exclude_renderers shaderonly
  76. ENDCG
  77.  
  78. AlphaTest Greater [_Cutoff]
  79.  
  80. SetTexture [_MainTex] { combine texture * primary DOUBLE, texture * primary }
  81. }
  82. }
  83.  
  84. Fallback Off
  85. }
Add Comment
Please, Sign In to add comment