diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-07-07 15:45:31 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-07-07 16:12:41 +0300 |
commit | 95f0f312799e10e4a9f5c884f8f20ec76d0ff363 (patch) | |
tree | 9f7a741ed6a8d47b49e9055de8ec61f43c09ba77 /intern/cycles/blender/addon | |
parent | a394aac8b473962061eb3d6b3dbcf9429cbac67e (diff) |
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.
Diffstat (limited to 'intern/cycles/blender/addon')
-rw-r--r-- | intern/cycles/blender/addon/engine.py | 27 | ||||
-rw-r--r-- | intern/cycles/blender/addon/properties.py | 22 | ||||
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 5 |
3 files changed, 34 insertions, 20 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py index 7566ca28dd7..67e448db859 100644 --- a/intern/cycles/blender/addon/engine.py +++ b/intern/cycles/blender/addon/engine.py @@ -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: diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index da706451f88..0cc419c7025 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -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, ) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 129f16b0357..bf81a360020 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -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") |