Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2019-12-11 20:11:46 +0300
committerPatrick Mours <pmours@nvidia.com>2020-01-08 18:53:11 +0300
commitd5ca72191c36f3022db8fa5a17d933ee82c82d30 (patch)
tree8708d0e1d793d8aa6275dfafaae075f3192a28c5 /intern/cycles/blender
parentf1516e007d9c9f72218c3256eaa1b478a6c25052 (diff)
Cycles: Add OptiX AI denoiser support
This patch adds support for the OptiX denoiser as an alternative to the existing NLM denoiser in Cycles. It's re-using the same denoising architecture based on tiles and therefore implicitly also works with multiple GPUs. Reviewed By: sergey Differential Revision: https://developer.blender.org/D6395
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/addon/properties.py20
-rw-r--r--intern/cycles/blender/addon/ui.py20
-rw-r--r--intern/cycles/blender/blender_session.cpp19
-rw-r--r--intern/cycles/blender/blender_sync.cpp32
4 files changed, 64 insertions, 27 deletions
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index e09f15b46e8..5f163c2510b 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -197,6 +197,12 @@ enum_aov_types = (
('COLOR', "Color", "Write a Color pass", 1),
)
+enum_denoising_optix_input_passes= (
+ ('RGB', "Color", "Use only color as input", 1),
+ ('RGB_ALBEDO', "Color + Albedo", "Use color and albedo data as input", 2),
+ ('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
+)
+
class CyclesRenderSettings(bpy.types.PropertyGroup):
device: EnumProperty(
@@ -1279,6 +1285,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
update=update_render_passes,
)
+
use_pass_volume_direct: BoolProperty(
name="Volume Direct",
description="Deliver direct volumetric scattering pass",
@@ -1298,6 +1305,12 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
default=False,
update=update_render_passes,
)
+ use_optix_denoising: BoolProperty(
+ name="Use OptiX AI Denoising",
+ description="Denoise the rendered image with the OptiX AI denoiser",
+ default=False,
+ update=update_render_passes,
+ )
denoising_diffuse_direct: BoolProperty(
name="Diffuse Direct",
description="Denoise the direct diffuse lighting",
@@ -1374,6 +1387,13 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
min=0, max=7,
default=0,
)
+ denoising_optix_input_passes: EnumProperty(
+ name="Input Passes",
+ description="Controls which passes the OptiX AI denoiser should use as input, which can have different effects on the denoised image",
+ items=enum_denoising_optix_input_passes,
+ default='RGB',
+ )
+
use_pass_crypto_object: BoolProperty(
name="Cryptomatte Object",
description="Render cryptomatte object pass, for isolating objects in compositing",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index c4182ba564a..35d5d3801d2 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -979,11 +979,21 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel):
split = layout.split()
split.active = cycles_view_layer.use_denoising
- layout = layout.column(align=True)
- layout.prop(cycles_view_layer, "denoising_radius", text="Radius")
- layout.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
- layout.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
- layout.prop(cycles_view_layer, "denoising_relative_pca")
+ col = split.column(align=True)
+
+ if use_optix(context):
+ col.prop(cycles_view_layer, "use_optix_denoising", text="OptiX AI Denoising")
+
+ if cycles_view_layer.use_optix_denoising:
+ col.prop(cycles_view_layer, "denoising_optix_input_passes")
+ return
+
+ col.separator(factor=2.0)
+
+ col.prop(cycles_view_layer, "denoising_radius", text="Radius")
+ col.prop(cycles_view_layer, "denoising_strength", slider=True, text="Strength")
+ col.prop(cycles_view_layer, "denoising_feature_strength", slider=True, text="Feature Strength")
+ col.prop(cycles_view_layer, "denoising_relative_pca")
layout.separator()
diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp
index 26b04babce2..924807350f9 100644
--- a/intern/cycles/blender/blender_session.cpp
+++ b/intern/cycles/blender/blender_session.cpp
@@ -478,23 +478,24 @@ void BlenderSession::render(BL::Depsgraph &b_depsgraph_)
buffer_params.passes = passes;
PointerRNA crl = RNA_pointer_get(&b_view_layer.ptr, "cycles");
- bool full_denoising = get_boolean(crl, "use_denoising");
+ bool use_denoising = get_boolean(crl, "use_denoising");
+ bool use_optix_denoising = get_boolean(crl, "use_optix_denoising");
bool write_denoising_passes = get_boolean(crl, "denoising_store_passes");
- bool run_denoising = full_denoising || write_denoising_passes;
-
- session->tile_manager.schedule_denoising = run_denoising;
- buffer_params.denoising_data_pass = run_denoising;
+ buffer_params.denoising_data_pass = use_denoising || write_denoising_passes;
buffer_params.denoising_clean_pass = (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES);
- buffer_params.denoising_prefiltered_pass = write_denoising_passes;
+ buffer_params.denoising_prefiltered_pass = write_denoising_passes && !use_optix_denoising;
- session->params.run_denoising = run_denoising;
- session->params.full_denoising = full_denoising;
- session->params.write_denoising_passes = write_denoising_passes;
+ session->params.run_denoising = use_denoising || write_denoising_passes;
+ session->params.full_denoising = use_denoising && !use_optix_denoising;
+ session->params.optix_denoising = use_denoising && use_optix_denoising;
+ session->params.write_denoising_passes = write_denoising_passes && !use_optix_denoising;
session->params.denoising.radius = get_int(crl, "denoising_radius");
session->params.denoising.strength = get_float(crl, "denoising_strength");
session->params.denoising.feature_strength = get_float(crl, "denoising_feature_strength");
session->params.denoising.relative_pca = get_boolean(crl, "denoising_relative_pca");
+ session->params.denoising.optix_input_passes = get_enum(crl, "denoising_optix_input_passes");
+ session->tile_manager.schedule_denoising = session->params.run_denoising;
scene->film->denoising_data_pass = buffer_params.denoising_data_pass;
scene->film->denoising_clean_pass = buffer_params.denoising_clean_pass;
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 332ee3575c0..20dbe23cdb7 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -535,23 +535,26 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLa
}
PointerRNA crp = RNA_pointer_get(&b_view_layer.ptr, "cycles");
- bool full_denoising = get_boolean(crp, "use_denoising");
+ bool use_denoising = get_boolean(crp, "use_denoising");
+ bool use_optix_denoising = get_boolean(crp, "use_optix_denoising");
bool write_denoising_passes = get_boolean(crp, "denoising_store_passes");
scene->film->denoising_flags = 0;
- if (full_denoising || write_denoising_passes) {
+ if (use_denoising || write_denoising_passes) {
+ if (!use_optix_denoising) {
#define MAP_OPTION(name, flag) \
if (!get_boolean(crp, name)) \
scene->film->denoising_flags |= flag;
- MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
- MAP_OPTION("denoising_diffuse_indirect", DENOISING_CLEAN_DIFFUSE_IND);
- MAP_OPTION("denoising_glossy_direct", DENOISING_CLEAN_GLOSSY_DIR);
- MAP_OPTION("denoising_glossy_indirect", DENOISING_CLEAN_GLOSSY_IND);
- MAP_OPTION("denoising_transmission_direct", DENOISING_CLEAN_TRANSMISSION_DIR);
- MAP_OPTION("denoising_transmission_indirect", DENOISING_CLEAN_TRANSMISSION_IND);
- MAP_OPTION("denoising_subsurface_direct", DENOISING_CLEAN_SUBSURFACE_DIR);
- MAP_OPTION("denoising_subsurface_indirect", DENOISING_CLEAN_SUBSURFACE_IND);
+ MAP_OPTION("denoising_diffuse_direct", DENOISING_CLEAN_DIFFUSE_DIR);
+ MAP_OPTION("denoising_diffuse_indirect", DENOISING_CLEAN_DIFFUSE_IND);
+ MAP_OPTION("denoising_glossy_direct", DENOISING_CLEAN_GLOSSY_DIR);
+ MAP_OPTION("denoising_glossy_indirect", DENOISING_CLEAN_GLOSSY_IND);
+ MAP_OPTION("denoising_transmission_direct", DENOISING_CLEAN_TRANSMISSION_DIR);
+ MAP_OPTION("denoising_transmission_indirect", DENOISING_CLEAN_TRANSMISSION_IND);
+ MAP_OPTION("denoising_subsurface_direct", DENOISING_CLEAN_SUBSURFACE_DIR);
+ MAP_OPTION("denoising_subsurface_indirect", DENOISING_CLEAN_SUBSURFACE_IND);
#undef MAP_OPTION
+ }
b_engine.add_pass("Noisy Image", 4, "RGBA", b_view_layer.name().c_str());
}
@@ -559,14 +562,17 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer &b_rlay, BL::ViewLa
b_engine.add_pass("Denoising Normal", 3, "XYZ", b_view_layer.name().c_str());
b_engine.add_pass("Denoising Albedo", 3, "RGB", b_view_layer.name().c_str());
b_engine.add_pass("Denoising Depth", 1, "Z", b_view_layer.name().c_str());
- b_engine.add_pass("Denoising Shadowing", 1, "X", b_view_layer.name().c_str());
- b_engine.add_pass("Denoising Variance", 3, "RGB", b_view_layer.name().c_str());
- b_engine.add_pass("Denoising Intensity", 1, "X", b_view_layer.name().c_str());
+ if (!use_optix_denoising) {
+ b_engine.add_pass("Denoising Shadowing", 1, "X", b_view_layer.name().c_str());
+ b_engine.add_pass("Denoising Variance", 3, "RGB", b_view_layer.name().c_str());
+ b_engine.add_pass("Denoising Intensity", 1, "X", b_view_layer.name().c_str());
+ }
if (scene->film->denoising_flags & DENOISING_CLEAN_ALL_PASSES) {
b_engine.add_pass("Denoising Clean", 3, "RGB", b_view_layer.name().c_str());
}
}
+
#ifdef __KERNEL_DEBUG__
if (get_boolean(crp, "pass_debug_bvh_traversed_nodes")) {
b_engine.add_pass("Debug BVH Traversed Nodes", 1, "X", b_view_layer.name().c_str());