diff options
author | Patrick Mours <pmours@nvidia.com> | 2020-02-11 18:30:01 +0300 |
---|---|---|
committer | Patrick Mours <pmours@nvidia.com> | 2020-02-11 20:03:43 +0300 |
commit | 38589de10c098cfe32ac7716f4d7844abf959753 (patch) | |
tree | d28b007bdc75e4eefd1d7ded5115655c50a72140 /intern/cycles/blender/addon/ui.py | |
parent | 35490c3ead03d472dbcba36c85d428e81b442520 (diff) |
Cycles: Add support for denoising in the viewport
The OptiX denoiser can be a great help when rendering in the viewport, since it is really fast
and needs few samples to produce convincing results. This patch therefore adds support for
using any Cycles denoiser in the viewport also (but only the OptiX one is selectable because
the NLM one is too slow to be usable currently). It also adds support for denoising on a
different device than rendering (so one can e.g. render with the CPU but denoise with OptiX).
Reviewed By: #cycles, brecht
Differential Revision: https://developer.blender.org/D6554
Diffstat (limited to 'intern/cycles/blender/addon/ui.py')
-rw-r--r-- | intern/cycles/blender/addon/ui.py | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 35d5d3801d2..f23d141e3da 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -112,6 +112,10 @@ def show_device_active(context): return True return context.preferences.addons[__package__].preferences.has_active_device() +def show_optix_denoising(context): + # OptiX AI denoiser can be used when at least one device supports OptiX + return bool(context.preferences.addons[__package__].preferences.get_devices_for_type('OPTIX')) + def draw_samples_info(layout, context): cscene = context.scene.cycles @@ -177,17 +181,23 @@ class CYCLES_RENDER_PT_sampling(CyclesButtonsPanel, Panel): if not use_optix(context): layout.prop(cscene, "progressive") - if cscene.progressive == 'PATH' or use_branched_path(context) is False: + if not use_branched_path(context): col = layout.column(align=True) col.prop(cscene, "samples", text="Render") col.prop(cscene, "preview_samples", text="Viewport") - - draw_samples_info(layout, context) else: col = layout.column(align=True) col.prop(cscene, "aa_samples", text="Render") col.prop(cscene, "preview_aa_samples", text="Viewport") + # Viewport denoising is currently only supported with OptiX + if show_optix_denoising(context): + col = layout.column() + col.prop(cscene, "preview_denoising") + + if not use_branched_path(context): + draw_samples_info(layout, context) + class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel): bl_label = "Sub Samples" @@ -195,9 +205,7 @@ class CYCLES_RENDER_PT_sampling_sub_samples(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - scene = context.scene - cscene = scene.cycles - return cscene.progressive != 'PATH' and use_branched_path(context) + return use_branched_path(context) def draw(self, context): layout = self.layout @@ -635,9 +643,6 @@ class CYCLES_RENDER_PT_performance_tiles(CyclesButtonsPanel, Panel): sub = col.column() sub.active = not rd.use_save_buffers - for view_layer in scene.view_layers: - if view_layer.cycles.use_denoising: - sub.active = False sub.prop(cscene, "use_progressive_refine") @@ -981,15 +986,14 @@ class CYCLES_RENDER_PT_denoising(CyclesButtonsPanel, Panel): col = split.column(align=True) - if use_optix(context): - col.prop(cycles_view_layer, "use_optix_denoising", text="OptiX AI Denoising") + if show_optix_denoising(context): + col.prop(cycles_view_layer, "use_optix_denoising") + col.separator(factor=2.0) 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") @@ -2192,8 +2196,6 @@ def draw_device(self, context): col = layout.column() col.prop(cscene, "feature_set") - scene = context.scene - col = layout.column() col.active = show_device_active(context) col.prop(cscene, "device") |