diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp |
= |
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp |
--- a/intern/cycles/blender/sync.cpp |
|
--- a/intern/cycles/blender/sync.cpp |
+++ b/intern/cycles/blender/sync.cpp |
|
+++ b/intern/cycles/blender/sync.cpp |
integrator->set_use_denoise_pass_albedo(denoise_params.use_pass_albedo); |
|
integrator->set_use_denoise_pass_albedo(denoise_params.use_pass_albedo); |
integrator->set_use_denoise_pass_normal(denoise_params.use_pass_normal); |
|
integrator->set_use_denoise_pass_normal(denoise_params.use_pass_normal); |
integrator->set_denoiser_prefilter(denoise_params.prefilter); |
|
integrator->set_denoiser_prefilter(denoise_params.prefilter); |
+ integrator->set_denoiser_quality(denoise_params.quality); |
|
+ integrator->set_denoiser_quality(denoise_params.quality); |
} |
|
} |
|
|
|
/* UPDATE_NONE as we don't want to tag the integrator as modified (this was done by the |
|
/* UPDATE_NONE as we don't want to tag the integrator as modified (this was done by the |
denoising.prefilter = (DenoiserPrefilter)get_enum( |
|
denoising.prefilter = (DenoiserPrefilter)get_enum( |
cscene, "denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_NONE); |
|
cscene, "denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_NONE); |
|
|
|
input_passes = (DenoiserInput)get_enum( |
|
input_passes = (DenoiserInput)get_enum( |
cscene, "denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO_NORMAL); |
|
cscene, "denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO_NORMAL); |
denoising.prefilter = (DenoiserPrefilter)get_enum( |
|
denoising.prefilter = (DenoiserPrefilter)get_enum( |
cscene, "preview_denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_FAST); |
|
cscene, "preview_denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_FAST); |
denoising.start_sample = get_int(cscene, "preview_denoising_start_sample"); |
|
denoising.start_sample = get_int(cscene, "preview_denoising_start_sample"); |
|
|
|
input_passes = (DenoiserInput)get_enum( |
|
input_passes = (DenoiserInput)get_enum( |
diff --git a/intern/cycles/device/denoise.cpp b/intern/cycles/device/denoise.cpp |
|
diff --git a/intern/cycles/device/denoise.cpp b/intern/cycles/device/denoise.cpp |
index 64f507ca29e..dc5d3373298 100644 |
|
index 64f507ca29e..dc5d3373298 100644 |
--- a/intern/cycles/device/denoise.cpp |
|
--- a/intern/cycles/device/denoise.cpp |
+++ b/intern/cycles/device/denoise.cpp |
|
+++ b/intern/cycles/device/denoise.cpp |
@@ -48,12 +48,25 @@ const NodeEnum *DenoiseParams::get_prefilter_enum() |
|
@@ -48,12 +48,25 @@ const NodeEnum *DenoiseParams::get_prefilter_enum() |
return &prefilter_enum; |
|
return &prefilter_enum; |
} |
|
} |
|
|
|
+const NodeEnum *DenoiseParams::get_quality_enum() |
|
+const NodeEnum *DenoiseParams::get_quality_enum() |
+{ |
|
+{ |
+ static NodeEnum quality_enum; |
|
+ static NodeEnum quality_enum; |
+ |
|
+ |
+ if (quality_enum.empty()) { |
|
+ if (quality_enum.empty()) { |
+ quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
|
+ quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
+ quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
|
+ quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
+ } |
|
+ } |
+ |
|
+ |
+ return &quality_enum; |
|
+ return &quality_enum; |
+} |
|
+} |
+ |
|
+ |
NODE_DEFINE(DenoiseParams) |
|
NODE_DEFINE(DenoiseParams) |
{ |
|
{ |
NodeType *type = NodeType::add("denoise_params", create); |
|
NodeType *type = NodeType::add("denoise_params", create); |
|
|
|
const NodeEnum *type_enum = get_type_enum(); |
|
const NodeEnum *type_enum = get_type_enum(); |
const NodeEnum *prefilter_enum = get_prefilter_enum(); |
|
const NodeEnum *prefilter_enum = get_prefilter_enum(); |
+ const NodeEnum *quality_enum = get_quality_enum(); |
|
+ const NodeEnum *quality_enum = get_quality_enum(); |
|
|
|
SOCKET_BOOLEAN(use, "Use", false); |
|
SOCKET_BOOLEAN(use, "Use", false); |
|
|
|
@@ -67,6 +80,7 @@ NODE_DEFINE(DenoiseParams) |
|
@@ -67,6 +80,7 @@ NODE_DEFINE(DenoiseParams) |
SOCKET_BOOLEAN(temporally_stable, "Temporally Stable", false); |
|
SOCKET_BOOLEAN(temporally_stable, "Temporally Stable", false); |
|
|
|
SOCKET_ENUM(prefilter, "Prefilter", *prefilter_enum, DENOISER_PREFILTER_FAST); |
|
SOCKET_ENUM(prefilter, "Prefilter", *prefilter_enum, DENOISER_PREFILTER_FAST); |
+ SOCKET_ENUM(quality, "Quality", *quality_enum, DENOISER_QUALITY_HIGH); |
|
+ SOCKET_ENUM(quality, "Quality", *quality_enum, DENOISER_QUALITY_HIGH); |
|
|
|
return type; |
|
return type; |
} |
|
} |
diff --git a/intern/cycles/device/denoise.h b/intern/cycles/device/denoise.h |
|
diff --git a/intern/cycles/device/denoise.h b/intern/cycles/device/denoise.h |
--- a/intern/cycles/device/denoise.h |
|
--- a/intern/cycles/device/denoise.h |
+++ b/intern/cycles/device/denoise.h |
|
+++ b/intern/cycles/device/denoise.h |
}; |
|
}; |
|
|
|
diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp |
|
diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp |
--- a/intern/cycles/integrator/denoiser_oidn.cpp |
|
--- a/intern/cycles/integrator/denoiser_oidn.cpp |
+++ b/intern/cycles/integrator/denoiser_oidn.cpp |
|
+++ b/intern/cycles/integrator/denoiser_oidn.cpp |
@@ -164,6 +164,18 @@ class OIDNDenoiseContext { |
|
@@ -164,6 +164,18 @@ class OIDNDenoiseContext { |
oidn_filter.setProgressMonitorFunction(oidn_progress_monitor_function, denoiser_); |
|
oidn_filter.setProgressMonitorFunction(oidn_progress_monitor_function, denoiser_); |
oidn_filter.set("hdr", true); |
|
oidn_filter.set("hdr", true); |
oidn_filter.set("srgb", false); |
|
oidn_filter.set("srgb", false); |
+ |
|
+ |
+# if OIDN_VERSION_MAJOR >= 2 |
|
+# if OIDN_VERSION_MAJOR >= 2 |
+ switch (denoise_params_.quality) { |
|
+ switch (denoise_params_.quality) { |
+ case DENOISER_QUALITY_BALANCED: |
|
+ case DENOISER_QUALITY_BALANCED: |
+ oidn_filter.set("quality", OIDN_QUALITY_BALANCED); |
|
+ oidn_filter.set("quality", OIDN_QUALITY_BALANCED); |
+ break; |
|
+ break; |
+ case DENOISER_QUALITY_HIGH: |
|
+ case DENOISER_QUALITY_HIGH: |
+ default: |
|
+ default: |
+ oidn_filter.set("quality", OIDN_QUALITY_HIGH); |
|
+ oidn_filter.set("quality", OIDN_QUALITY_HIGH); |
+ } |
|
+ } |
+# endif |
|
+# endif |
+ |
|
+ |
if (denoise_params_.prefilter == DENOISER_PREFILTER_NONE || |
|
if (denoise_params_.prefilter == DENOISER_PREFILTER_NONE || |
denoise_params_.prefilter == DENOISER_PREFILTER_ACCURATE) |
|
denoise_params_.prefilter == DENOISER_PREFILTER_ACCURATE) |
{ |
|
{ |
diff --git a/intern/cycles/integrator/denoiser_oidn_gpu.cpp b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
|
diff --git a/intern/cycles/integrator/denoiser_oidn_gpu.cpp b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
--- a/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
|
--- a/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
|
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
--- a/intern/cycles/integrator/denoiser_oidn_gpu.h |
|
--- a/intern/cycles/integrator/denoiser_oidn_gpu.h |
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.h |
|
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.h |
|
|
|
bool use_pass_albedo_ = false; |
|
bool use_pass_albedo_ = false; |
bool use_pass_normal_ = false; |
|
bool use_pass_normal_ = false; |
+ DenoiserQuality quality_ = DENOISER_QUALITY_HIGH; |
|
+ DenoiserQuality quality_ = DENOISER_QUALITY_HIGH; |
|
|
|
int max_mem_ = 3000; |
|
int max_mem_ = 3000; |
}; |
|
}; |
diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp |
|
diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp |
--- a/intern/cycles/scene/integrator.cpp |
|
--- a/intern/cycles/scene/integrator.cpp |
+++ b/intern/cycles/scene/integrator.cpp |
|
+++ b/intern/cycles/scene/integrator.cpp |
@@ -136,6 +136,10 @@ NODE_DEFINE(Integrator) |
|
@@ -136,6 +136,10 @@ NODE_DEFINE(Integrator) |
denoiser_prefilter_enum.insert("fast", DENOISER_PREFILTER_FAST); |
|
denoiser_prefilter_enum.insert("fast", DENOISER_PREFILTER_FAST); |
denoiser_prefilter_enum.insert("accurate", DENOISER_PREFILTER_ACCURATE); |
|
denoiser_prefilter_enum.insert("accurate", DENOISER_PREFILTER_ACCURATE); |
|
|
|
+ static NodeEnum denoiser_quality_enum; |
|
+ static NodeEnum denoiser_quality_enum; |
+ denoiser_quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
|
+ denoiser_quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
+ denoiser_quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
|
+ denoiser_quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
+ |
|
+ |
/* Default to accurate denoising with OpenImageDenoise. For interactive viewport |
|
/* 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 |
|
* it's best use OptiX and disable the normal pass since it does not always have |
* the desired effect for that denoiser. */ |
|
* the desired effect for that denoiser. */ |
denoiser_prefilter_enum, |
|
denoiser_prefilter_enum, |
DENOISER_PREFILTER_ACCURATE); |
|
DENOISER_PREFILTER_ACCURATE); |
+ SOCKET_ENUM(denoiser_quality, "Denoiser Quality", denoiser_quality_enum, DENOISER_QUALITY_HIGH); |
|
+ SOCKET_ENUM(denoiser_quality, "Denoiser Quality", denoiser_quality_enum, DENOISER_QUALITY_HIGH); |
|
|
|
return type; |
|
return type; |
} |
|
} |
denoise_params.use_pass_normal = use_denoise_pass_normal; |
|
denoise_params.use_pass_normal = use_denoise_pass_normal; |
|
|
|
denoise_params.prefilter = denoiser_prefilter; |
|
denoise_params.prefilter = denoiser_prefilter; |
+ denoise_params.quality = denoiser_quality; |
|
+ denoise_params.quality = denoiser_quality; |
|
|
|
return denoise_params; |
|
return denoise_params; |
} |
|
} |
diff --git a/intern/cycles/scene/integrator.h b/intern/cycles/scene/integrator.h |
|
diff --git a/intern/cycles/scene/integrator.h b/intern/cycles/scene/integrator.h |
--- a/intern/cycles/scene/integrator.h |
|
--- a/intern/cycles/scene/integrator.h |
+++ b/intern/cycles/scene/integrator.h |
|
+++ b/intern/cycles/scene/integrator.h |
diff --git a/intern/cycles/blender/addon/presets.py b/intern/cycles/blender/addon/presets.py |
+- |
|
index acd999b1e29..4db9f8f1aa0 100644 |
|
|
--- a/intern/cycles/blender/addon/presets.py |
|
|
+++ b/intern/cycles/blender/addon/presets.py |
|
|
@@ -56,6 +56,7 @@ class AddPresetSampling(AddPresetBase, Operator): |
|
|
"cycles.denoiser", |
|
|
"cycles.denoising_input_passes", |
|
|
"cycles.denoising_prefilter", |
|
|
+ "cycles.denoising_quality", |
|
|
] |
|
|
|
|
|
preset_subdir = "cycles/sampling" |
|
|
@@ -80,6 +81,7 @@ class AddPresetViewportSampling(AddPresetBase, Operator): |
|
|
"cycles.preview_denoiser", |
|
|
"cycles.preview_denoising_input_passes", |
|
|
"cycles.preview_denoising_prefilter", |
|
|
+ "cycles.preview_denoising_quality", |
|
|
"cycles.preview_denoising_start_sample", |
|
|
] |
|
|
|
|
|
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py |
|
|
index 95f2df291df..8e2c809aaf3 100644 |
|
|
--- a/intern/cycles/blender/addon/properties.py |
|
|
+++ b/intern/cycles/blender/addon/properties.py |
|
|
@@ -280,6 +280,17 @@ enum_denoising_prefilter = ( |
|
|
3), |
|
|
) |
|
|
|
|
|
+enum_denoising_quality = ( |
|
|
+ ('HIGH', |
|
|
+ "High", |
|
|
+ "High quality", |
|
|
+ 1), |
|
|
+ ('BALANCED', |
|
|
+ "Balanced", |
|
|
+ "Balances quality and performance", |
|
|
+ 2), |
|
|
+) |
|
|
+ |
|
|
enum_direct_light_sampling_type = ( |
|
|
('MULTIPLE_IMPORTANCE_SAMPLING', |
|
|
"Multiple Importance Sampling", |
|
|
@@ -352,6 +363,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): |
|
|
items=enum_denoising_prefilter, |
|
|
default='ACCURATE', |
|
|
) |
|
|
+ denoising_quality: EnumProperty( |
|
|
+ name="Denoising Quality", |
|
|
+ description="Select between quality and performance tradeoffs when using OpenImageDenoise", |
|
|
+ items=enum_denoising_quality, |
|
|
+ default='HIGH', |
|
|
+ ) |
|
|
denoising_input_passes: EnumProperty( |
|
|
name="Denoising Input Passes", |
|
|
description="Passes used by the denoiser to distinguish noise from shader and geometry detail", |
|
|
@@ -376,6 +393,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup): |
|
|
items=enum_denoising_prefilter, |
|
|
default='FAST', |
|
|
) |
|
|
+ preview_denoising_quality: EnumProperty( |
|
|
+ name="Viewport Denoising Quality", |
|
|
+ description="Select between quality and performance tradeoffs when using OpenImageDenoise", |
|
|
+ items=enum_denoising_quality, |
|
|
+ default='BALANCED', |
|
|
+ ) |
|
|
preview_denoising_input_passes: EnumProperty( |
|
|
name="Viewport Denoising Input Passes", |
|
|
description="Passes used by the denoiser to distinguish noise from shader and geometry detail", |
|
|
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py |
|
|
index 6cf30b21e18..b1b3fdefbd8 100644 |
|
|
--- a/intern/cycles/blender/addon/ui.py |
|
|
+++ b/intern/cycles/blender/addon/ui.py |
|
|
@@ -229,6 +229,7 @@ class CYCLES_RENDER_PT_sampling_viewport_denoise(CyclesButtonsPanel, Panel): |
|
|
effective_preview_denoiser = get_effective_preview_denoiser(context) |
|
|
if effective_preview_denoiser == 'OPENIMAGEDENOISE': |
|
|
col.prop(cscene, "preview_denoising_prefilter", text="Prefilter") |
|
|
+ col.prop(cscene, "preview_denoising_quality", text="Quality") |
|
|
|
|
|
col.prop(cscene, "preview_denoising_start_sample", text="Start Sample") |
|
|
|
|
|
@@ -290,6 +291,7 @@ class CYCLES_RENDER_PT_sampling_render_denoise(CyclesButtonsPanel, Panel): |
|
|
col.prop(cscene, "denoising_input_passes", text="Passes") |
|
|
if cscene.denoiser == 'OPENIMAGEDENOISE': |
|
|
col.prop(cscene, "denoising_prefilter", text="Prefilter") |
|
|
+ col.prop(cscene, "denoising_quality", text="Quality") |
|
|
|
|
|
|
|
|
class CYCLES_RENDER_PT_sampling_path_guiding(CyclesButtonsPanel, Panel): |
|
|
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp |
= |
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp |
index 49d031b53b7..1d8d851e192 100644 |
<> |
index d165a4f9b09..2f177731fd6 100644 |
--- a/intern/cycles/blender/sync.cpp |
= |
--- a/intern/cycles/blender/sync.cpp |
+++ b/intern/cycles/blender/sync.cpp |
|
+++ b/intern/cycles/blender/sync.cpp |
@@ -476,6 +476,7 @@ void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer, bool background) |
<> |
@@ -479,6 +479,7 @@ void BlenderSync::sync_integrator(BL::ViewLayer &b_view_layer, bool background) |
integrator->set_use_denoise_pass_albedo(denoise_params.use_pass_albedo); |
= |
integrator->set_use_denoise_pass_albedo(denoise_params.use_pass_albedo); |
integrator->set_use_denoise_pass_normal(denoise_params.use_pass_normal); |
|
integrator->set_use_denoise_pass_normal(denoise_params.use_pass_normal); |
integrator->set_denoiser_prefilter(denoise_params.prefilter); |
|
integrator->set_denoiser_prefilter(denoise_params.prefilter); |
+ integrator->set_denoiser_quality(denoise_params.quality); |
|
+ integrator->set_denoiser_quality(denoise_params.quality); |
} |
|
} |
|
|
|
/* UPDATE_NONE as we don't want to tag the integrator as modified (this was done by the |
|
/* UPDATE_NONE as we don't want to tag the integrator as modified (this was done by the |
@@ -970,6 +971,8 @@ DenoiseParams BlenderSync::get_denoise_params(BL::Scene &b_scene, |
<> |
@@ -974,6 +975,9 @@ DenoiseParams BlenderSync::get_denoise_params(BL::Scene &b_scene, |
denoising.type = (DenoiserType)get_enum(cscene, "denoiser", DENOISER_NUM, DENOISER_NONE); |
|
denoising.use_gpu = get_boolean(cscene, "denoising_use_gpu"); |
denoising.prefilter = (DenoiserPrefilter)get_enum( |
= |
denoising.prefilter = (DenoiserPrefilter)get_enum( |
cscene, "denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_NONE); |
|
cscene, "denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_NONE); |
+ denoising.quality = (DenoiserQuality)get_enum( |
<> |
+ /* This currently only affects NVIDIA and the difference in quality is too small to justify |
+ cscene, "denoising_quality", DENOISER_QUALITY_NUM, DENOISER_QUALITY_HIGH); |
|
+ * exposing a setting to the user. */ |
|
|
+ denoising.quality = DENOISER_QUALITY_HIGH; |
|
= |
|
input_passes = (DenoiserInput)get_enum( |
|
input_passes = (DenoiserInput)get_enum( |
cscene, "denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO_NORMAL); |
|
cscene, "denoising_input_passes", DENOISER_INPUT_NUM, DENOISER_INPUT_RGB_ALBEDO_NORMAL); |
@@ -988,6 +991,9 @@ DenoiseParams BlenderSync::get_denoise_params(BL::Scene &b_scene, |
<> |
@@ -993,6 +997,9 @@ DenoiseParams BlenderSync::get_denoise_params(BL::Scene &b_scene, |
cscene, "preview_denoiser", DENOISER_NUM, DENOISER_NONE); |
|
denoising.use_gpu = get_boolean(cscene, "preview_denoising_use_gpu"); |
denoising.prefilter = (DenoiserPrefilter)get_enum( |
= |
denoising.prefilter = (DenoiserPrefilter)get_enum( |
cscene, "preview_denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_FAST); |
|
cscene, "preview_denoising_prefilter", DENOISER_PREFILTER_NUM, DENOISER_PREFILTER_FAST); |
+ denoising.quality = (DenoiserQuality)get_enum( |
<> |
+ /* This currently only affects NVIDIA and the difference in quality is too small to justify |
+ cscene, "preview_denoising_quality", DENOISER_QUALITY_NUM, DENOISER_QUALITY_BALANCED); |
|
+ * exposing a setting to the user. */ |
+ |
|
+ denoising.quality = DENOISER_QUALITY_BALANCED; |
denoising.start_sample = get_int(cscene, "preview_denoising_start_sample"); |
= |
denoising.start_sample = get_int(cscene, "preview_denoising_start_sample"); |
|
|
|
input_passes = (DenoiserInput)get_enum( |
|
input_passes = (DenoiserInput)get_enum( |
diff --git a/intern/cycles/device/denoise.cpp b/intern/cycles/device/denoise.cpp |
|
diff --git a/intern/cycles/device/denoise.cpp b/intern/cycles/device/denoise.cpp |
index 64f507ca29e..dc5d3373298 100644 |
|
index 64f507ca29e..dc5d3373298 100644 |
--- a/intern/cycles/device/denoise.cpp |
|
--- a/intern/cycles/device/denoise.cpp |
+++ b/intern/cycles/device/denoise.cpp |
|
+++ b/intern/cycles/device/denoise.cpp |
@@ -48,12 +48,25 @@ const NodeEnum *DenoiseParams::get_prefilter_enum() |
|
@@ -48,12 +48,25 @@ const NodeEnum *DenoiseParams::get_prefilter_enum() |
return &prefilter_enum; |
|
return &prefilter_enum; |
} |
|
} |
|
|
|
+const NodeEnum *DenoiseParams::get_quality_enum() |
|
+const NodeEnum *DenoiseParams::get_quality_enum() |
+{ |
|
+{ |
+ static NodeEnum quality_enum; |
|
+ static NodeEnum quality_enum; |
+ |
|
+ |
+ if (quality_enum.empty()) { |
|
+ if (quality_enum.empty()) { |
+ quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
|
+ quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
+ quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
|
+ quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
+ } |
|
+ } |
+ |
|
+ |
+ return &quality_enum; |
|
+ return &quality_enum; |
+} |
|
+} |
+ |
|
+ |
NODE_DEFINE(DenoiseParams) |
|
NODE_DEFINE(DenoiseParams) |
{ |
|
{ |
NodeType *type = NodeType::add("denoise_params", create); |
|
NodeType *type = NodeType::add("denoise_params", create); |
|
|
|
const NodeEnum *type_enum = get_type_enum(); |
|
const NodeEnum *type_enum = get_type_enum(); |
const NodeEnum *prefilter_enum = get_prefilter_enum(); |
|
const NodeEnum *prefilter_enum = get_prefilter_enum(); |
+ const NodeEnum *quality_enum = get_quality_enum(); |
|
+ const NodeEnum *quality_enum = get_quality_enum(); |
|
|
|
SOCKET_BOOLEAN(use, "Use", false); |
|
SOCKET_BOOLEAN(use, "Use", false); |
|
|
|
@@ -67,6 +80,7 @@ NODE_DEFINE(DenoiseParams) |
|
@@ -67,6 +80,7 @@ NODE_DEFINE(DenoiseParams) |
SOCKET_BOOLEAN(temporally_stable, "Temporally Stable", false); |
|
SOCKET_BOOLEAN(temporally_stable, "Temporally Stable", false); |
|
|
|
SOCKET_ENUM(prefilter, "Prefilter", *prefilter_enum, DENOISER_PREFILTER_FAST); |
|
SOCKET_ENUM(prefilter, "Prefilter", *prefilter_enum, DENOISER_PREFILTER_FAST); |
+ SOCKET_ENUM(quality, "Quality", *quality_enum, DENOISER_QUALITY_HIGH); |
|
+ SOCKET_ENUM(quality, "Quality", *quality_enum, DENOISER_QUALITY_HIGH); |
|
|
|
return type; |
|
return type; |
} |
|
} |
diff --git a/intern/cycles/device/denoise.h b/intern/cycles/device/denoise.h |
|
diff --git a/intern/cycles/device/denoise.h b/intern/cycles/device/denoise.h |
index 8beddac2524..cbb98447914 100644 |
<> |
index edf5bebc6ea..ca5f651bb05 100644 |
--- a/intern/cycles/device/denoise.h |
= |
--- a/intern/cycles/device/denoise.h |
+++ b/intern/cycles/device/denoise.h |
|
+++ b/intern/cycles/device/denoise.h |
@@ -40,6 +40,12 @@ enum DenoiserPrefilter { |
|
@@ -40,6 +40,12 @@ enum DenoiserPrefilter { |
DENOISER_PREFILTER_NUM, |
|
DENOISER_PREFILTER_NUM, |
}; |
|
}; |
|
|
|
+enum DenoiserQuality { |
|
+enum DenoiserQuality { |
+ DENOISER_QUALITY_HIGH = 1, |
|
+ DENOISER_QUALITY_HIGH = 1, |
+ DENOISER_QUALITY_BALANCED = 2, |
|
+ DENOISER_QUALITY_BALANCED = 2, |
+ DENOISER_QUALITY_NUM, |
|
+ DENOISER_QUALITY_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 |
|
* The default values here do not really matter as they are always initialized from the |
* Integrator node. */ |
|
* Integrator node. */ |
@@ -64,19 +70,13 @@ class DenoiseParams : public Node { |
<> |
@@ -69,20 +75,13 @@ class DenoiseParams : public Node { |
bool temporally_stable = false; |
|
bool use_gpu = true; |
|
= |
|
DenoiserPrefilter prefilter = DENOISER_PREFILTER_FAST; |
|
DenoiserPrefilter prefilter = DENOISER_PREFILTER_FAST; |
+ DenoiserQuality quality = DENOISER_QUALITY_HIGH; |
|
+ DenoiserQuality quality = DENOISER_QUALITY_HIGH; |
|
|
|
static const NodeEnum *get_type_enum(); |
|
static const NodeEnum *get_type_enum(); |
static const NodeEnum *get_prefilter_enum(); |
|
static const NodeEnum *get_prefilter_enum(); |
+ static const NodeEnum *get_quality_enum(); |
|
+ static const NodeEnum *get_quality_enum(); |
|
|
|
DenoiseParams(); |
|
DenoiseParams(); |
- |
|
- |
- bool modified(const DenoiseParams &other) const |
|
- bool modified(const DenoiseParams &other) const |
- { |
|
- { |
- return !(use == other.use && type == other.type && start_sample == other.start_sample && |
|
- return !(use == other.use && type == other.type && start_sample == other.start_sample && |
- use_pass_albedo == other.use_pass_albedo && |
|
- use_pass_albedo == other.use_pass_albedo && |
- use_pass_normal == other.use_pass_normal && |
|
- use_pass_normal == other.use_pass_normal && |
- temporally_stable == other.temporally_stable && prefilter == other.prefilter); |
<> |
- temporally_stable == other.temporally_stable && use_gpu == other.use_gpu && |
|
|
- prefilter == other.prefilter); |
- } |
= |
- } |
}; |
|
}; |
|
|
|
CCL_NAMESPACE_END |
|
CCL_NAMESPACE_END |
diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp |
|
diff --git a/intern/cycles/integrator/denoiser_oidn.cpp b/intern/cycles/integrator/denoiser_oidn.cpp |
index ab10fc05814..ec3e3aebff7 100644 |
<> |
index e956699b30b..07ece3cc769 100644 |
--- a/intern/cycles/integrator/denoiser_oidn.cpp |
= |
--- a/intern/cycles/integrator/denoiser_oidn.cpp |
+++ b/intern/cycles/integrator/denoiser_oidn.cpp |
|
+++ b/intern/cycles/integrator/denoiser_oidn.cpp |
@@ -164,6 +164,18 @@ class OIDNDenoiseContext { |
|
@@ -164,6 +164,18 @@ class OIDNDenoiseContext { |
oidn_filter.setProgressMonitorFunction(oidn_progress_monitor_function, denoiser_); |
|
oidn_filter.setProgressMonitorFunction(oidn_progress_monitor_function, denoiser_); |
oidn_filter.set("hdr", true); |
|
oidn_filter.set("hdr", true); |
oidn_filter.set("srgb", false); |
|
oidn_filter.set("srgb", false); |
+ |
|
+ |
+# if OIDN_VERSION_MAJOR >= 2 |
|
+# if OIDN_VERSION_MAJOR >= 2 |
+ switch (denoise_params_.quality) { |
|
+ switch (denoise_params_.quality) { |
+ case DENOISER_QUALITY_BALANCED: |
|
+ case DENOISER_QUALITY_BALANCED: |
+ oidn_filter.set("quality", OIDN_QUALITY_BALANCED); |
|
+ oidn_filter.set("quality", OIDN_QUALITY_BALANCED); |
+ break; |
|
+ break; |
+ case DENOISER_QUALITY_HIGH: |
|
+ case DENOISER_QUALITY_HIGH: |
+ default: |
|
+ default: |
+ oidn_filter.set("quality", OIDN_QUALITY_HIGH); |
|
+ oidn_filter.set("quality", OIDN_QUALITY_HIGH); |
+ } |
|
+ } |
+# endif |
|
+# endif |
+ |
|
+ |
if (denoise_params_.prefilter == DENOISER_PREFILTER_NONE || |
|
if (denoise_params_.prefilter == DENOISER_PREFILTER_NONE || |
denoise_params_.prefilter == DENOISER_PREFILTER_ACCURATE) |
|
denoise_params_.prefilter == DENOISER_PREFILTER_ACCURATE) |
{ |
|
{ |
diff --git a/intern/cycles/integrator/denoiser_oidn_gpu.cpp b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
|
diff --git a/intern/cycles/integrator/denoiser_oidn_gpu.cpp b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
index 308a88754b0..8fc6fe2b5c9 100644 |
<> |
index 260fceb6756..948094d1046 100644 |
--- a/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
= |
--- a/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
|
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.cpp |
@@ -108,7 +108,8 @@ bool OIDNDenoiserGPU::denoise_create_if_needed(DenoiseContext &context) |
<> |
@@ -139,7 +139,8 @@ bool OIDNDenoiserGPU::denoise_create_if_needed(DenoiseContext &context) |
{ |
= |
{ |
const bool recreate_denoiser = (oidn_device_ == nullptr) || (oidn_filter_ == nullptr) || |
|
const bool recreate_denoiser = (oidn_device_ == nullptr) || (oidn_filter_ == nullptr) || |
(use_pass_albedo_ != context.use_pass_albedo) || |
|
(use_pass_albedo_ != context.use_pass_albedo) || |
- (use_pass_normal_ != context.use_pass_normal); |
|
- (use_pass_normal_ != context.use_pass_normal); |
+ (use_pass_normal_ != context.use_pass_normal) || |
|
+ (use_pass_normal_ != context.use_pass_normal) || |
+ (quality_ != params_.quality); |
|
+ (quality_ != params_.quality); |
if (!recreate_denoiser) { |
|
if (!recreate_denoiser) { |
return true; |
|
return true; |
} |
|
} |
@@ -153,6 +154,18 @@ bool OIDNDenoiserGPU::denoise_create_if_needed(DenoiseContext &context) |
<> |
@@ -206,6 +207,18 @@ bool OIDNDenoiserGPU::denoise_create_if_needed(DenoiseContext &context) |
oidnSetFilterInt(oidn_filter_, "cleanAux", true); |
= |
oidnSetFilterInt(oidn_filter_, "cleanAux", true); |
} |
|
} |
|
|
|
+# if OIDN_VERSION_MAJOR >= 2 |
|
+# if OIDN_VERSION_MAJOR >= 2 |
+ switch (params_.quality) { |
|
+ switch (params_.quality) { |
+ case DENOISER_QUALITY_BALANCED: |
|
+ case DENOISER_QUALITY_BALANCED: |
+ oidnSetFilterInt(oidn_filter_, "quality", OIDN_QUALITY_BALANCED); |
|
+ oidnSetFilterInt(oidn_filter_, "quality", OIDN_QUALITY_BALANCED); |
+ break; |
|
+ break; |
+ case DENOISER_QUALITY_HIGH: |
|
+ case DENOISER_QUALITY_HIGH: |
+ default: |
|
+ default: |
+ oidnSetFilterInt(oidn_filter_, "quality", OIDN_QUALITY_HIGH); |
|
+ oidnSetFilterInt(oidn_filter_, "quality", OIDN_QUALITY_HIGH); |
+ } |
|
+ } |
+ quality_ = params_.quality; |
|
+ quality_ = params_.quality; |
+# endif |
|
+# endif |
+ |
|
+ |
if (context.use_pass_albedo) { |
|
if (context.use_pass_albedo) { |
albedo_filter_ = create_filter(); |
|
albedo_filter_ = create_filter(); |
if (albedo_filter_ == nullptr) { |
|
if (albedo_filter_ == nullptr) { |
diff --git a/intern/cycles/integrator/denoiser_oidn_gpu.h b/intern/cycles/integrator/denoiser_oidn_gpu.h |
|
diff --git a/intern/cycles/integrator/denoiser_oidn_gpu.h b/intern/cycles/integrator/denoiser_oidn_gpu.h |
index bd815140956..06278451a5b 100644 |
<> |
index 4d41a295c94..aad583a5a69 100644 |
--- a/intern/cycles/integrator/denoiser_oidn_gpu.h |
= |
--- a/intern/cycles/integrator/denoiser_oidn_gpu.h |
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.h |
|
+++ b/intern/cycles/integrator/denoiser_oidn_gpu.h |
@@ -66,6 +66,7 @@ class OIDNDenoiserGPU : public DenoiserGPU { |
<> |
@@ -61,6 +61,7 @@ class OIDNDenoiserGPU : public DenoiserGPU { |
|
= |
|
bool use_pass_albedo_ = false; |
|
bool use_pass_albedo_ = false; |
bool use_pass_normal_ = false; |
|
bool use_pass_normal_ = false; |
+ DenoiserQuality quality_ = DENOISER_QUALITY_HIGH; |
|
+ DenoiserQuality quality_ = DENOISER_QUALITY_HIGH; |
|
|
|
int max_mem_ = 3000; |
|
int max_mem_ = 3000; |
}; |
|
}; |
diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp |
|
diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp |
index a2d496d110f..9cf4831c927 100644 |
<> |
index c4ad20e26f4..61bf09ecc9e 100644 |
--- a/intern/cycles/scene/integrator.cpp |
= |
--- a/intern/cycles/scene/integrator.cpp |
+++ b/intern/cycles/scene/integrator.cpp |
|
+++ b/intern/cycles/scene/integrator.cpp |
@@ -136,6 +136,10 @@ NODE_DEFINE(Integrator) |
|
@@ -136,6 +136,10 @@ NODE_DEFINE(Integrator) |
denoiser_prefilter_enum.insert("fast", DENOISER_PREFILTER_FAST); |
|
denoiser_prefilter_enum.insert("fast", DENOISER_PREFILTER_FAST); |
denoiser_prefilter_enum.insert("accurate", DENOISER_PREFILTER_ACCURATE); |
|
denoiser_prefilter_enum.insert("accurate", DENOISER_PREFILTER_ACCURATE); |
|
|
|
+ static NodeEnum denoiser_quality_enum; |
|
+ static NodeEnum denoiser_quality_enum; |
+ denoiser_quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
|
+ denoiser_quality_enum.insert("high", DENOISER_QUALITY_HIGH); |
+ denoiser_quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
|
+ denoiser_quality_enum.insert("balanced", DENOISER_QUALITY_BALANCED); |
+ |
|
+ |
/* Default to accurate denoising with OpenImageDenoise. For interactive viewport |
|
/* 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 |
|
* it's best use OptiX and disable the normal pass since it does not always have |
* the desired effect for that denoiser. */ |
|
* the desired effect for that denoiser. */ |
@@ -148,6 +152,7 @@ NODE_DEFINE(Integrator) |
<> |
@@ -149,6 +153,7 @@ NODE_DEFINE(Integrator) |
"Denoiser Prefilter", |
|
|
denoiser_prefilter_enum, |
= |
denoiser_prefilter_enum, |
DENOISER_PREFILTER_ACCURATE); |
|
DENOISER_PREFILTER_ACCURATE); |
|
-+ |
SOCKET_BOOLEAN(denoise_use_gpu, "Denoise on GPU", true); |
+ SOCKET_ENUM(denoiser_quality, "Denoiser Quality", denoiser_quality_enum, DENOISER_QUALITY_HIGH); |
= |
+ SOCKET_ENUM(denoiser_quality, "Denoiser Quality", denoiser_quality_enum, DENOISER_QUALITY_HIGH); |
|
|
|
return type; |
|
return type; |
} |
|
} |
@@ -399,6 +404,7 @@ DenoiseParams Integrator::get_denoise_params() const |
<> |
@@ -402,6 +407,7 @@ DenoiseParams Integrator::get_denoise_params() const |
denoise_params.use_pass_normal = use_denoise_pass_normal; |
= |
denoise_params.use_pass_normal = use_denoise_pass_normal; |
|
|
|
denoise_params.prefilter = denoiser_prefilter; |
|
denoise_params.prefilter = denoiser_prefilter; |
+ denoise_params.quality = denoiser_quality; |
|
+ denoise_params.quality = denoiser_quality; |
|
|
|
return denoise_params; |
|
return denoise_params; |
} |
|
} |
diff --git a/intern/cycles/scene/integrator.h b/intern/cycles/scene/integrator.h |
|
diff --git a/intern/cycles/scene/integrator.h b/intern/cycles/scene/integrator.h |
index 7fecd733d14..2859215135d 100644 |
<> |
index 749e37d4498..3d2885f15bb 100644 |
--- a/intern/cycles/scene/integrator.h |
= |
--- a/intern/cycles/scene/integrator.h |
+++ b/intern/cycles/scene/integrator.h |
|
+++ b/intern/cycles/scene/integrator.h |
@@ -98,6 +98,7 @@ class Integrator : public Node { |
<> |
@@ -99,6 +99,7 @@ class Integrator : public Node { |
NODE_SOCKET_API(bool, use_denoise_pass_albedo); |
|
|
NODE_SOCKET_API(bool, use_denoise_pass_normal); |
= |
NODE_SOCKET_API(bool, use_denoise_pass_normal); |
NODE_SOCKET_API(DenoiserPrefilter, denoiser_prefilter); |
|
NODE_SOCKET_API(DenoiserPrefilter, denoiser_prefilter); |
|
-+ |
NODE_SOCKET_API(bool, denoise_use_gpu); |
+ NODE_SOCKET_API(DenoiserQuality, denoiser_quality); |
= |
+ NODE_SOCKET_API(DenoiserQuality, denoiser_quality); |
|
|
|
enum : uint32_t { |
|
enum : uint32_t { |
AO_PASS_MODIFIED = (1 << 0), |
|
AO_PASS_MODIFIED = (1 << 0), |