diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-23 16:31:21 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-08-23 18:09:59 +0300 |
commit | 7d17f2addf80f7ee315b49e0c281562050ee0667 (patch) | |
tree | e271405f06e81f372057984067ca4d9fe3f8b14a /source | |
parent | 4c6d207343bc43ce3a4568038397347f6bdf69c4 (diff) |
Fix T89998: Cryptomatte node output values doubled with Multi-View
When using a Cryptomatte node and selecting 2 views in Multi-View,
its output values are doubled. When selecting 3 tripled and so on.
This causes incorrect compositing results for all the views.
The node creates an input operation for each rendered cryptomatte
pass. In Multi-View, passes are rendered for each view but compositor
is executed per view and should only create operations for those
corresponding to the current view being executed. Otherwise duplicated
operations add up later in cryptomatte operation.
Reviewed By: jbakker
Maniphest Tasks: T89998
Differential Revision: https://developer.blender.org/D12216
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/compositor/intern/COM_CompositorContext.h | 6 | ||||
-rw-r--r-- | source/blender/compositor/nodes/COM_CryptomatteNode.cc | 4 |
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 403ec62e359..c6e83f93777 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -239,6 +239,12 @@ class CompositorContext { this->m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices; } + /** Whether it has a view with a specific name and not the default one. */ + bool has_explicit_view() const + { + return m_viewName && m_viewName[0] != '\0'; + } + /** * \brief get the active rendering view */ diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index 4032a655633..5835f051ce3 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -124,6 +124,10 @@ void CryptomatteNode::input_operations_from_render_source( RenderLayer *render_layer = RE_GetRenderLayer(render_result, view_layer->name); if (render_layer) { LISTBASE_FOREACH (RenderPass *, render_pass, &render_layer->passes) { + if (context.has_explicit_view() && !STREQ(render_pass->view, context.getViewName())) { + continue; + } + const std::string combined_name = combined_layer_pass_name(render_layer, render_pass); if (blender::StringRef(combined_name).startswith(prefix)) { RenderLayersProg *op = new RenderLayersProg( |