From 845e3944d6d61488f024d73923dae975a3d12387 Mon Sep 17 00:00:00 2001 From: wareya Date: Fri, 19 Mar 2021 17:54:08 -0400 Subject: [PATCH] make refraction more visible even at a distance --- files/shaders/water_fragment.glsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/shaders/water_fragment.glsl b/files/shaders/water_fragment.glsl index d9b9463ad..5f6d8c6ac 100644 --- a/files/shaders/water_fragment.glsl +++ b/files/shaders/water_fragment.glsl @@ -236,7 +236,11 @@ void main(void) if (cameraPos.z < 0.0) refraction = clamp(refraction * 1.5, 0.0, 1.0); else - refraction = mix(refraction, waterColor, clamp(depthSampleDistorted/VISIBILITY, 0.0, 1.0)); + { + vec3 refractionA = mix(refraction, waterColor, clamp(depthSampleDistorted/VISIBILITY, 0.0, 1.0)); + vec3 refractionB = mix(refraction, waterColor, clamp(realWaterDepth/VISIBILITY, 0.0, 1.0)); + refraction = mix(refractionA, refractionB, 0.8); + } // sunlight scattering // normal for sunlight scattering