summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles2/rasterizer_scene_gles2.cpp3
-rw-r--r--drivers/gles2/shaders/scene.glsl12
2 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gles2/rasterizer_scene_gles2.cpp b/drivers/gles2/rasterizer_scene_gles2.cpp
index 2c6168241e..fe6be0443e 100644
--- a/drivers/gles2/rasterizer_scene_gles2.cpp
+++ b/drivers/gles2/rasterizer_scene_gles2.cpp
@@ -1790,6 +1790,9 @@ void RasterizerSceneGLES2::_setup_light(LightInstance *light, ShadowAtlas *shado
Color color = light_ptr->color * sign * energy * Math_PI;
state.scene_shader.set_uniform(SceneShaderGLES2::LIGHT_COLOR, color);
+ Color shadow_color = light_ptr->shadow_color.to_linear();
+ state.scene_shader.set_uniform(SceneShaderGLES2::SHADOW_COLOR, shadow_color);
+
//specific parameters
switch (light_ptr->type) {
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 242329d4a7..6f6f827d60 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -158,6 +158,7 @@ varying highp vec3 specular_interp;
// general for all lights
uniform highp vec4 light_color;
+uniform highp vec4 shadow_color;
uniform highp float light_specular;
// directional
@@ -912,6 +913,7 @@ uniform highp vec3 light_direction; //may be used by fog, so leave here
//done in fragment
// general for all lights
uniform highp vec4 light_color;
+uniform highp vec4 shadow_color;
uniform highp float light_specular;
// directional
@@ -1680,7 +1682,7 @@ FRAGMENT_SHADER_CODE
float shadow = sample_shadow(light_shadow_atlas, splane);
- light_att *= shadow;
+ light_att *= mix(shadow_color.rgb, vec3(1.0), shadow);
}
#endif
@@ -1757,7 +1759,7 @@ FRAGMENT_SHADER_CODE
shadow_att = mix(shadow_att, shadow_att2, pssm_blend);
}
#endif
- light_att *= shadow_att;
+ light_att *= mix(shadow_color.rgb, vec3(1.0), shadow_att);
}
#endif //LIGHT_USE_PSSM4
@@ -1798,7 +1800,7 @@ FRAGMENT_SHADER_CODE
shadow_att = mix(shadow_att, shadow_att2, pssm_blend);
}
#endif
- light_att *= shadow_att;
+ light_att *= mix(shadow_color.rgb, vec3(1.0), shadow_att);
}
#endif //LIGHT_USE_PSSM2
@@ -1905,7 +1907,7 @@ FRAGMENT_SHADER_CODE
}
#endif
- light_att *= shadow;
+ light_att *= mix(shadow_color.rgb, vec3(1.0), shadow);
}
}
#endif //use vertex lighting
@@ -1953,7 +1955,7 @@ FRAGMENT_SHADER_CODE
highp vec4 splane = shadow_coord;
float shadow = sample_shadow(light_shadow_atlas, splane);
- light_att *= shadow;
+ light_att *= mix(shadow_color.rgb, vec3(1.0), shadow);
}
#endif