Fix T78692: improve UI regarding the effect of the denoiser on denoising passes

It wasn't obvious that the choice of Cycles denoiser also generates different
denoising data passes for compositing.
This commit is contained in:
Brecht Van Lommel 2020-07-07 14:45:31 +02:00
parent a394aac8b4
commit 95f0f31279
Notes: blender-bot 2023-02-14 01:21:16 +01:00
Referenced by issue #78692, The Optix denoiser is influencing Open Image Denoiser results even when it's disabled.
3 changed files with 34 additions and 20 deletions

View File

@ -224,7 +224,7 @@ def system_info():
import _cycles
return _cycles.system_info()
def list_render_passes(srl):
def list_render_passes(scene, srl):
# Builtin Blender passes.
yield ("Combined", "RGBA", 'COLOR')
@ -279,14 +279,17 @@ def list_render_passes(srl):
yield ("Denoising Normal", "XYZ", 'VECTOR')
yield ("Denoising Albedo", "RGB", 'COLOR')
yield ("Denoising Depth", "Z", 'VALUE')
yield ("Denoising Shadowing", "X", 'VALUE')
yield ("Denoising Variance", "RGB", 'COLOR')
yield ("Denoising Intensity", "X", 'VALUE')
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
"denoising_glossy_direct", "denoising_glossy_indirect",
"denoising_transmission_direct", "denoising_transmission_indirect")
if any(getattr(crl, option) for option in clean_options):
yield ("Denoising Clean", "RGB", 'COLOR')
if scene.cycles.denoiser == 'NLM':
yield ("Denoising Shadowing", "X", 'VALUE')
yield ("Denoising Variance", "RGB", 'COLOR')
yield ("Denoising Intensity", "X", 'VALUE')
clean_options = ("denoising_diffuse_direct", "denoising_diffuse_indirect",
"denoising_glossy_direct", "denoising_glossy_indirect",
"denoising_transmission_direct", "denoising_transmission_indirect")
if any(getattr(crl, option) for option in clean_options):
yield ("Denoising Clean", "RGB", 'COLOR')
# Custom AOV passes.
for aov in crl.aovs:
@ -298,15 +301,15 @@ def list_render_passes(srl):
def register_passes(engine, scene, view_layer):
# Detect duplicate render pass names, first one wins.
listed = set()
for name, channelids, channeltype in list_render_passes(view_layer):
for name, channelids, channeltype in list_render_passes(scene, view_layer):
if name not in listed:
engine.register_pass(scene, view_layer, name, len(channelids), channelids, channeltype)
listed.add(name)
def detect_conflicting_passes(view_layer):
def detect_conflicting_passes(scene, view_layer):
# Detect conflicting render pass names for UI.
counter = {}
for name, _, _ in list_render_passes(view_layer):
for name, _, _ in list_render_passes(scene, view_layer):
counter[name] = counter.get(name, 0) + 1
for aov in view_layer.cycles.aovs:

View File

@ -182,6 +182,7 @@ enum_aov_types = (
('COLOR', "Color", "Write a Color pass", 1),
)
def enum_openimagedenoise_denoiser(self, context):
if _cycles.with_openimagedenoise:
return [('OPENIMAGEDENOISE', "OpenImageDenoise", "Use Intel OpenImageDenoise AI denoiser running on the CPU", 4)]
@ -216,6 +217,14 @@ enum_denoising_optix_input_passes = (
('RGB_ALBEDO_NORMAL', "Color + Albedo + Normal", "Use color, albedo and normal data as input", 3),
)
def update_render_passes(self, context):
scene = context.scene
view_layer = context.view_layer
view_layer.update_render_passes()
engine.detect_conflicting_passes(scene, view_layer)
class CyclesRenderSettings(bpy.types.PropertyGroup):
device: EnumProperty(
@ -261,9 +270,12 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
denoiser: EnumProperty(
name="Denoiser",
description="Denoise the image with the selected denoiser",
description="Denoise the image with the selected denoiser. "
"For denoising the image after rendering, denoising data render passes "
"also adapt to the selected denoiser.",
items=enum_denoiser,
default=1,
update=update_render_passes,
)
preview_denoiser: EnumProperty(
name="Viewport Denoiser",
@ -1291,12 +1303,6 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
del bpy.types.Scene.cycles_curves
def update_render_passes(self, context):
view_layer = context.view_layer
view_layer.update_render_passes()
engine.detect_conflicting_passes(view_layer)
class CyclesAOVPass(bpy.types.PropertyGroup):
name: StringProperty(
name="Name",
@ -1430,7 +1436,7 @@ class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
)
denoising_store_passes: BoolProperty(
name="Store Denoising Passes",
description="Store the denoising feature passes and the noisy image",
description="Store the denoising feature passes and the noisy image. The passes adapt to the denoiser selected for rendering",
default=False,
update=update_render_passes,
)

View File

@ -265,7 +265,12 @@ class CYCLES_RENDER_PT_sampling_denoising(CyclesButtonsPanel, Panel):
row = heading.row(align=True)
row.prop(cscene, "use_denoising", text="")
sub = row.row()
sub.active = cscene.use_denoising
for view_layer in scene.view_layers:
if view_layer.cycles.denoising_store_passes:
sub.active = True
sub.prop(cscene, "denoiser", text="")
heading = layout.column(align=False, heading="Viewport")