From a610d69f846614531835264fdb7a2b3beb3f7b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Tue, 21 Jan 2014 22:31:17 +0100 Subject: [PATCH] opengl: Fixed artifacts on water reflection --- src/render/opengl/shaders/water.frag | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/render/opengl/shaders/water.frag b/src/render/opengl/shaders/water.frag index 4c00fe8..1f5a9d7 100644 --- a/src/render/opengl/shaders/water.frag +++ b/src/render/opengl/shaders/water.frag @@ -28,7 +28,9 @@ void main(void) gl_FragColor = applyLighting(unprojected, normal, waterColor, 100.0); - gl_FragColor += getSkyColor(unprojected, reflect(unprojected - cameraLocation, normal)) * waterReflection; + vec3 reflected = reflect(unprojected - cameraLocation, normal); + reflected.y = max(reflected.y, 0.0); + gl_FragColor += getSkyColor(unprojected, reflected) * waterReflection; gl_FragColor = applyAerialPerspective(gl_FragColor);