?
?
Shader "Custom/waver"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Arange("Amplitute", float) = 1
_Frenquncy("Frenqunce", float) = 0.5
_Speed("Speed", float) = 0.5
_Speed2("Speed2", float) = 0.1
}
SubShader
{
// No culling or depth
//Cull Off ZWrite Off ZTest Always
Tags { "RenderType" = "Opaque" "Queue" = "Transparent" }
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;
float _Arange;
float _Frenquncy;
float _Speed;
float _Speed2;
v2f vert (appdata v)
{
v2f o;
float timer = _Time.y*_Speed;
float waver = _Arange * sin(timer+v.vertex.z *_Frenquncy);
v.vertex.y = v.vertex.y+waver;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 tmpUV = i.uv;
tmpUV.x -= _Speed2 * _Time.y;
tmpUV.y += _Speed2 * _Time.y;
fixed4 col = tex2D(_MainTex, tmpUV);
// just invert the colors
//col.rgb = 1 - col.rgb;
return col;
}
ENDCG
}
}
}
|