diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/environment.cpp | 67 | ||||
-rw-r--r-- | scene/resources/environment.h | 27 |
2 files changed, 25 insertions, 69 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index f4edab07b5..63122ee98d 100644 --- a/scene/resources/environment.cpp +++ b/scene/resources/environment.cpp @@ -349,13 +349,13 @@ bool Environment::is_ssao_enabled() const { return ssao_enabled; } -void Environment::set_ssao_radius(float p_radius) { - ssao_radius = p_radius; +void Environment::set_ssao_rejection_radius(float p_rejection_radius) { + ssao_rejection_radius = p_rejection_radius; _update_ssao(); } -float Environment::get_ssao_radius() const { - return ssao_radius; +float Environment::get_ssao_rejection_radius() const { + return ssao_rejection_radius; } void Environment::set_ssao_intensity(float p_intensity) { @@ -367,13 +367,13 @@ float Environment::get_ssao_intensity() const { return ssao_intensity; } -void Environment::set_ssao_bias(float p_bias) { - ssao_bias = p_bias; +void Environment::set_ssao_levels(int p_levels) { + ssao_levels = p_levels; _update_ssao(); } -float Environment::get_ssao_bias() const { - return ssao_bias; +int Environment::get_ssao_levels() const { + return ssao_levels; } void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) { @@ -394,35 +394,15 @@ float Environment::get_ssao_ao_channel_affect() const { return ssao_ao_channel_affect; } -void Environment::set_ssao_blur(SSAOBlur p_blur) { - ssao_blur = p_blur; - _update_ssao(); -} - -Environment::SSAOBlur Environment::get_ssao_blur() const { - return ssao_blur; -} - -void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) { - ssao_edge_sharpness = p_edge_sharpness; - _update_ssao(); -} - -float Environment::get_ssao_edge_sharpness() const { - return ssao_edge_sharpness; -} - void Environment::_update_ssao() { RS::get_singleton()->environment_set_ssao( environment, ssao_enabled, - ssao_radius, + ssao_rejection_radius, ssao_intensity, - ssao_bias, + ssao_levels, ssao_direct_light_affect, - ssao_ao_channel_affect, - RS::EnvironmentSSAOBlur(ssao_blur), - ssao_edge_sharpness); + ssao_ao_channel_affect); } // SDFGI @@ -1130,30 +1110,24 @@ void Environment::_bind_methods() { ClassDB::bind_method(D_METHOD("set_ssao_enabled", "enabled"), &Environment::set_ssao_enabled); ClassDB::bind_method(D_METHOD("is_ssao_enabled"), &Environment::is_ssao_enabled); - ClassDB::bind_method(D_METHOD("set_ssao_radius", "radius"), &Environment::set_ssao_radius); - ClassDB::bind_method(D_METHOD("get_ssao_radius"), &Environment::get_ssao_radius); + ClassDB::bind_method(D_METHOD("set_ssao_rejection_radius", "falloff"), &Environment::set_ssao_rejection_radius); + ClassDB::bind_method(D_METHOD("get_ssao_rejection_radius"), &Environment::get_ssao_rejection_radius); ClassDB::bind_method(D_METHOD("set_ssao_intensity", "intensity"), &Environment::set_ssao_intensity); ClassDB::bind_method(D_METHOD("get_ssao_intensity"), &Environment::get_ssao_intensity); - ClassDB::bind_method(D_METHOD("set_ssao_bias", "bias"), &Environment::set_ssao_bias); - ClassDB::bind_method(D_METHOD("get_ssao_bias"), &Environment::get_ssao_bias); + ClassDB::bind_method(D_METHOD("set_ssao_levels", "levels"), &Environment::set_ssao_levels); + ClassDB::bind_method(D_METHOD("get_ssao_levels"), &Environment::get_ssao_levels); ClassDB::bind_method(D_METHOD("set_ssao_direct_light_affect", "amount"), &Environment::set_ssao_direct_light_affect); ClassDB::bind_method(D_METHOD("get_ssao_direct_light_affect"), &Environment::get_ssao_direct_light_affect); ClassDB::bind_method(D_METHOD("set_ssao_ao_channel_affect", "amount"), &Environment::set_ssao_ao_channel_affect); ClassDB::bind_method(D_METHOD("get_ssao_ao_channel_affect"), &Environment::get_ssao_ao_channel_affect); - ClassDB::bind_method(D_METHOD("set_ssao_blur", "mode"), &Environment::set_ssao_blur); - ClassDB::bind_method(D_METHOD("get_ssao_blur"), &Environment::get_ssao_blur); - ClassDB::bind_method(D_METHOD("set_ssao_edge_sharpness", "edge_sharpness"), &Environment::set_ssao_edge_sharpness); - ClassDB::bind_method(D_METHOD("get_ssao_edge_sharpness"), &Environment::get_ssao_edge_sharpness); ADD_GROUP("SSAO", "ssao_"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ssao_enabled"), "set_ssao_enabled", "is_ssao_enabled"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_radius", PROPERTY_HINT_RANGE, "0.1,128,0.01"), "set_ssao_radius", "get_ssao_radius"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_intensity", PROPERTY_HINT_RANGE, "0.0,128,0.01"), "set_ssao_intensity", "get_ssao_intensity"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_bias", PROPERTY_HINT_RANGE, "0.001,8,0.001"), "set_ssao_bias", "get_ssao_bias"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_rejection_radius", PROPERTY_HINT_RANGE, "1.0,10.0,0.1"), "set_ssao_rejection_radius", "get_ssao_rejection_radius"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_intensity", PROPERTY_HINT_RANGE, "0.0,2.0,0.01"), "set_ssao_intensity", "get_ssao_intensity"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_levels", PROPERTY_HINT_RANGE, "1,4,1"), "set_ssao_levels", "get_ssao_levels"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_light_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_direct_light_affect", "get_ssao_direct_light_affect"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_ao_channel_affect", PROPERTY_HINT_RANGE, "0.00,1,0.01"), "set_ssao_ao_channel_affect", "get_ssao_ao_channel_affect"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "ssao_blur", PROPERTY_HINT_ENUM, "Disabled,1x1,2x2,3x3"), "set_ssao_blur", "get_ssao_blur"); - ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_edge_sharpness", PROPERTY_HINT_RANGE, "0,32,0.01"), "set_ssao_edge_sharpness", "get_ssao_edge_sharpness"); // SDFGI @@ -1351,11 +1325,6 @@ void Environment::_bind_methods() { BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_REPLACE); BIND_ENUM_CONSTANT(GLOW_BLEND_MODE_MIX); - BIND_ENUM_CONSTANT(SSAO_BLUR_DISABLED); - BIND_ENUM_CONSTANT(SSAO_BLUR_1x1); - BIND_ENUM_CONSTANT(SSAO_BLUR_2x2); - BIND_ENUM_CONSTANT(SSAO_BLUR_3x3); - BIND_ENUM_CONSTANT(SDFGI_CASCADES_4); BIND_ENUM_CONSTANT(SDFGI_CASCADES_6); BIND_ENUM_CONSTANT(SDFGI_CASCADES_8); diff --git a/scene/resources/environment.h b/scene/resources/environment.h index 9b7247b58d..8c69ee0f31 100644 --- a/scene/resources/environment.h +++ b/scene/resources/environment.h @@ -70,13 +70,6 @@ public: TONE_MAPPER_ACES, }; - enum SSAOBlur { - SSAO_BLUR_DISABLED, - SSAO_BLUR_1x1, - SSAO_BLUR_2x2, - SSAO_BLUR_3x3, - }; - enum SDFGICascades { SDFGI_CASCADES_4, SDFGI_CASCADES_6, @@ -147,13 +140,11 @@ private: // SSAO bool ssao_enabled = false; - float ssao_radius = 1.0; + float ssao_rejection_radius = 2.5; float ssao_intensity = 1.0; - float ssao_bias = 0.01; + int ssao_levels = 3; float ssao_direct_light_affect = 0.0; float ssao_ao_channel_affect = 0.0; - SSAOBlur ssao_blur = SSAO_BLUR_3x3; - float ssao_edge_sharpness = 4.0; void _update_ssao(); // SDFGI @@ -290,20 +281,17 @@ public: // SSAO void set_ssao_enabled(bool p_enabled); bool is_ssao_enabled() const; - void set_ssao_radius(float p_radius); - float get_ssao_radius() const; + void set_ssao_rejection_radius(float p_rejection_radius); + float get_ssao_rejection_radius() const; void set_ssao_intensity(float p_intensity); float get_ssao_intensity() const; - void set_ssao_bias(float p_bias); - float get_ssao_bias() const; + void set_ssao_levels(int p_levels); + int get_ssao_levels() const; + void set_ssao_direct_light_affect(float p_direct_light_affect); float get_ssao_direct_light_affect() const; void set_ssao_ao_channel_affect(float p_ao_channel_affect); float get_ssao_ao_channel_affect() const; - void set_ssao_blur(SSAOBlur p_blur); - SSAOBlur get_ssao_blur() const; - void set_ssao_edge_sharpness(float p_edge_sharpness); - float get_ssao_edge_sharpness() const; // SDFGI void set_sdfgi_enabled(bool p_enabled); @@ -413,7 +401,6 @@ VARIANT_ENUM_CAST(Environment::BGMode) VARIANT_ENUM_CAST(Environment::AmbientSource) VARIANT_ENUM_CAST(Environment::ReflectionSource) VARIANT_ENUM_CAST(Environment::ToneMapper) -VARIANT_ENUM_CAST(Environment::SSAOBlur) VARIANT_ENUM_CAST(Environment::SDFGICascades) VARIANT_ENUM_CAST(Environment::SDFGIYScale) VARIANT_ENUM_CAST(Environment::GlowBlendMode) |