- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
- 纳金币
- -1
- 精华
- 11
|
一个云效果shader,具体未经测试,可能会有些问题,下面是原作者发的一个效果截图:
Shader "Cloud/Lightning Cloud 02" {
Properties {
_MainTex ("article Texture", 2D) = "white" {}
}
Category {
Tags {
"Queue"="Transparent"
"IgnoreProjector"="***e"
"RenderType"="Transparent"
}
Alphatest Greater 0
ColorMask RGB
Cull Off
ZWrite Off
Fog {Mode Off}
SubShader {
Pass {
Tags {
"LightMode"="ForwardBase"
}
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
BindChannels {
Bind "Vertex", vertex
Bind "Texcoord", texcoord
Bind "Color", color
}
SetTexture [_MainTex] {
combine primary * texture
}
}
Pass {
Tags {
"LightMode"="ForwardAdd"
}
Lighting On
Blend One One
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fwdadd
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#include "AutoLight.cginc"
s***ct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD1;
LIGHTING_COORDS(3,4)
};
v2f vert (appdata_tan v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.uv = v.texcoord.xy;
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
sampler2D _MainTex;
float4 _LightColor0;
float4 frag(v2f i) : COLOR
{
float4 result;
float atten = LIGHT_ATTENUATION(i);
float4 textureColor = tex2D(_MainTex, i.uv);
result.rgb = _LightColor0.rgb * atten;
result.a = 0.5 * textureColor.a;
return result;
}
ENDCG
}
}
}
Fallback "Cloud/Cloud"
} |
|