diff options
author | clayjohn <claynjohn@gmail.com> | 2020-09-14 23:47:07 -0700 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2020-10-18 13:15:51 -0700 |
commit | 366ee4677487223015f1f7f92bf955452a5cf83f (patch) | |
tree | b58a460a385cd3b4ec1c3fb6a6e8d2071a184b37 /scene/resources/environment.cpp | |
parent | 4467412c9f78f3ddaf7edd4627ec7d629a6234df (diff) |
Replace SAO implementation with MSSAO
Diffstat (limited to 'scene/resources/environment.cpp')
-rw-r--r-- | scene/resources/environment.cpp | 67 |
1 files changed, 18 insertions, 49 deletions
diff --git a/scene/resources/environment.cpp b/scene/resources/environment.cpp index 3df539c86e..027042a161 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 @@ -1110,30 +1090,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 @@ -1328,11 +1302,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); |