核心的思想是用一个透明的PLANE,但是可以显示阴影
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
|
Shader
"FX/Matte Shadow"
{
Properties{
_Color(
"Main Color"
, Color) = (1,1,1,1)
_MainTex(
"Base (RGB) Trans (A)"
, 2D) =
"white"
{}
_Cutoff(
"Alpha cutoff"
, Range(0,1)) = 0.5
}
SubShader{
Tags{
"Queue"
=
"AlphaTest"
"IgnoreProjector"
=
"True"
"RenderType"
=
"TransparentCutout"
}
LOD 200
Blend Zero SrcColor
CGPROGRAM
#pragma surface surf ShadowOnly alphatest:_Cutoff
fixed4 _Color;
struct
Input {
float2 uv_MainTex;
};
inline fixed4 LightingShadowOnly(SurfaceOutput s, fixed3 lightDir,
fixed
atten)
{
fixed4 c;
c.rgb = s.Albedo*atten;
c.a = s.Alpha;
return
c;
}
void
surf(Input IN, inout SurfaceOutput o)
{
fixed4 c = _Color;
o.Albedo = c.rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback
"Transparent/Cutout/VertexLit"
}
|
http://mec0825.net/blog/?p=126
本文转自jiahuafu博客园博客,原文链接http://www.cnblogs.com/jiahuafu/p/6824070.html如需转载请自行联系原作者
jiahuafu