From 473cf573a8c90c75180dcbf1c5bc7e5e772b9eb3 Mon Sep 17 00:00:00 2001 From: tech Date: Mon, 22 Jul 2024 15:03:40 +0800 Subject: [PATCH] [M] edge foam display diff by pos --- Packages/zzwater/Mats/Ocean.mat | 15 ++++++++------- Packages/zzwater/Mats/Ocean_tess.mat | 4 ++-- Packages/zzwater/shaders/libs/ForwardPass.hlsl | 7 +++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Packages/zzwater/Mats/Ocean.mat b/Packages/zzwater/Mats/Ocean.mat index a8fc1b0..324ae87 100644 --- a/Packages/zzwater/Mats/Ocean.mat +++ b/Packages/zzwater/Mats/Ocean.mat @@ -48,7 +48,7 @@ Material: m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _IntersectionNoise: - m_Texture: {fileID: 0} + m_Texture: {fileID: 2800000, guid: 6e4f6abf9612841adaf37e0d026dd5a4, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - _MainTex: @@ -106,13 +106,13 @@ Material: - _Glossiness: 0 - _GlossyReflections: 0 - _HorizonDistance: 26.6 - - _IntersectionClipping: 0.5 - - _IntersectionDurationMulti1: 0.5 - - _IntersectionDurationMulti2: 0.5 + - _IntersectionClipping: 0.721 + - _IntersectionDurationMulti1: 3.48 + - _IntersectionDurationMulti2: 0.76 - _IntersectionFalloff: 0.525 - - _IntersectionLength: 2 - - _IntersectionSpeed: 1 - - _IntersectionTiling: 0.2 + - _IntersectionLength: 1.46 + - _IntersectionSpeed: -0.2 + - _IntersectionTiling: 1.3 - _Metallic: 0 - _OcclusionStrength: 1 - _Parallax: 0.005 @@ -148,6 +148,7 @@ Material: - _Direction: {r: 1, g: 1, b: 0, a: 0} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _HorizonColor: {r: 0.09376113, g: 0.10980392, b: 0.32156864, a: 1} + - _IntersectionColor: {r: 1, g: 1, b: 1, a: 1} - _ShallowColor: {r: 0.105882354, g: 0.4117647, b: 0.62352943, a: 0.9019608} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _WaveDirection: {r: 1, g: 1, b: 1, a: 2} diff --git a/Packages/zzwater/Mats/Ocean_tess.mat b/Packages/zzwater/Mats/Ocean_tess.mat index 389af31..2bcaf0c 100644 --- a/Packages/zzwater/Mats/Ocean_tess.mat +++ b/Packages/zzwater/Mats/Ocean_tess.mat @@ -107,11 +107,11 @@ Material: - _GlossyReflections: 0 - _HorizonDistance: 26.6 - _InterscetionSpeed: 1 - - _IntersectionClipping: 0.717 + - _IntersectionClipping: 0.741 - _IntersectionDurationMulti: 1 - _IntersectionDurationMulti1: 3.45 - _IntersectionDurationMulti2: 1.45 - - _IntersectionFalloff: 0.368 + - _IntersectionFalloff: 0.5 - _IntersectionLength: 1.43 - _IntersectionSpeed: -0.21 - _IntersectionTiling: 1.27 diff --git a/Packages/zzwater/shaders/libs/ForwardPass.hlsl b/Packages/zzwater/shaders/libs/ForwardPass.hlsl index 501c237..7eb9bfd 100644 --- a/Packages/zzwater/shaders/libs/ForwardPass.hlsl +++ b/Packages/zzwater/shaders/libs/ForwardPass.hlsl @@ -102,8 +102,8 @@ float4 ForwardPassFragment(Varyings input) : SV_Target float interSecGradient = 1-saturate(exp(scene.verticalDepth) / _IntersectionLength); - float sine1 = sin(_TimeParameters.x * _IntersectionDurationMulti1 - interSecGradient ); - float sine2 = sin(_TimeParameters.x * _IntersectionDurationMulti2 - interSecGradient ); + float sine1 = sin(_TimeParameters.x * _IntersectionDurationMulti1 + positionWS.x - interSecGradient ); + float sine2 = sin(_TimeParameters.x * _IntersectionDurationMulti2 + positionWS.z - interSecGradient ); float sine = sine1 * sine2 * interSecGradient; float2 nUV = positionWS.xz * _IntersectionTiling; @@ -164,8 +164,7 @@ float4 ForwardPassFragment(Varyings input) : SV_Target // =================== Make ApplyLight simple ========================= - finalColor = lerp(scene.color, finalColor, water.fog + interSecGradient); - finalColor = lerp(scene.color, finalColor, 1); + finalColor = lerp(scene.color, finalColor, water.fog + noise); return float4(finalColor, water.alpha); }