summaryrefslogtreecommitdiff
path: root/drivers/gles3/shaders/scene.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/shaders/scene.glsl')
-rw-r--r--drivers/gles3/shaders/scene.glsl25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 3f0498746b..ef4925895c 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -1559,10 +1559,6 @@ void main() {
vec2 screen_uv = gl_FragCoord.xy*screen_pixel_size;
#endif
-#if defined(ENABLE_DISCARD)
- bool discard_=false;
-#endif
-
#if defined (ENABLE_SSS)
float sss_strength=0.0;
#endif
@@ -1603,13 +1599,6 @@ FRAGMENT_SHADER_CODE
#endif
-#if defined(ENABLE_DISCARD)
- if (discard_) {
- //easy to eliminate dead code
- discard;
- }
-#endif
-
#ifdef ENABLE_CLIP_ALPHA
if (albedo.a<0.99) {
//used for doublepass and shadowmapping
@@ -1694,6 +1683,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 +1741,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 +1773,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 +1810,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);
}
@@ -1966,6 +1958,13 @@ FRAGMENT_SHADER_CODE
#ifdef USE_MULTIPLE_RENDER_TARGETS
+
+#ifdef SHADELESS
+ diffuse_buffer=vec4(albedo.rgb,0.0);
+ specular_buffer=vec4(0.0);
+
+#else
+
#if defined(ENABLE_AO)
float ambient_scale=0.0; // AO is supplied by material
@@ -1981,6 +1980,7 @@ FRAGMENT_SHADER_CODE
diffuse_buffer=vec4(emission+diffuse_light+ambient_light,ambient_scale);
specular_buffer=vec4(specular_light,metallic);
+#endif //SHADELESS
normal_mr_buffer=vec4(normalize(normal)*0.5+0.5,roughness);
@@ -1988,6 +1988,7 @@ FRAGMENT_SHADER_CODE
sss_buffer = sss_strength;
#endif
+
#else //USE_MULTIPLE_RENDER_TARGETS