From fc564f53130a4dd1aac8d0a32c020ffbd1415ce2 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Fri, 13 Jan 2023 11:37:27 +0000 Subject: [PATCH] Fixed internal water reflections and improved underwarper --- assets/voxygen/shaders/clouds-frag.glsl | 6 ++++++ assets/voxygen/shaders/postprocess-frag.glsl | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/voxygen/shaders/clouds-frag.glsl b/assets/voxygen/shaders/clouds-frag.glsl index 39a66efd9d..f912375bdb 100644 --- a/assets/voxygen/shaders/clouds-frag.glsl +++ b/assets/voxygen/shaders/clouds-frag.glsl @@ -152,6 +152,12 @@ void main() { vec3 surf_norm = vec3(mat.xyz) / 127.0 - 1.0; vec3 refl_dir = reflect(dir, surf_norm); + // Don't reflect back into the surface by snapping the reflection to the *actual* (i.e: not normal-mapped) surface plane + if (dot(refl_dir, round(surf_norm)) <= 0.0) { + // TODO: This assumes that the surface is axis-aligned! + refl_dir = normalize(refl_dir.xyz * (1.0 - abs(round(surf_norm)))); + } + vec4 clip = (all_mat * vec4(cam_pos.xyz + refl_dir, 1.0)); vec2 new_uv = (clip.xy / max(clip.w, 0)) * 0.5 * vec2(1, -1) + 0.5; diff --git a/assets/voxygen/shaders/postprocess-frag.glsl b/assets/voxygen/shaders/postprocess-frag.glsl index 98c1d1b182..418324c7e4 100644 --- a/assets/voxygen/shaders/postprocess-frag.glsl +++ b/assets/voxygen/shaders/postprocess-frag.glsl @@ -211,7 +211,7 @@ void main() { vec2 sample_uv = uv; #ifdef EXPERIMENTAL_UNDERWARPER if (medium.x == MEDIUM_WATER) { - sample_uv += sin(uv.yx * 40 + tick.xx * 1.0) * 0.003; + sample_uv += sin(uv.yx * 60 + tick.xx * 3.0) * 0.003; } #endif