summaryrefslogtreecommitdiff
path: root/scene/resources
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources')
-rw-r--r--scene/resources/environment.cpp88
-rw-r--r--scene/resources/environment.h31
2 files changed, 61 insertions, 58 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp
index 1eb78a3679..32840dd373 100644
--- a/scene/resources/environment.cpp
+++ b/scene/resources/environment.cpp
@@ -368,49 +368,58 @@ 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_power(float p_power) {
+ ssao_power = p_power;
_update_ssao();
}
-float Environment::get_ssao_bias() const {
- return ssao_bias;
+float Environment::get_ssao_power() const {
+ return ssao_power;
}
-void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) {
- ssao_direct_light_affect = p_direct_light_affect;
+void Environment::set_ssao_detail(float p_detail) {
+ ssao_detail = p_detail;
_update_ssao();
}
-float Environment::get_ssao_direct_light_affect() const {
- return ssao_direct_light_affect;
+float Environment::get_ssao_detail() const {
+ return ssao_detail;
}
-void Environment::set_ssao_ao_channel_affect(float p_ao_channel_affect) {
- ssao_ao_channel_affect = p_ao_channel_affect;
+void Environment::set_ssao_horizon(float p_horizon) {
+ ssao_horizon = p_horizon;
_update_ssao();
}
-float Environment::get_ssao_ao_channel_affect() const {
- return ssao_ao_channel_affect;
+float Environment::get_ssao_horizon() const {
+ return ssao_horizon;
+}
+
+void Environment::set_ssao_sharpness(float p_sharpness) {
+ ssao_sharpness = p_sharpness;
+ _update_ssao();
}
-void Environment::set_ssao_blur(SSAOBlur p_blur) {
- ssao_blur = p_blur;
+float Environment::get_ssao_sharpness() const {
+ return ssao_sharpness;
+}
+
+void Environment::set_ssao_direct_light_affect(float p_direct_light_affect) {
+ ssao_direct_light_affect = p_direct_light_affect;
_update_ssao();
}
-Environment::SSAOBlur Environment::get_ssao_blur() const {
- return ssao_blur;
+float Environment::get_ssao_direct_light_affect() const {
+ return ssao_direct_light_affect;
}
-void Environment::set_ssao_edge_sharpness(float p_edge_sharpness) {
- ssao_edge_sharpness = p_edge_sharpness;
+void Environment::set_ssao_ao_channel_affect(float p_ao_channel_affect) {
+ ssao_ao_channel_affect = p_ao_channel_affect;
_update_ssao();
}
-float Environment::get_ssao_edge_sharpness() const {
- return ssao_edge_sharpness;
+float Environment::get_ssao_ao_channel_affect() const {
+ return ssao_ao_channel_affect;
}
void Environment::_update_ssao() {
@@ -419,11 +428,12 @@ void Environment::_update_ssao() {
ssao_enabled,
ssao_radius,
ssao_intensity,
- ssao_bias,
+ ssao_power,
+ ssao_detail,
+ ssao_horizon,
+ ssao_sharpness,
ssao_direct_light_affect,
- ssao_ao_channel_affect,
- RS::EnvironmentSSAOBlur(ssao_blur),
- ssao_edge_sharpness);
+ ssao_ao_channel_affect);
}
// SDFGI
@@ -1150,26 +1160,29 @@ void Environment::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_ssao_radius"), &Environment::get_ssao_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_power", "power"), &Environment::set_ssao_power);
+ ClassDB::bind_method(D_METHOD("get_ssao_power"), &Environment::get_ssao_power);
+ ClassDB::bind_method(D_METHOD("set_ssao_detail", "detail"), &Environment::set_ssao_detail);
+ ClassDB::bind_method(D_METHOD("get_ssao_detail"), &Environment::get_ssao_detail);
+ ClassDB::bind_method(D_METHOD("set_ssao_horizon", "horizon"), &Environment::set_ssao_horizon);
+ ClassDB::bind_method(D_METHOD("get_ssao_horizon"), &Environment::get_ssao_horizon);
+ ClassDB::bind_method(D_METHOD("set_ssao_sharpness", "sharpness"), &Environment::set_ssao_sharpness);
+ ClassDB::bind_method(D_METHOD("get_ssao_sharpness"), &Environment::get_ssao_sharpness);
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_radius", PROPERTY_HINT_RANGE, "0.01,16,0.01,or_greater"), "set_ssao_radius", "get_ssao_radius");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_intensity", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_ssao_intensity", "get_ssao_intensity");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_power", PROPERTY_HINT_EXP_EASING), "set_ssao_power", "get_ssao_power");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_detail", PROPERTY_HINT_RANGE, "0,5,0.01"), "set_ssao_detail", "get_ssao_detail");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_horizon", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ssao_horizon", "get_ssao_horizon");
+ ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ssao_sharpness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ssao_sharpness", "get_ssao_sharpness");
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
@@ -1367,11 +1380,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 106ba92bfe..a720f2cc47 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,
@@ -148,12 +141,13 @@ private:
// SSAO
bool ssao_enabled = false;
float ssao_radius = 1.0;
- float ssao_intensity = 1.0;
- float ssao_bias = 0.01;
+ float ssao_intensity = 2.0;
+ float ssao_power = 1.5;
+ float ssao_detail = 0.5;
+ float ssao_horizon = 0.06;
+ float ssao_sharpness = 0.98;
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
@@ -295,16 +289,18 @@ public:
float get_ssao_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_power(float p_power);
+ float get_ssao_power() const;
+ void set_ssao_detail(float p_detail);
+ float get_ssao_detail() const;
+ void set_ssao_horizon(float p_horizon);
+ float get_ssao_horizon() const;
+ void set_ssao_sharpness(float p_sharpness);
+ float get_ssao_sharpness() 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);
@@ -414,7 +410,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)