Compositing reroute converts floats to red color #41573

Closed
opened 2014-08-25 16:08:23 +02:00 by Damien Picard · 15 comments
Member

System Information
Ubuntu 14.04
GTX 660M

Blender Version
Broken: 2.71.5 ca1bca4
Worked: 2.71

When viewing a float reroute node, instead of converting the value to RGB, only the red canal is set, resulting in red image.

Viewer connected to the RenderLayer alpha output:
bug_reroute1.jpg

Viewer connected to the reroute output:
bug_reroute.jpg
Exact steps for others to reproduce the error

**System Information** Ubuntu 14.04 GTX 660M **Blender Version** Broken: 2.71.5 ca1bca4 Worked: 2.71 When viewing a float reroute node, instead of converting the value to RGB, only the red canal is set, resulting in red image. Viewer connected to the RenderLayer alpha output: ![bug_reroute1.jpg](https://archive.blender.org/developer/F106655/bug_reroute1.jpg) Viewer connected to the reroute output: ![bug_reroute.jpg](https://archive.blender.org/developer/F106656/bug_reroute.jpg) **Exact steps for others to reproduce the error** * Open file. * Render [bug_reroute.blend](https://archive.blender.org/developer/F106653/bug_reroute.blend)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @pioverfour

Added subscriber: @pioverfour

#41724 was marked as duplicate of this issue

#41724 was marked as duplicate of this issue
Lukas Tönne was assigned by Sergey Sharybin 2014-08-25 16:54:52 +02:00

Added subscribers: @LukasTonne, @Sergey

Added subscribers: @LukasTonne, @Sergey

@LukasTonne, mind having a look?

@LukasTonne, mind having a look?

Added subscriber: @mont29

Added subscriber: @mont29

Added subscriber: @sebastian_k

Added subscriber: @sebastian_k

◀ Merged tasks: #41724.

◀ Merged tasks: #41724.

Ok, so issue goes back (at least) to 09874df135

It affects both reroute and muted nodes (try e.g. a NOP math node between alpha input and viewer, no problem, but mute it, you get red again).

This simple patch fixes it all, but would not swear this is the right solution, since I do not exactly fully understand that 'convert' parameter…

P140: (An Untitled Masterwork)

diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp
index 2dcf419..d7ad5ec 100644
--- a/source/blender/compositor/intern/COM_NodeGraph.cpp
+++ b/source/blender/compositor/intern/COM_NodeGraph.cpp
@@ -202,7 +202,7 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink
 void NodeGraph::add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
 {
 	for (bNodeLink *b_link = (bNodeLink *)b_node->internal_links.first; b_link; b_link = b_link->next) {
-		SocketProxyNode *proxy = new SocketProxyNode(b_node, b_link->fromsock, b_link->tosock, false);
+		SocketProxyNode *proxy = new SocketProxyNode(b_node, b_link->fromsock, b_link->tosock, true);
 		add_node(proxy, b_ntree, key, is_active_group);
 	}
 }
@@ -294,6 +294,6 @@ void NodeGraph::add_proxies_group(const CompositorContext &context, bNode *b_nod
 
 void NodeGraph::add_proxies_reroute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group)
 {
-	SocketProxyNode *proxy = new SocketProxyNode(b_node, (bNodeSocket *)b_node->inputs.first, (bNodeSocket *)b_node->outputs.first, false);
+	SocketProxyNode *proxy = new SocketProxyNode(b_node, (bNodeSocket *)b_node->inputs.first, (bNodeSocket *)b_node->outputs.first, true);
 	add_node(proxy, b_ntree, key, is_active_group);
 }

Lukas, definitively your call now. ;)

