From 48ffd3d1577ab706355e36161cf3ae7c8fd9ec6c Mon Sep 17 00:00:00 2001 From: Arman <48544263+puchik@users.noreply.github.com> Date: Fri, 22 May 2020 01:06:23 -0700 Subject: [PATCH] Check if screen space reflection has passed far clip Before "accepting" the reflection, check if it's within our view (prevent tracing environment and creating artifacts). --- drivers/gles3/shaders/screen_space_reflection.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl index 39f1ea615599..63ca7d4a3c43 100644 --- a/drivers/gles3/shaders/screen_space_reflection.glsl +++ b/drivers/gles3/shaders/screen_space_reflection.glsl @@ -159,8 +159,8 @@ void main() { if (depth > z_to) { // if depth was surpassed - if (depth <= max(z_to, z_from) + depth_tolerance) { - // check the depth tolerance + if ((depth <= max(z_to, z_from) + depth_tolerance) && (-depth < camera_z_far)) { + // check the depth tolerance and far clip found = true; } break;