Shader "Custom/ClickWaterEffect" {
Properties {
_MainTex ("MainTex", 2D) = "White" {}
_F("波长", range(1, 30)) = 10
_A("幅度值", range(0, 0.1)) = 0.01 //幅度值
_R("波动半径", range(0, 1)) = 0
_S("水波速度", range(0, 30)) = 1
}
SubShader {
pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _MainTex_ST;
float _F;
float _A;
float _R;
float _S;
struct v2f {
float4 pos:POSITION;
float2 uv:TEXCOORD0;
};
v2f vert(appdata_full v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
//o.uv = v.texcoord.xy * _MainTex_ST.xy + _MainTex_ST.zw;
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
fixed4 frag (v2f IN) : COLOR
{
float2 uv = IN.uv;
float dis = distance(uv, float2(0.5, 0.5));
float scale
一个简单的水波浪效果Shader
最新推荐文章于 2022-12-21 15:26:39 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)