shader--流动水

        看了shader一段时间,都没时间去真用到,今天策划说要做条河流以后。灵感以前貌似做过。趁有时间写个简单的。

Shader "xinghua/Water" {
Properties {
//名字(UI显示名字, 属性) = 初始化值
_WaterTexture("Water Texture" , 2D) = "white"{} 
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200

CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
//使用Lamert光照模型
#pragma surface surf Lambert


// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0


//声明变量
sampler2D _WaterTexture;


struct Input {
float2 uv_WaterTexture;
};




void surf (Input IN, inout SurfaceOutput o) {
//思路就是不断改变UV坐标
//拿到UVPos
float2 WaterUVPos = IN.uv_WaterTexture;
float X = 1 * _Time;
float Y = 2 * _Time;
WaterUVPos += float2(X,Y);
float4 c = tex2D(_WaterTexture,WaterUVPos);
//显示
o.Albedo = c.rgb;
}
ENDCG

FallBack "Diffuse"
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值