summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp8
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h4
-rw-r--r--drivers/gles3/shaders/scene.glsl14
-rw-r--r--scene/3d/light.cpp5
4 files changed, 16 insertions, 15 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index 87347b8d95..87a2ca8bb9 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -3840,8 +3840,8 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
state.ubo_data.subsurface_scatter_width = subsurface_scatter_size;
- state.ubo_data.shadow_z_offset = 0;
- state.ubo_data.shadow_slope_scale = 0;
+ state.ubo_data.z_offset = 0;
+ state.ubo_data.z_slope_scale = 0;
state.ubo_data.shadow_dual_paraboloid_render_side = 0;
state.ubo_data.shadow_dual_paraboloid_render_zfar = 0;
@@ -4514,8 +4514,8 @@ void RasterizerSceneGLES3::render_shadow(RID p_light, RID p_shadow_atlas, int p_
glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
- state.ubo_data.shadow_z_offset = bias;
- state.ubo_data.shadow_slope_scale = normal_bias;
+ state.ubo_data.z_offset = bias;
+ state.ubo_data.z_slope_scale = normal_bias;
state.ubo_data.shadow_dual_paraboloid_render_side = dp_direction;
state.ubo_data.shadow_dual_paraboloid_render_zfar = zfar;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 59b8e3fb35..f9953f83db 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -119,8 +119,8 @@ public:
float ambient_energy;
float bg_energy;
- float shadow_z_offset;
- float shadow_slope_scale;
+ float z_offset;
+ float z_slope_scale;
float shadow_dual_paraboloid_render_zfar;
float shadow_dual_paraboloid_render_side;
float screen_pixel_size[2];
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl
index 855b96236a..0f1a7458d7 100644
--- a/drivers/gles3/shaders/scene.glsl
+++ b/drivers/gles3/shaders/scene.glsl
@@ -74,8 +74,8 @@ layout(std140) uniform SceneData { //ubo:0
float ambient_energy;
float bg_energy;
- float shadow_z_offset;
- float shadow_z_slope_scale;
+ float z_offset;
+ float z_slope_scale;
float shadow_dual_paraboloid_render_zfar;
float shadow_dual_paraboloid_render_side;
@@ -319,7 +319,7 @@ VERTEX_SHADER_CODE
//for dual paraboloid shadow mapping, this is the fastest but least correct way, as it curves straight edges
- highp vec3 vtx = vertex_interp+normalize(vertex_interp)*shadow_z_offset;
+ highp vec3 vtx = vertex_interp+normalize(vertex_interp)*z_offset;
highp float distance = length(vtx);
vtx = normalize(vtx);
vtx.xy/=1.0-vtx.z;
@@ -332,8 +332,8 @@ VERTEX_SHADER_CODE
#else
- float z_ofs = shadow_z_offset;
- z_ofs += (1.0-abs(normal_interp.z))*shadow_z_slope_scale;
+ float z_ofs = z_offset;
+ z_ofs += (1.0-abs(normal_interp.z))*z_slope_scale;
vertex_interp.z-=z_ofs;
#endif //RENDER_DEPTH_DUAL_PARABOLOID
@@ -446,8 +446,8 @@ layout(std140) uniform SceneData {
float ambient_energy;
float bg_energy;
- float shadow_z_offset;
- float shadow_z_slope_scale;
+ float z_offset;
+ float z_slope_scale;
float shadow_dual_paraboloid_render_zfar;
float shadow_dual_paraboloid_render_side;
diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp
index d8dd4916b9..b4a4cf70bb 100644
--- a/scene/3d/light.cpp
+++ b/scene/3d/light.cpp
@@ -261,8 +261,8 @@ Light::Light(VisualServer::LightType p_type) {
set_param(PARAM_SHADOW_SPLIT_1_OFFSET, 0.1);
set_param(PARAM_SHADOW_SPLIT_2_OFFSET, 0.2);
set_param(PARAM_SHADOW_SPLIT_3_OFFSET, 0.5);
- set_param(PARAM_SHADOW_NORMAL_BIAS, 0.1);
- set_param(PARAM_SHADOW_BIAS, 0.1);
+ set_param(PARAM_SHADOW_NORMAL_BIAS, 0.0);
+ set_param(PARAM_SHADOW_BIAS, 0.);
set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE, 0.1);
}
@@ -328,6 +328,7 @@ void DirectionalLight::_bind_methods() {
DirectionalLight::DirectionalLight()
: Light(VisualServer::LIGHT_DIRECTIONAL) {
+ set_param(PARAM_SHADOW_NORMAL_BIAS, 0.1);
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
blend_splits = false;
}