Ok, so issue goes back (at least) to 09874df135 It affects both reroute and muted nodes (try e.g. a NOP math node between alpha input and viewer, no problem, but mute it, you get red again). This simple patch fixes it all, but would not swear this is the right solution, since I do not exactly fully understand that 'convert' parameter… [P140: (An Untitled Masterwork)](https://archive.blender.org/developer/P140.txt) ``` diff --git a/source/blender/compositor/intern/COM_NodeGraph.cpp b/source/blender/compositor/intern/COM_NodeGraph.cpp index 2dcf419..d7ad5ec 100644 --- a/source/blender/compositor/intern/COM_NodeGraph.cpp +++ b/source/blender/compositor/intern/COM_NodeGraph.cpp @@ -202,7 +202,7 @@ void NodeGraph::add_bNodeLink(const NodeRange &node_range, bNodeLink *b_nodelink void NodeGraph::add_proxies_mute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group) { for (bNodeLink *b_link = (bNodeLink *)b_node->internal_links.first; b_link; b_link = b_link->next) { - SocketProxyNode *proxy = new SocketProxyNode(b_node, b_link->fromsock, b_link->tosock, false); + SocketProxyNode *proxy = new SocketProxyNode(b_node, b_link->fromsock, b_link->tosock, true); add_node(proxy, b_ntree, key, is_active_group); } } @@ -294,6 +294,6 @@ void NodeGraph::add_proxies_group(const CompositorContext &context, bNode *b_nod void NodeGraph::add_proxies_reroute(bNodeTree *b_ntree, bNode *b_node, bNodeInstanceKey key, bool is_active_group) { - SocketProxyNode *proxy = new SocketProxyNode(b_node, (bNodeSocket *)b_node->inputs.first, (bNodeSocket *)b_node->outputs.first, false); + SocketProxyNode *proxy = new SocketProxyNode(b_node, (bNodeSocket *)b_node->inputs.first, (bNodeSocket *)b_node->outputs.first, true); add_node(proxy, b_ntree, key, is_active_group); } ``` Lukas, definitively your call now. ;)
Member

@mont29 the use_conversion parameter for proxies controls whether data gets converted to the proxies own type in every case or not. This is useful e.g. for node groups, where you expect the proxies to have the specified interface type. So for example when a group socket is defined as "Float" and an RGBA is passed in it always gets converted to Float anyway, even when used as RGBA internally. Otherwise the behavior of the group could vary depending on the external nodes.

For the reroute sockets a conversion should not be necessary - in fact they change their type in the UI to indicate that the input type is passed on unmodified! The problem then is why the reroute node actually causes the buffer to become an "RGBA" (with only the red channel). The viewer node should only see a Float input and use the first (R) channel as the value, instead of interpreting it as a full RGBA color value ...

@mont29 the `use_conversion` parameter for proxies controls whether data gets converted to the proxies own type in every case or not. This is useful e.g. for node groups, where you expect the proxies to have the specified interface type. So for example when a group socket is defined as "Float" and an RGBA is passed in it always gets converted to Float anyway, even when used as RGBA internally. Otherwise the behavior of the group could vary depending on the external nodes. For the reroute sockets a conversion should not be necessary - in fact they change their type in the UI to indicate that the input type is passed on unmodified! The problem then is why the reroute node actually causes the buffer to become an "RGBA" (with only the red channel). The viewer node should only see a Float input and use the first (R) channel as the value, instead of interpreting it as a full RGBA color value ...

@LukasTonne imho, issue is that there is no conversion here, precisely.

Placing prints in NodeOperationBuilder::add_datatype_conversions(), for this file I got the following:

Input alpha to output: COM_DT_VALUE -> COM_DT_COLOR (use_conversion, use_conversion)
Input alpha to reroute: COM_DT_VALUE -> COM_DT_VALUE (use_conversion, not_use_conversion)
Reroute to viewer: COM_DT_VALUE -> COM_DT_COLOR (not_use_conversion, use_conversion)

So imho, either we use conversions for reroute/mute proxies too, or we change that part of NodeOperationBuilder::add_datatype_conversions():

		if (!from_op->useDatatypeConversion() || !to_op->useDatatypeConversion())
			continue;

to:

		if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion()))
			continue;

So that if an operation at one point of the link requires conversion, we do it, even if the other does not require it.

@LukasTonne imho, issue is that there is no conversion here, precisely. Placing prints in `NodeOperationBuilder::add_datatype_conversions()`, for this file I got the following: ``` Input alpha to output: COM_DT_VALUE -> COM_DT_COLOR (use_conversion, use_conversion) Input alpha to reroute: COM_DT_VALUE -> COM_DT_VALUE (use_conversion, not_use_conversion) Reroute to viewer: COM_DT_VALUE -> COM_DT_COLOR (not_use_conversion, use_conversion) ``` So imho, either we use conversions for reroute/mute proxies too, or we change that part of `NodeOperationBuilder::add_datatype_conversions()`: ``` if (!from_op->useDatatypeConversion() || !to_op->useDatatypeConversion()) continue; ``` to: ``` if (!(from_op->useDatatypeConversion() || to_op->useDatatypeConversion())) continue; ``` So that if an operation at one point of the link requires conversion, we do it, even if the other does not require it.
Member

Sounds good

Sounds good

This issue was referenced by 876ccc8373

This issue was referenced by 876ccc8373f81c1f6f5dee1d44fc745c50861cbe

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit 876ccc8373.

Closed by commit 876ccc8373.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#41573
No description provided.