diff --git a/doc/classes/DirectionalLight.xml b/doc/classes/DirectionalLight.xml index dc037fe85..985737209 100644 --- a/doc/classes/DirectionalLight.xml +++ b/doc/classes/DirectionalLight.xml @@ -13,16 +13,16 @@ - Amount of extra bias for shadow splits that are far away. If self-shadowing occurs only on the splits far away, increasing this value can fix them. + Amount of extra bias for shadow splits that are far away. If self-shadowing occurs only on the splits far away, increasing this value can fix them. This is ignored when [member directional_shadow_mode] is [constant SHADOW_ORTHOGONAL]. - If [code]true[/code], shadow detail is sacrificed in exchange for smoother transitions between splits. + If [code]true[/code], shadow detail is sacrificed in exchange for smoother transitions between splits. Enabling shadow blend splitting also has a moderate performance cost. This is ignored when [member directional_shadow_mode] is [constant SHADOW_ORTHOGONAL]. Optimizes shadow rendering for detail versus movement. See [enum ShadowDepthRange]. - The maximum distance for shadow splits. + The maximum distance for shadow splits. Increasing this value will make directional shadows visible from further away, at the cost of lower overall shadow detail and performance (since more objects need to be included in the directional shadow rendering). The light's shadow rendering algorithm. See [enum ShadowMode]. @@ -31,13 +31,13 @@ Can be used to fix special cases of self shadowing when objects are perpendicular to the light. - The distance from camera to shadow split 1. Relative to [member directional_shadow_max_distance]. Only used when [member directional_shadow_mode] is [code]SHADOW_PARALLEL_2_SPLITS[/code] or [code]SHADOW_PARALLEL_4_SPLITS[/code]. + The distance from camera to shadow split 1. Relative to [member directional_shadow_max_distance]. Only used when [member directional_shadow_mode] is [constant SHADOW_PARALLEL_2_SPLITS] or [constant SHADOW_PARALLEL_4_SPLITS]. - The distance from shadow split 1 to split 2. Relative to [member directional_shadow_max_distance]. Only used when [member directional_shadow_mode] is [code]SHADOW_PARALLEL_2_SPLITS[/code] or [code]SHADOW_PARALLEL_4_SPLITS[/code]. + The distance from shadow split 1 to split 2. Relative to [member directional_shadow_max_distance]. Only used when [member directional_shadow_mode] is [constant SHADOW_PARALLEL_2_SPLITS] or [constant SHADOW_PARALLEL_4_SPLITS]. - The distance from shadow split 2 to split 3. Relative to [member directional_shadow_max_distance]. Only used when [member directional_shadow_mode] is [code]SHADOW_PARALLEL_4_SPLITS[/code]. + The distance from shadow split 2 to split 3. Relative to [member directional_shadow_max_distance]. Only used when [member directional_shadow_mode] is [constant SHADOW_PARALLEL_4_SPLITS]. diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index 2bfa20bda..759152fd6 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -308,6 +308,7 @@ Light::~Light() { void DirectionalLight::set_shadow_mode(ShadowMode p_mode) { shadow_mode = p_mode; VS::get_singleton()->light_directional_set_shadow_mode(light, VS::LightDirectionalShadowMode(p_mode)); + property_list_changed_notify(); } DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const { @@ -332,6 +333,20 @@ bool DirectionalLight::is_blend_splits_enabled() const { return blend_splits; } +void DirectionalLight::_validate_property(PropertyInfo &property) const { + if (shadow_mode == SHADOW_ORTHOGONAL && (property.name == "directional_shadow_split_1" || property.name == "directional_shadow_blend_splits" || property.name == "directional_shadow_bias_split_scale")) { + // Split 2, split blending and bias split scale are only used with the PSSM 2 Splits and PSSM 4 Splits shadow modes. + property.usage = PROPERTY_USAGE_NOEDITOR; + } + + if ((shadow_mode == SHADOW_ORTHOGONAL || shadow_mode == SHADOW_PARALLEL_2_SPLITS) && (property.name == "directional_shadow_split_2" || property.name == "directional_shadow_split_3")) { + // Splits 3 and 4 are only used with the PSSM 4 Splits shadow mode. + property.usage = PROPERTY_USAGE_NOEDITOR; + } + + Light::_validate_property(property); +} + void DirectionalLight::_bind_methods() { ClassDB::bind_method(D_METHOD("set_shadow_mode", "mode"), &DirectionalLight::set_shadow_mode); ClassDB::bind_method(D_METHOD("get_shadow_mode"), &DirectionalLight::get_shadow_mode); diff --git a/scene/3d/light.h b/scene/3d/light.h index 655afdc07..8229d30c6 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -139,6 +139,7 @@ private: protected: static void _bind_methods(); + virtual void _validate_property(PropertyInfo &property) const; public: void set_shadow_mode(ShadowMode p_mode);