unity2017 water中的water4怎么调波长?

/ UnityProject
项目语言:None
权限:read-only(如需更高权限请先加入项目)
UnityProject/
Shader &FX/SimpleWater4& {
Properties {
_ReflectionTex (&Internal reflection&, 2D) = &white& {}
_MainTex (&Fallback texture&, 2D) = &black& {}
_BumpMap (&Normals &, 2D) = &bump& {}
_DistortParams (&Distortions (Bump waves, Reflection, Fresnel power, Fresnel bias)&, Vector) = (1.0 ,1.0, 2.0, 1.15)
_InvFadeParemeter (&Auto blend parameter (Edge, Shore, Distance scale)&, Vector) = (0.15 ,0.15, 0.5, 1.0)
_AnimationTiling (&Animation Tiling (Displacement)&, Vector) = (2.2 ,2.2, -1.1, -1.1)
_AnimationDirection (&Animation Direction (displacement)&, Vector) = (1.0 ,1.0, 1.0, 1.0)
_BumpTiling (&Bump Tiling&, Vector) = (1.0 ,1.0, -2.0, 3.0)
_BumpDirection (&Bump Direction & Speed&, Vector) = (1.0 ,1.0, -1.0, 1.0)
_FresnelScale (&FresnelScale&, Range (0.15, 4.0)) = 0.75
_BaseColor (&Base color&, COLOR)
= ( .54, .95, .99, 0.5)
_ReflectionColor (&Reflection color&, COLOR)
= ( .54, .95, .99, 0.5)
_SpecularColor (&Specular color&, COLOR)
= ( .72, .72, .72, 1)
_WorldLightDir (&Specular light direction&, Vector) = (0.0, 0.1, -0.5, 0.0)
_Shininess (&Shininess&, Range (2.0, 500.0)) = 200.0
_GerstnerIntensity(&Per vertex displacement&, Float) = 1.0
_GAmplitude (&Wave Amplitude&, Vector) = (0.3 ,0.35, 0.25, 0.25)
_GFrequency (&Wave Frequency&, Vector) = (1.3, 1.35, 1.25, 1.25)
_GSteepness (&Wave Steepness&, Vector) = (1.0, 1.0, 1.0, 1.0)
_GSpeed (&Wave Speed&, Vector) = (1.2, 1.375, 1.1, 1.5)
_GDirectionAB (&Wave Direction&, Vector) = (0.3 ,0.85, 0.85, 0.25)
_GDirectionCD (&Wave Direction&, Vector) = (0.1 ,0.9, 0.5, 0.5)
#include &UnityCG.cginc&
#include &WaterInclude.cginc&
struct appdata
float4 vertex : POSITION;
float3 normal : NORMAL;
// interpolator structs
struct v2f
float4 pos : SV_POSITION;
float4 normalInterpolator : TEXCOORD0;
float3 viewInterpolator : TEXCOORD1;
float4 bumpCoords : TEXCOORD2;
float4 screenPos : TEXCOORD3;
float4 grabPassPos : TEXCOORD4;
UNITY_FOG_COORDS(5)
struct v2f_noGrab
float4 pos : SV_POSITION;
float4 normalInterpolator : TEXCOORD0;
float3 viewInterpolator : TEXCOORD1;
float4 bumpCoords : TEXCOORD2;
float4 screenPos : TEXCOORD3;
UNITY_FOG_COORDS(4)
struct v2f_simple
float4 pos : SV_POSITION;
float3 viewInterpolator : TEXCOORD0;
float4 bumpCoords : TEXCOORD1;
UNITY_FOG_COORDS(2)
// textures
sampler2D _BumpM
sampler2D _ReflectionT
sampler2D _RefractionT
sampler2D _ShoreT
sampler2D_float _CameraDepthT
// colors in use
uniform float4 _RefrColorD
uniform float4 _SpecularC
uniform float4 _BaseC
uniform float4 _ReflectionC
// edge & shore fading
uniform float4 _InvFadeP
// specularity
uniform float _S
uniform float4 _WorldLightD
// fresnel, vertex & bump displacements & strength
uniform float4 _DistortP
uniform float _FresnelS
uniform float4 _BumpT
uniform float4 _BumpD
uniform float4 _GA
uniform float4 _GF
uniform float4 _GS
uniform float4 _GS
uniform float4 _GDirectionAB;
uniform float4 _GDirectionCD;
// shortcuts
#define PER_PIXEL_DISPLACE _DistortParams.x
#define REALTIME_DISTORTION _DistortParams.y
#define FRESNEL_POWER _DistortParams.z
#define VERTEX_WORLD_NORMAL i.normalInterpolator.xyz
#define DISTANCE_SCALE _InvFadeParemeter.z
#define FRESNEL_BIAS _DistortParams.w
// HQ VERSION
v2f vert(appdata_full v)
half3 worldSpaceVertex = mul(_Object2World,(v.vertex)).
half3 vtxForAni = (worldSpaceVertex).
Gerstner (
offsets, nrml, v.vertex.xyz, vtxForAni,
// offsets, nrml will be written
_GAmplitude,
// amplitude
_GFrequency,
// frequency
_GSteepness,
// steepness
_GDirectionAB,
// direction # 1, 2
_GDirectionCD
// direction # 3, 4
v.vertex.xyz +=
half2 tileableUv = worldSpaceVertex.
o.bumpCoords.xyzw = (tileableUv.xyxy + _Time.xxxx * _BumpDirection.xyzw) * _BumpTiling.
o.viewInterpolator.xyz = worldSpaceVertex - _WorldSpaceCameraP
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
ComputeScreenAndGrabPassPos(o.pos, o.screenPos, o.grabPassPos);
o.normalInterpolator.xyz =
o.normalInterpolator.w = 1;//GetDistanceFadeout(o.screenPos.w, DISTANCE_SCALE);
UNITY_TRANSFER_FOG(o,o.pos);
half4 frag( v2f i ) : SV_Target
half3 worldNormal = PerPixelNormal(_BumpMap, i.bumpCoords, VERTEX_WORLD_NORMAL, PER_PIXEL_DISPLACE);
half3 viewVector = normalize(i.viewInterpolator.xyz);
half4 distortOffset = half4(worldNormal.xz * REALTIME_DISTORTION * 10.0, 0, 0);
half4 screenWithOffset = i.screenPos + distortO
half4 grabWithOffset = i.grabPassPos + distortO
half4 rtRefractionsNoDistort = tex2Dproj(_RefractionTex, UNITY_PROJ_COORD(i.grabPassPos));
half refrFix = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(grabWithOffset));
half4 rtRefractions = tex2Dproj(_RefractionTex, UNITY_PROJ_COORD(grabWithOffset));
#ifdef WATER_REFLECTIVE
half4 rtReflections = tex2Dproj(_ReflectionTex, UNITY_PROJ_COORD(screenWithOffset));
#ifdef WATER_EDGEBLEND_ON
if (LinearEyeDepth(refrFix) & i.screenPos.z)
rtRefractions = rtRefractionsNoD
half3 reflectVector = normalize(reflect(viewVector, worldNormal));
half3 h = normalize ((_WorldLightDir.xyz) + viewVector.xyz);
float nh = max (0, dot (worldNormal, -h));
float spec = max(0.0,pow (nh, _Shininess));
half4 edgeBlendFactors = half4(1.0, 0.0, 0.0, 0.0);
#ifdef WATER_EDGEBLEND_ON
half depth = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos));
depth = LinearEyeDepth(depth);
edgeBlendFactors = saturate(_InvFadeParemeter * (depth-i.screenPos.w));
// shading for fresnel term
worldNormal.xz *= _FresnelS
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER);
// base, depth & reflection colors
half4 baseColor = _BaseC
#ifdef WATER_REFLECTIVE
half4 reflectionColor = lerp (rtReflections,_ReflectionColor,_ReflectionColor.a);
half4 reflectionColor = _ReflectionC
baseColor = lerp (lerp (rtRefractions, baseColor, baseColor.a), reflectionColor, refl2Refr);
baseColor = baseColor + spec * _SpecularC
baseColor.a = edgeBlendFactors.x;
UNITY_APPLY_FOG(i.fogCoord, baseColor);
return baseC
// MQ VERSION
v2f_noGrab vert300(appdata_full v)
half3 worldSpaceVertex = mul(_Object2World,(v.vertex)).
half3 vtxForAni = (worldSpaceVertex).
Gerstner (
offsets, nrml, v.vertex.xyz, vtxForAni,
// offsets, nrml will be written
_GAmplitude,
// amplitude
_GFrequency,
// frequency
_GSteepness,
// steepness
_GDirectionAB,
// direction # 1, 2
_GDirectionCD
// direction # 3, 4
v.vertex.xyz +=
half2 tileableUv = worldSpaceVertex.
o.bumpCoords.xyzw = (tileableUv.xyxy + _Time.xxxx * _BumpDirection.xyzw) * _BumpTiling.
o.viewInterpolator.xyz = worldSpaceVertex - _WorldSpaceCameraP
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.screenPos = ComputeScreenPos(o.pos);
o.normalInterpolator.xyz =
o.normalInterpolator.w = 1;//GetDistanceFadeout(o.screenPos.w, DISTANCE_SCALE);
UNITY_TRANSFER_FOG(o,o.pos);
half4 frag300( v2f_noGrab i ) : SV_Target
half3 worldNormal = PerPixelNormal(_BumpMap, i.bumpCoords, VERTEX_WORLD_NORMAL, PER_PIXEL_DISPLACE);
half3 viewVector = normalize(i.viewInterpolator.xyz);
half4 distortOffset = half4(worldNormal.xz * REALTIME_DISTORTION * 10.0, 0, 0);
half4 screenWithOffset = i.screenPos + distortO
#ifdef WATER_REFLECTIVE
half4 rtReflections = tex2Dproj(_ReflectionTex, UNITY_PROJ_COORD(screenWithOffset));
half3 reflectVector = normalize(reflect(viewVector, worldNormal));
half3 h = normalize (_WorldLightDir.xyz + viewVector.xyz);
float nh = max (0, dot (worldNormal, -h));
float spec = max(0.0,pow (nh, _Shininess));
half4 edgeBlendFactors = half4(1.0, 0.0, 0.0, 0.0);
#ifdef WATER_EDGEBLEND_ON
half depth = SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.screenPos));
depth = LinearEyeDepth(depth);
edgeBlendFactors = saturate(_InvFadeParemeter * (depth-i.screenPos.z));
worldNormal.xz *= _FresnelS
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER);
half4 baseColor = _BaseC
#ifdef WATER_REFLECTIVE
baseColor = lerp (baseColor, lerp (rtReflections,_ReflectionColor,_ReflectionColor.a), saturate(refl2Refr * 1.0));
baseColor = _ReflectionC//lerp (baseColor, _ReflectionColor, saturate(refl2Refr * 2.0));
baseColor = baseColor + spec * _SpecularC
baseColor.a = edgeBlendFactors.x * saturate(0.5 + refl2Refr * 1.0);
UNITY_APPLY_FOG(i.fogCoord, baseColor);
return baseC
// LQ VERSION
v2f_simple vert200(appdata_full v)
half3 worldSpaceVertex = mul(_Object2World, v.vertex).
half2 tileableUv = worldSpaceVertex.
o.bumpCoords.xyzw = (tileableUv.xyxy + _Time.xxxx * _BumpDirection.xyzw) * _BumpTiling.
o.viewInterpolator.xyz = worldSpaceVertex-_WorldSpaceCameraP
o.pos = mul(UNITY_MATRIX_MVP,
v.vertex);
UNITY_TRANSFER_FOG(o,o.pos);
half4 frag200( v2f_simple i ) : SV_Target
half3 worldNormal = PerPixelNormal(_BumpMap, i.bumpCoords, half3(0,1,0), PER_PIXEL_DISPLACE);
half3 viewVector = normalize(i.viewInterpolator.xyz);
half3 reflectVector = normalize(reflect(viewVector, worldNormal));
half3 h = normalize ((_WorldLightDir.xyz) + viewVector.xyz);
float nh = max (0, dot (worldNormal, -h));
float spec = max(0.0,pow (nh, _Shininess));
worldNormal.xz *= _FresnelS
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER);
half4 baseColor = _BaseC
baseColor = lerp(baseColor, _ReflectionColor, saturate(refl2Refr * 2.0));
baseColor.a = saturate(2.0 * refl2Refr + 0.5);
baseColor.rgb += spec * _SpecularColor.
UNITY_APPLY_FOG(i.fogCoord, baseColor);
return baseC
Tags {&RenderType&=&Transparent& &Queue&=&Transparent&}
ColorMask RGB
GrabPass { &_RefractionTex& }
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
#pragma target 3.0
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#pragma multi_compile WATER_VERTEX_DISPLACEMENT_ON WATER_VERTEX_DISPLACEMENT_OFF
#pragma multi_compile WATER_EDGEBLEND_ON WATER_EDGEBLEND_OFF
#pragma multi_compile WATER_REFLECTIVE WATER_SIMPLE
Tags {&RenderType&=&Transparent& &Queue&=&Transparent&}
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
#pragma target 3.0
#pragma vertex vert300
#pragma fragment frag300
#pragma multi_compile_fog
#pragma multi_compile WATER_VERTEX_DISPLACEMENT_ON WATER_VERTEX_DISPLACEMENT_OFF
#pragma multi_compile WATER_EDGEBLEND_ON WATER_EDGEBLEND_OFF
#pragma multi_compile WATER_REFLECTIVE WATER_SIMPLE
Tags {&RenderType&=&Transparent& &Queue&=&Transparent&}
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
ZTest LEqual
ZWrite Off
#pragma vertex vert200
#pragma fragment frag200
#pragma multi_compile_fog
Fallback &Transparent/Diffuse&
(C)&&2013&&Alibaba&&Inc.&&All&&rights&&resvered.
Powered by他的最新文章
他的热门文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)Unity includes several water Prefabs (including the necessary Shaders, scripts and art Assets) within the . Separate daylight and nighttime water Prefabs are provided.
Note that the water reflections described in this document do not work in VR.
Reflective daylight water
Reflective/Refractive daylight water
Setting up water
Place one of the existing water Prefabs into your Scene. Make sure you have the :
Simple Daylight Simple Water and Nighttime Simple Water in Standard Assets & Water.
Fancier water - Daylight Water and Nighttime Water in Pro Standard Assets & Water (this needs some Assets from Standard Assets & Water as well). Water mode (Simple, Reflective, Refractive) can be set in the Inspector.
The Prefab uses an oval-shaped Mesh for the water. If you need to use a different , change it in the Mesh Filter of the water GameObject:
Creating water from scratch (Advanced)
Simple water requires attaching a script to a plane-like mesh and using the water shader:
Have mesh for the water. This should be a flat mesh, oriented horizontally. UV coordinates are not required. The water GameObject should use the Water Layer, which you can set in the Inspector.
Attach the WaterSimple script (from Standard Assets/Water/Sources) to the GameObject.
Use the FX/Water (simple) Shader in the Material, or tweak one of the provided water Materials (Daylight Simple Water or Nighttime Simple Water).
Reflective/refractive water requires similar steps to set up from scratch:
Create a Mesh for the water. This should be a flat Mesh, oriented horizontally. UV coordinates are not required. The water GameObject should use the water Layer, which you can set in the Inspector.
Attach the Water script (from Pro Standard Assets/Water/Sources) to the GameObject (Water rendering mode can be set in the Inspector: Simple, Reflective or Refractive.)
Use the FX/Water Shader in the Material, or tweak one of the provided water Materials (Daylight Water or Nighttime Water).
Properties in water Materials
These properties are used in the Reflective and Refractive water Shaders. Most of them are used in the Simple water Shader as well.
Wave scale
Scaling of waves normal map. The smaller the value, the larger water waves.
Reflection/refraction distort
How much reflection/refraction is distorted by the waves normal map.
Refraction color
Additional tint for refraction.
Environment reflection/refraction
Render textures for real-time reflection and refraction.
Defines the shape of the waves. The final waves are produced by combining these two normal maps, each scrolling at different direction, scale and speed. The second normal map is half as large as the first one.
Wave speed
Scrolling speed for first normal map (1st and 2nd numbers) and the second normal map (3rd and 4th numbers).
A texture with alpha channel controlling the Fresnel effect - how much reflection vs. refraction is visible, based on viewing angle.
The rest of the properties are not used by the Reflective and Refractive Shaders, but need to be set up in case the user’s video card does not support it and must fallback to the simpler shader:
Reflective color/cube and fresnel
A texture that defines water color (RGB) and Fresnel effect (A) based on viewing angle.
Horizon color
The color of the water at horizon. `this is only used in the Simple water Shader.
Fallback texture
Define the fallback Texture used to represent the water on really old video cards, if none of the better looking Shaders can run.
Did you find this page useful? Please give it a rating:
How do I fix the rotation of an imported model?
Art Asset best practice guide&>&unity3d 特效插件 Tasharen Water 水效果 插件
unity3d 特效插件 Tasharen Water 水效果 插件
上传大小:6.41MB
unity3d 特效插件 Tasharen Water 水效果 插件
综合评分:5(3位用户评分)
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有1条
好东西,谢谢分享
综合评分:
积分/C币:3
综合评分:
积分/C币:5
综合评分:
积分/C币:2
综合评分:
积分/C币:5
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
unity3d 特效插件 Tasharen Water 水效果 插件
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
(仅够下载10个资源)
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
举报的资源分:
请选择类型
资源无法下载
资源无法使用
标题与实际内容不符
含有危害国家安全内容
含有反动色情等内容
含广告内容
版权问题,侵犯个人或公司的版权
*详细原因:
unity3d 特效插件 Tasharen Water 水效果 插件扫二维码下载作业帮
3亿+用户的选择
下载作业帮安装包
扫二维码下载作业帮
3亿+用户的选择
1.把水抽入大海,——water into the sea 2.把水倒入 ——water into 3.净化水——water 4.污染水——water横线处怎么填
作业帮用户
扫二维码下载作业帮
3亿+用户的选择
pumppourpurifypollute
第三个可以换一个八上水平的吗?谢谢
为您推荐:
其他类似问题
1.Pumping2.Pouring3.purification of4.Pollution of
扫描下载二维码

我要回帖

更多关于 unity water shader 的文章

 

随机推荐