Created
January 8, 2017 23:36
-
-
Save przemek-jablonski/a846b59186f4d0f0802d1a8a49ec7ee4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Custom/WavingDoublePass" { | |
Properties { | |
_WavingTint ("Fade Color", Color) = (.7,.6,.5, 0) | |
_MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {} | |
_WaveAndDistance ("Wave and distance", Vector) = (12, 3.6, 1, 1) | |
_Cutoff ("Cutoff", float) = 0.5 | |
_Cutoff2 ("Cutoff2", float) = 0.5 | |
} | |
SubShader { | |
Tags { | |
"Queue" = "Geometry+200" | |
"IgnoreProjector"="True" | |
"RenderType"="Grass" | |
} | |
Cull Off | |
LOD 200 | |
ColorMask RGB | |
CGPROGRAM | |
#pragma surface surf Lambert vertex:WavingGrassVert addshadow alphatest:_Cutoff2 | |
#pragma exclude_renderers flash | |
#include "TerrainEngine.cginc" | |
sampler2D _MainTex; | |
fixed _Cutoff; | |
struct Input { | |
float2 uv_MainTex; | |
fixed4 color : COLOR; | |
}; | |
void surf (Input IN, inout SurfaceOutput o) { | |
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color; | |
fixed4 d = tex2D(_MainTex, IN.uv_MainTex); | |
o.Albedo = c.rgb; | |
// o.Alpha = c.a; | |
o.Alpha = d.a; | |
clip (o.Alpha - _Cutoff); | |
// o.Alpha *= IN.color.a; | |
} | |
ENDCG | |
} | |
SubShader { | |
Tags { | |
"Queue" = "Geometry+200" | |
"IgnoreProjector"="True" | |
"RenderType"="Grass" | |
} | |
Cull Off | |
LOD 200 | |
ColorMask RGB | |
Pass { | |
Tags { "LightMode" = "Vertex" } | |
Material { | |
Diffuse (1,1,1,1) | |
Ambient (1,1,1,1) | |
} | |
Lighting On | |
ColorMaterial AmbientAndDiffuse | |
AlphaTest Greater [_Cutoff] | |
SetTexture [_MainTex] { combine texture * primary DOUBLE, texture } | |
} | |
Pass { | |
Tags { "LightMode" = "VertexLMRGBM" } | |
AlphaTest Greater [_Cutoff] | |
BindChannels { | |
Bind "Vertex", vertex | |
Bind "texcoord1", texcoord0 // lightmap uses 2nd uv | |
Bind "texcoord", texcoord1 // main uses 1st uv | |
} | |
SetTexture [unity_Lightmap] { | |
matrix [unity_LightmapMatrix] | |
combine texture * texture alpha DOUBLE | |
} | |
SetTexture [_MainTex] { combine texture * previous QUAD, texture } | |
} | |
} | |
Fallback Off | |
} | |
//http://answers.unity3d.com/questions/360854/vegetation-animation-on-non-terrain-mesh.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment