summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2018-01-10 23:13:00 +1100
committerBastiaan Olij <mux213@gmail.com>2018-01-10 23:23:00 +1100
commitebc96195d8ffb263967c7a5c0d9cc78e1847f2b5 (patch)
tree02832659444b30bf202484d1d6eda1db96b9391c
parent4a25a4e53f4c3b457ac2003bab7cf0001dd5aab1 (diff)
Clamp blend to fix screen space reflections
-rw-r--r--drivers/gles3/shaders/scene.glsl4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 1aa28d0fd5..958a166968 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);