This repository has been archived by the owner on Jun 8, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathWavingGrassBillboard.shader
85 lines (69 loc) · 1.63 KB
/
WavingGrassBillboard.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Shader "Hidden/TerrainEngine/Details/BillboardWavingDoublePass" {
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)
}
CGINCLUDE
#include "UnityCG.cginc"
#include "TerrainEngine.cginc"
#pragma glsl_no_auto_normalization
struct v2f {
float4 pos : SV_POSITION;
fixed4 color : COLOR;
float4 uv : TEXCOORD0;
};
v2f BillboardVert (appdata_full v) {
v2f o;
WavingGrassBillboardVert (v);
o.color = v.color;
o.color.rgb *= ShadeVertexLights (v.vertex, v.normal);
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = v.texcoord;
return o;
}
ENDCG
SubShader {
Tags {
"Queue" = "Transparent-200"
"IgnoreProjector"="True"
"RenderType"="GrassBillboard"
}
Cull Off
LOD 200
ColorMask RGB
CGPROGRAM
#pragma surface surf Lambert vertex:WavingGrassBillboardVert alpha
#pragma exclude_renderers flash
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
fixed4 color : COLOR;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
o.Albedo = c.rgb;
o.Alpha = c.a * IN.color.a;
}
ENDCG
}
SubShader {
Tags {
"Queue" = "Transparent+200"
"IgnoreProjector"="True"
"RenderType"="GrassBillboard"
}
ColorMask RGB
Cull Off// Grass is two-sided, so don't cull either side
Lighting On
Pass {
CGPROGRAM
#pragma vertex BillboardVert
#pragma exclude_renderers shaderonly
ENDCG
AlphaTest Greater [_Cutoff]
SetTexture [_MainTex] { combine texture * primary DOUBLE, texture * primary }
}
}
Fallback Off
}