From ebc96195d8ffb263967c7a5c0d9cc78e1847f2b5 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Wed, 10 Jan 2018 23:13:00 +1100 Subject: [PATCH] Clamp blend to fix screen space reflections --- drivers/gles3/shaders/scene.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 1aa28d0fd5f..958a166968c 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1307,7 +1307,7 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta //make blend more rounded blend=mix(length(inner_pos),blend,blend); blend*=blend; - blend=1.001-blend; + blend=max(0.0, 1.0-blend); if (reflections[idx].params.x>0.0){// compute reflection @@ -1476,7 +1476,7 @@ void gi_probe_compute(mediump sampler3D probe, mat4 probe_xform, vec3 bounds,vec } vec3 blendv = abs(probe_pos/bounds * 2.0 - 1.0); - float blend = 1.001-max(blendv.x,max(blendv.y,blendv.z)); + float blend = clamp(1.0-max(blendv.x,max(blendv.y,blendv.z)), 0.0, 1.0); //float blend=1.0; float max_distance = length(bounds);