Unity水效果

由于Unity自带的水用起来实在不方便,而且效果一般,没办法只好自己重新写了一个,最终出来的效果感觉还想,如果觉得效果不好请勿喷。先上图,预览一下效果!
Unity水效果 - Util - Util

Shader:

Shader "Util's Shader/Water/Water Real"
{
Properties
{
_Color("Main Color", Color) = (1,1,1,1)
_SpecColor("Specular Color", Color) = (1,1,1,1)
_Shininess("Shininess", Range(0.01,5) ) = 0.01
_MainTex("Base (RGB) Gloss (A)", 2D) = "white" {}
_BumpMap("Normalmap", 2D) = "bump" {}
_RefractionColor("Refraction Color", Color ) = (1,1,1,1)
_RefractionDis("Refraction Distortion", Range(0,1) ) = 1
_ReflectColor("Reflection Color", Color) = (1,1,1,1)
_ReflectionDis("Reflection Distortion", Range(0,1) ) = 1
_ReflectionTex("Reflection Texture", 2D) = "black" {}
_Fresnel("Fresnel", Range(0,1) ) = 0
_WaveSpeed("Wave speed (map1 x,y; map2 x,y)", Vector) = (0.2,0.2,1,0)
}

SubShader
{
GrabPass {
Name "BASE"
Tags { "LightMode" = "Always" }
}
Tags { "Queue"="Transparent" "IgnoreProjector"="False" "RenderType"="Opaque" }
Cull Back
Lighting Off
CGPROGRAM
#pragma surface surf BlinnPhongGlass dualforward
#pragma target 3.0

inline fixed4 LightingBlinnPhongGlass ( inout SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
{
half3 h = normalize (lightDir + viewDir);
fixed diff = max (0, dot (s.Normal*2, lightDir));
float nh = max (0, dot (s.Normal, h));
float spec = pow (nh, s.Specular*128.0) * s.Gloss;
fixed4 c;
c.rgb = (s.Albedo * _LightColor0.rgb * diff + _LightColor0.rgb * _SpecColor.rgb * spec) * (atten * 2);
c.a = s.Alpha + _LightColor0.a * _SpecColor.a * spec * atten;
s.Alpha = s.Alpha + c.a + c.rgb;
return c;
}

sampler2D _GrabTexture;
fixed4 _Color;
half _Shininess;
sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _ReflectColor;
sampler2D _ReflectionTex;
half _ReflectionDis;
fixed4 _RefractionColor;
half _RefractionDis;
half _Fresnel;
float4 _WaveSpeed;

struct Input {
float2 uv_MainTex;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值