summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-22 12:17:20 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-08-22 12:17:20 -0300
commit294e912a843cde241f9abf619f5d40df9ef6ef9f (patch)
tree8dd62dcdb45ab85feb1b7afd3a71bda2734f6eb0 /drivers
parent8ad7139631ca6860b2593b1b2ee94820118fc9b1 (diff)
Fade last cascade in directional shadow, closes #9779
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/shaders/scene.glsl5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 3f0498746b..e6476bd6b6 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1694,6 +1694,7 @@ FRAGMENT_SHADER_CODE
if (gl_FragCoord.w > shadow_split_offsets.w) {
vec3 pssm_coord;
+ float pssm_fade=0.0;
#ifdef LIGHT_USE_PSSM_BLEND
float pssm_blend;
@@ -1751,6 +1752,7 @@ FRAGMENT_SHADER_CODE
} else {
highp vec4 splane=(shadow_matrix4 * vec4(vertex,1.0));
pssm_coord=splane.xyz/splane.w;
+ pssm_fade = smoothstep(shadow_split_offsets.z,shadow_split_offsets.w,gl_FragCoord.w);
#if defined(LIGHT_USE_PSSM_BLEND)
use_blend=false;
@@ -1782,6 +1784,7 @@ FRAGMENT_SHADER_CODE
} else {
highp vec4 splane=(shadow_matrix2 * vec4(vertex,1.0));
pssm_coord=splane.xyz/splane.w;
+ pssm_fade = smoothstep(shadow_split_offsets.x,shadow_split_offsets.y,gl_FragCoord.w);
#if defined(LIGHT_USE_PSSM_BLEND)
use_blend=false;
@@ -1818,7 +1821,7 @@ FRAGMENT_SHADER_CODE
}
#endif
- light_attenuation=mix(shadow_color_contact.rgb,vec3(1.0),shadow);
+ light_attenuation=mix(mix(shadow_color_contact.rgb,vec3(1.0),shadow),vec3(1.0),pssm_fade);
}