close
Shader "ArtTools/SimpleWater" {
Properties{
_Color("Color", Color) = (1, 1, 1, 1)
_MainTex("Texture", 2D) = "white" {}
_WaveScale("Wave scale", Range(0.01, 0.3)) = 0.1
_Speed("Speed", Range(0.1, 2.0)) = 1.0
}
SubShader{
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f {
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
float _WaveScale;
float _Speed;
float4 _Color;
v2f vert(appdata v) {
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag(v2f i) : SV_Target {
float2 uv = i.uv;
uv.x += _Time.y * _Speed;
uv.y += sin(uv.x * _WaveScale) * _WaveScale;
fixed4 tex = tex2D(_MainTex, uv);
fixed4 color = tex * _Color;
return color;
}
ENDCG
}
}
}
全站熱搜
留言列表