diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-09-16 20:46:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-09-16 20:58:04 +0300 |
commit | 5aa0797d447e74eb1eb119f02f7cb7dfdbc1d37e (patch) | |
tree | e584d7e4b0d58ee048f30042bda7ff91cbb335f2 | |
parent | 5e8b09259bf20f6b1a35422580adccc99c803a3e (diff) |
Fix static initialization order crash with denoise parameters
Now that DenoiseParams is a Node, we can no longer create an instance of
it when defining the Integrator Node, since that might not have been
registered yet.
-rw-r--r-- | intern/cycles/device/device_denoise.h | 10 | ||||
-rw-r--r-- | intern/cycles/render/integrator.cpp | 26 |
2 files changed, 15 insertions, 21 deletions
diff --git a/intern/cycles/device/device_denoise.h b/intern/cycles/device/device_denoise.h index 494ff940276..02ee63fb0ad 100644 --- a/intern/cycles/device/device_denoise.h +++ b/intern/cycles/device/device_denoise.h @@ -52,7 +52,9 @@ enum DenoiserPrefilter { DENOISER_PREFILTER_NUM, }; -/* NOTE: Is not a real scene node. Using Node API for ease of (de)serialization. */ +/* NOTE: Is not a real scene node. Using Node API for ease of (de)serialization. + * The default values here do not really matter as they are always initialized from the + * Integrator node. */ class DenoiseParams : public Node { public: NODE_DECLARE @@ -66,11 +68,9 @@ class DenoiseParams : public Node { /* Viewport start sample. */ int start_sample = 0; - /* Extra passes which are used by the denoiser (the color pass is always used). - * Default to color + albedo only, since normal input does not always have the desired effect - * when denoising with OptiX. */ + /* Auxiliry passes. */ bool use_pass_albedo = true; - bool use_pass_normal = false; + bool use_pass_normal = true; DenoiserPrefilter prefilter = DENOISER_PREFILTER_FAST; diff --git a/intern/cycles/render/integrator.cpp b/intern/cycles/render/integrator.cpp index 35a61a663cc..9188a52d9be 100644 --- a/intern/cycles/render/integrator.cpp +++ b/intern/cycles/render/integrator.cpp @@ -90,22 +90,16 @@ NODE_DEFINE(Integrator) denoiser_prefilter_enum.insert("fast", DENOISER_PREFILTER_FAST); denoiser_prefilter_enum.insert("accurate", DENOISER_PREFILTER_ACCURATE); - /* Construct default parameters, so that they are the source of truth for defaults. */ - const DenoiseParams default_denoise_params; - - SOCKET_BOOLEAN(use_denoise, "Use Denoiser", default_denoise_params.use); - SOCKET_ENUM(denoiser_type, "Denoiser Type", denoiser_type_enum, default_denoise_params.type); - SOCKET_INT(denoise_start_sample, "Start Sample to Denoise", default_denoise_params.start_sample); - SOCKET_BOOLEAN(use_denoise_pass_albedo, - "Use Albedo Pass for Denoiser", - default_denoise_params.use_pass_albedo); - SOCKET_BOOLEAN(use_denoise_pass_normal, - "Use Normal Pass for Denoiser Denoiser", - default_denoise_params.use_pass_normal); - SOCKET_ENUM(denoiser_prefilter, - "Denoiser Type", - denoiser_prefilter_enum, - default_denoise_params.prefilter); + /* Default to accurate denoising with OpenImageDenoise. For interactive viewport + * it's best use OptiX and disable the normal pass since it does not always have + * the desired effect for that denoiser. */ + SOCKET_BOOLEAN(use_denoise, "Use Denoiser", false); + SOCKET_ENUM(denoiser_type, "Denoiser Type", denoiser_type_enum, DENOISER_OPENIMAGEDENOISE); + SOCKET_INT(denoise_start_sample, "Start Sample to Denoise", 0); + SOCKET_BOOLEAN(use_denoise_pass_albedo, "Use Albedo Pass for Denoiser", true); + SOCKET_BOOLEAN(use_denoise_pass_normal, "Use Normal Pass for Denoiser", true); + SOCKET_ENUM( + denoiser_prefilter, "Denoiser Type", denoiser_prefilter_enum, DENOISER_PREFILTER_ACCURATE); return type; } |