summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorjfons <joan.fonssanchez@gmail.com>2021-08-04 17:18:06 +0200
committerjfons <joan.fonssanchez@gmail.com>2021-08-19 13:46:51 +0200
commit55e7832d7b2ff4f6c9458962977d75970e581741 (patch)
tree534429b5f0c7fe788023e7308b09defeac22098f /scene
parent8b6c168b3ac14d9ac6350d03e7be4d196311e0fe (diff)
Improvements to SpotLight3D and OmniLight3D's shadows
OmniLight3D: * Fixed lack of precision in cube map mode by scaling the projection's znear. * Fixed aliasing issues by making the paraboloids use two square regions instead of two half squares. * Fixed shadowmap atlas bleeding by adding padding. * Fixed sihadow blur's inconsistent radius and unclamped sampling. SpotLight3D: * Fixed lack of precision by scaling the projection's znear. * Fixed normal biasing. Both: * Tweaked biasing to make sure it works out of the box in most situations.
Diffstat (limited to 'scene')
-rw-r--r--scene/3d/light_3d.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/scene/3d/light_3d.cpp b/scene/3d/light_3d.cpp
index 508f8a70df..ab417fafdd 100644
--- a/scene/3d/light_3d.cpp
+++ b/scene/3d/light_3d.cpp
@@ -212,10 +212,6 @@ void Light3D::_validate_property(PropertyInfo &property) const {
property.usage = PROPERTY_USAGE_NONE;
}
- if (get_light_type() == RS::LIGHT_SPOT && property.name == "shadow_normal_bias") {
- property.usage = PROPERTY_USAGE_NONE;
- }
-
if (get_light_type() == RS::LIGHT_DIRECTIONAL && property.name == "light_projector") {
property.usage = PROPERTY_USAGE_NONE;
}
@@ -425,9 +421,7 @@ DirectionalLight3D::DirectionalLight3D() :
set_param(PARAM_SHADOW_MAX_DISTANCE, 100);
set_param(PARAM_SHADOW_FADE_START, 0.8);
// Increase the default shadow bias to better suit most scenes.
- // Leave normal bias untouched as it doesn't benefit DirectionalLight3D as much as OmniLight3D.
set_param(PARAM_SHADOW_BIAS, 0.1);
- set_param(PARAM_SHADOW_NORMAL_BIAS, 1.0);
set_shadow_mode(SHADOW_PARALLEL_4_SPLITS);
blend_splits = false;
}
@@ -468,8 +462,7 @@ OmniLight3D::OmniLight3D() :
Light3D(RenderingServer::LIGHT_OMNI) {
set_shadow_mode(SHADOW_CUBE);
// Increase the default shadow biases to better suit most scenes.
- set_param(PARAM_SHADOW_BIAS, 0.1);
- set_param(PARAM_SHADOW_NORMAL_BIAS, 2.0);
+ set_param(PARAM_SHADOW_BIAS, 0.2);
}
TypedArray<String> SpotLight3D::get_configuration_warnings() const {