- 最后登录
- 2021-7-6
- 注册时间
- 2012-12-27
- 阅读权限
- 90
- 积分
- 76145
- 纳金币
- 53488
- 精华
- 316
|
Shader "czm/water"{
Properties{
_MainTex("MainTex",2D)="white"{}//
_NoiseTex("NoiseTex",2D)="white"{}//
_Size("NoiseSize",Range(0,1))=0.1
//
_Speed("WaterSpeed",Range(0,1))=1
_Scale("WaveScale",Range(0,2))=1
_Alpha("WaveAlpha", float)=1
_K("K",Range(0,1))=0.2
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
Blend SrcAlpha One
Cull Off
Lighting Off
ZWrite Off
Pass {
Tags { "LightMode" = "Vertex" }
CGPROGRAM
#pragma vertex vertPart
#pragma fragment fragPart
#include "unitycg.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
sampler2D _NoiseTex;
float4 _NoiseTex_ST;
float _Size;
float _Speed;
float _Scale;
float _Alpha;
float _K;
struct vs {
float4 pos OSITION;
float2 uv : TEXCOORD0;
float4 color : color;
};
vs vertPart (appdata_full v)
{
vs o;
o.pos = mul(UNITY_MATRIX_MVP,v.vertex);
o.uv = TRANSFORM_TEX(v.texcoord,_MainTex);
o.color=v.color;
return o;
}
fixed4 fragPart(vs i) : COLOR {
float2 noiseUV=i.uv;
noiseUV+=_Time*_Speed;//流动速度
fixed2 noiseCol = tex2D(_NoiseTex,noiseUV);
fixed2 mainUV=i.uv;//主uv
mainUV+=noiseCol*_K*_Size*_Scale;
fixed4 mainCol = tex2D(_MainTex,mainUV);
return mainCol*i.color*fixed4(1,1,1,_Alpha);
}
ENDCG
}
}
FallBack "Diffuse"
}
|
|