From c1a9294e179514ac242b35fc734c8f16c8cc3724 Mon Sep 17 00:00:00 2001 From: epochwon Date: Sat, 31 Aug 2024 14:07:28 -0400 Subject: [PATCH 1/2] ripple tweaks --- files/shaders/core/ripples_blobber.comp | 2 +- files/shaders/lib/water/ripples.glsl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/files/shaders/core/ripples_blobber.comp b/files/shaders/core/ripples_blobber.comp index 76c8afff60..235f58a5ba 100644 --- a/files/shaders/core/ripples_blobber.comp +++ b/files/shaders/core/ripples_blobber.comp @@ -23,7 +23,7 @@ void main() for (int i = 0; i < positionCount; ++i) { float wavesize = wavesizeMultiplier * positions[i].z; - float displace = clamp(2.0 * abs(length((positions[i].xy + offset) - vec2(gl_GlobalInvocationID.xy)) / wavesize - 1.0), 0.0, 1.0); + float displace = clamp(0.2 * abs(length((positions[i].xy + offset) - vec2(gl_GlobalInvocationID.xy)) / wavesize - 1.0) + 0.8, 0.0, 1.0); color.rg = mix(vec2(-1.0), color.rg, displace); } diff --git a/files/shaders/lib/water/ripples.glsl b/files/shaders/lib/water/ripples.glsl index 07856d7236..8620039f3c 100644 --- a/files/shaders/lib/water/ripples.glsl +++ b/files/shaders/lib/water/ripples.glsl @@ -11,9 +11,9 @@ vec4 applySprings(in vec4 samplerData, in vec4 n, in vec4 n2) vec4 storage = vec4(0.0, samplerData.r, 0.0, 0.0); // Tweak to look most like water, not a physically accurate simulation - const float a = 0.14; - const float udamp = 0.02; - const float vdamp = 0.02; + const float a = 0.28; + const float udamp = 0.04; + const float vdamp = 0.04; // Apply 2d wave equation with dampening // Continous impulse needed to maintain simulation, otherwise ripples will fade @@ -21,7 +21,7 @@ vec4 applySprings(in vec4 samplerData, in vec4 n, in vec4 n2) storage.r = a * nsum + ((2.0 - udamp - vdamp) - 4.0 * a) * samplerData.r - (1.0 - vdamp) * samplerData.g; // Calculate normal and store in blue-alpha channel - storage.ba = 2.0 * (n.xy - n.zw) + 0.5 * (n2.xy - n2.zw); + storage.ba = 2.0 * (n.xz - n.yw) + 0.5 * (n2.xz - n2.yw); return storage; } From 82fe34528002650491d6dc558acec36e24168976 Mon Sep 17 00:00:00 2001 From: epochwon Date: Mon, 2 Sep 2024 15:39:15 -0400 Subject: [PATCH 2/2] add edits to compatibility version --- files/shaders/compatibility/ripples_blobber.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/shaders/compatibility/ripples_blobber.frag b/files/shaders/compatibility/ripples_blobber.frag index d9cadcda98..805143eb02 100644 --- a/files/shaders/compatibility/ripples_blobber.frag +++ b/files/shaders/compatibility/ripples_blobber.frag @@ -20,7 +20,7 @@ void main() for (int i = 0; i < positionCount; ++i) { float wavesize = wavesizeMultiplier * positions[i].z; - float displace = clamp(2.0 * abs(length((positions[i].xy + offset) - gl_FragCoord.xy) / wavesize - 1.0), 0.0, 1.0); + float displace = clamp(0.2 * abs(length((positions[i].xy + offset) - gl_FragCoord.xy) / wavesize - 1.0) + 0.8, 0.0, 1.0); color.rg = mix(vec2(-1.0), color.rg, displace); }