diff options
author | Yuri Sizov <yuris@humnom.net> | 2023-09-27 19:08:01 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-09-27 19:08:01 +0200 |
commit | aa82cccc41a0fc1b1f9b6cfa4b5d93635ea1b20b (patch) | |
tree | 05bc55ad26c49209e2a17d43339946d9830201d0 /scene/3d/lightmap_gi.cpp | |
parent | 54c7a26a3b28db99895f17bec8d45fc856a1ade8 (diff) | |
parent | ab65effed015df76b0858df27127f62b3aa94e0e (diff) | |
download | redot-engine-aa82cccc41a0fc1b1f9b6cfa4b5d93635ea1b20b.tar.gz |
Merge pull request #81659 from DarioSamo/nlm-denoiser
Replace OIDN denoiser in Lightmapper with a JNLM denoiser compute shader.
Diffstat (limited to 'scene/3d/lightmap_gi.cpp')
-rw-r--r-- | scene/3d/lightmap_gi.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/scene/3d/lightmap_gi.cpp b/scene/3d/lightmap_gi.cpp index 3d40e9795e..21d0b12bdb 100644 --- a/scene/3d/lightmap_gi.cpp +++ b/scene/3d/lightmap_gi.cpp @@ -1080,7 +1080,7 @@ LightmapGI::BakeError LightmapGI::bake(Node *p_from_node, String p_image_data_pa } } - Lightmapper::BakeError bake_err = lightmapper->bake(Lightmapper::BakeQuality(bake_quality), use_denoiser, bounces, bias, max_texture_size, directional, Lightmapper::GenerateProbes(gen_probes), environment_image, environment_transform, _lightmap_bake_step_function, &bsud, exposure_normalization); + Lightmapper::BakeError bake_err = lightmapper->bake(Lightmapper::BakeQuality(bake_quality), use_denoiser, denoiser_strength, bounces, bias, max_texture_size, directional, Lightmapper::GenerateProbes(gen_probes), environment_image, environment_transform, _lightmap_bake_step_function, &bsud, exposure_normalization); if (bake_err == Lightmapper::BAKE_ERROR_LIGHTMAP_TOO_SMALL) { return BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL; @@ -1362,12 +1362,21 @@ AABB LightmapGI::get_aabb() const { void LightmapGI::set_use_denoiser(bool p_enable) { use_denoiser = p_enable; + notify_property_list_changed(); } bool LightmapGI::is_using_denoiser() const { return use_denoiser; } +void LightmapGI::set_denoiser_strength(float p_denoiser_strength) { + denoiser_strength = p_denoiser_strength; +} + +float LightmapGI::get_denoiser_strength() const { + return denoiser_strength; +} + void LightmapGI::set_directional(bool p_enable) { directional = p_enable; } @@ -1482,6 +1491,9 @@ void LightmapGI::_validate_property(PropertyInfo &p_property) const { if (p_property.name == "environment_custom_energy" && environment_mode != ENVIRONMENT_MODE_CUSTOM_COLOR && environment_mode != ENVIRONMENT_MODE_CUSTOM_SKY) { p_property.usage = PROPERTY_USAGE_NONE; } + if (p_property.name == "denoiser_strength" && !use_denoiser) { + p_property.usage = PROPERTY_USAGE_NONE; + } } void LightmapGI::_bind_methods() { @@ -1518,6 +1530,9 @@ void LightmapGI::_bind_methods() { ClassDB::bind_method(D_METHOD("set_use_denoiser", "use_denoiser"), &LightmapGI::set_use_denoiser); ClassDB::bind_method(D_METHOD("is_using_denoiser"), &LightmapGI::is_using_denoiser); + ClassDB::bind_method(D_METHOD("set_denoiser_strength", "denoiser_strength"), &LightmapGI::set_denoiser_strength); + ClassDB::bind_method(D_METHOD("get_denoiser_strength"), &LightmapGI::get_denoiser_strength); + ClassDB::bind_method(D_METHOD("set_interior", "enable"), &LightmapGI::set_interior); ClassDB::bind_method(D_METHOD("is_interior"), &LightmapGI::is_interior); @@ -1535,6 +1550,7 @@ void LightmapGI::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "directional"), "set_directional", "is_directional"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_denoiser"), "set_use_denoiser", "is_using_denoiser"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "denoiser_strength", PROPERTY_HINT_RANGE, "0.001,0.2,0.001,or_greater"), "set_denoiser_strength", "get_denoiser_strength"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bias", PROPERTY_HINT_RANGE, "0.00001,0.1,0.00001,or_greater"), "set_bias", "get_bias"); ADD_PROPERTY(PropertyInfo(Variant::INT, "max_texture_size", PROPERTY_HINT_RANGE, "2048,16384,1"), "set_max_texture_size", "get_max_texture_size"); ADD_GROUP("Environment", "environment_"); |