[Bf-blender-cvs] [7d17f2addf8] master: Fix T89998: Cryptomatte node output values doubled with Multi-View

Manuel Castilla noreply at git.blender.org
Mon Aug 23 17:18:44 CEST 2021


Commit: 7d17f2addf80f7ee315b49e0c281562050ee0667
Author: Manuel Castilla
Date:   Mon Aug 23 15:31:21 2021 +0200
Branches: master
https://developer.blender.org/rB7d17f2addf80f7ee315b49e0c281562050ee0667

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

===================================================================

M	source/blender/compositor/intern/COM_CompositorContext.h
M	source/blender/compositor/nodes/COM_CryptomatteNode.cc

===================================================================

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(



More information about the Bf-blender-cvs mailing list