From 462d8ceb46e2ac8a6a503e58bec4c8af942a8bd9 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 14 Jun 2017 16:56:47 -0300 Subject: Fixed several bugs with directional light, and changed defaults to be more sensible. --- scene/3d/light.cpp | 11 ++++++----- scene/3d/light.h | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'scene') diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index b4a4cf70bb..9c87acec6e 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -234,7 +234,7 @@ void Light::_bind_methods() { BIND_CONSTANT(PARAM_SHADOW_SPLIT_3_OFFSET); BIND_CONSTANT(PARAM_SHADOW_NORMAL_BIAS); BIND_CONSTANT(PARAM_SHADOW_BIAS); - BIND_CONSTANT(PARAM_SHADOW_BIAS_SPLIT_SCALE); + BIND_CONSTANT(PARAM_MAX); } @@ -262,8 +262,7 @@ Light::Light(VisualServer::LightType p_type) { 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.0); - set_param(PARAM_SHADOW_BIAS, 0.); - set_param(PARAM_SHADOW_BIAS_SPLIT_SCALE, 0.1); + set_param(PARAM_SHADOW_BIAS, 0.15); } Light::Light() { @@ -318,7 +317,6 @@ void DirectionalLight::_bind_methods() { ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_split_3", PROPERTY_HINT_RANGE, "0,1,0.001"), "set_param", "get_param", PARAM_SHADOW_SPLIT_3_OFFSET); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional_shadow_blend_splits"), "set_blend_splits", "is_blend_splits_enabled"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_normal_bias", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_NORMAL_BIAS); - ADD_PROPERTYI(PropertyInfo(Variant::REAL, "directional_shadow_bias_split_scale", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_param", "get_param", PARAM_SHADOW_BIAS_SPLIT_SCALE); BIND_CONSTANT(SHADOW_ORTHOGONAL); BIND_CONSTANT(SHADOW_PARALLEL_2_SPLITS); @@ -328,8 +326,11 @@ void DirectionalLight::_bind_methods() { DirectionalLight::DirectionalLight() : Light(VisualServer::LIGHT_DIRECTIONAL) { - set_param(PARAM_SHADOW_NORMAL_BIAS, 0.1); + set_param(PARAM_SHADOW_NORMAL_BIAS, 0.2); + set_param(PARAM_SHADOW_BIAS, 1.0); + set_param(PARAM_SHADOW_MAX_DISTANCE, 200); set_shadow_mode(SHADOW_PARALLEL_4_SPLITS); + blend_splits = false; } diff --git a/scene/3d/light.h b/scene/3d/light.h index c02f9d12d3..22ff5c0763 100644 --- a/scene/3d/light.h +++ b/scene/3d/light.h @@ -60,7 +60,6 @@ public: PARAM_SHADOW_SPLIT_3_OFFSET = VS::LIGHT_PARAM_SHADOW_SPLIT_3_OFFSET, PARAM_SHADOW_NORMAL_BIAS = VS::LIGHT_PARAM_SHADOW_NORMAL_BIAS, PARAM_SHADOW_BIAS = VS::LIGHT_PARAM_SHADOW_BIAS, - PARAM_SHADOW_BIAS_SPLIT_SCALE = VS::LIGHT_PARAM_SHADOW_BIAS_SPLIT_SCALE, PARAM_MAX = VS::LIGHT_PARAM_MAX }; -- cgit v1.2.3