Inconsistent behavior of "Color Mix Node" and "Alpha Over Node" #34461

Closed
opened 2013-02-27 16:20:01 +01:00 by Robert M · 10 comments

%%%--- Operating System, Graphics card ---
Debian AMD64, Radeon HD6850

- Blender version with error, and version that worked ---

Bug in 2.66; worked in 2.65a

- Short description of error ---

The "Color Mix Node" produces a halo when mixing using the Alpha of the second channel.
In the "Alpha Over Node" I have to deactivate "Convert Premul" to achieve the same results as in 2.65a.

- Steps for others to reproduce the error (preferably based on attached .blend file) ---

I added a blend file. There is included a packed 8 bit PNG with straight alpha.
Just open it in 2.66 and in 2.65 and compare the compositor results by clicking on the Viewer Nodes.

Thank you!%%%

%%%--- Operating System, Graphics card --- Debian AMD64, Radeon HD6850 - Blender version with error, and version that worked --- Bug in 2.66; worked in 2.65a - Short description of error --- The "Color Mix Node" produces a halo when mixing using the Alpha of the second channel. In the "Alpha Over Node" I have to deactivate "Convert Premul" to achieve the same results as in 2.65a. - Steps for others to reproduce the error (preferably based on attached .blend file) --- I added a blend file. There is included a packed 8 bit PNG with straight alpha. Just open it in 2.66 and in 2.65 and compare the compositor results by clicking on the Viewer Nodes. Thank you!%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%This is not a bug, but rather a consequence of the alpha changes in 2.66. See the release notes here:

http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Image_Transparency

Your nodetree assumes that the image you are using is straight alpha, which was true in 2.65,
but 2.66 tries to keep float buffers premultiplied and 8bit byte buffers unpremultiplied. The
compositor works in float, so your 8bit straight alpha image gets premultiplied when used by
the compositor. If you want to use the same nodetree as before simply unpremult after the image
node. (Note that this is an improvement because now your nodetree will also work with
premultiplied exr files for example, which it did not in 2.65)

hope this helps, David.%%%

%%%This is not a bug, but rather a consequence of the alpha changes in 2.66. See the release notes here: http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Image_Transparency Your nodetree assumes that the image you are using is straight alpha, which was true in 2.65, but 2.66 tries to keep float buffers premultiplied and 8bit byte buffers unpremultiplied. The compositor works in float, so your 8bit straight alpha image gets premultiplied when used by the compositor. If you want to use the same nodetree as before simply unpremult after the image node. (Note that this is an improvement because now your nodetree will also work with premultiplied exr files for example, which it did not in 2.65) hope this helps, David.%%%
Author

%%%Thanks, David.
Okay this explains the "Alpha Over Node", but "Color Mix Node" with the option "Include Alpha of second input" still produces incorrect results.
If it is the intended behavior maybe this button on the "Color Mix Node" should be removed and users would have to use the "Alpha Over Node" for all alpha-blending?%%%

%%%Thanks, David. Okay this explains the "Alpha Over Node", but "Color Mix Node" with the option "Include Alpha of second input" still produces incorrect results. If it is the intended behavior maybe this button on the "Color Mix Node" should be removed and users would have to use the "Alpha Over Node" for all alpha-blending?%%%
Member

%%%We tried to keep things work compatible... let's investigate it a bit.%%%

%%%We tried to keep things work compatible... let's investigate it a bit.%%%

%%%The mix operation does a linear blend between its inputs, i.e. output = (1-fac)input1 + facinput2.
If include alpha is enabled, this corresponds to a composite assuming input2 is unpremult
(obviously, as it is multiplied by fac). None of this changed between 2.65 and 2.66. Only
the image is now not unpremult anymore coming from the Image node.

Note that I would not be opposed to redefining the mix operation to be output = (1-fac)*input + input2
as the compositor generally assumes inputs to be premultiplied. Alternatively an additional "over"
operation with this logic could be added to the mix node.
%%%

%%%The mix operation does a linear blend between its inputs, i.e. output = (1-fac)*input1 + fac*input2. If include alpha is enabled, this corresponds to a composite assuming input2 is unpremult (obviously, as it is multiplied by fac). None of this changed between 2.65 and 2.66. Only the image is now not unpremult anymore coming from the Image node. Note that I would not be opposed to redefining the mix operation to be output = (1-fac)*input + input2 as the compositor generally assumes inputs to be premultiplied. Alternatively an additional "over" operation with this logic could be added to the mix node. %%%

%%%Well, very much everything was already described by David.

It is indeed all the buffers are properly alpha-premultiplied in compositor and they indeed were straight in older versions of blender. That's why you need to disable "Convert Premul" for alpha over nodes -- you don't need to premultiply inputs extra time.

Not sure what's the best to do here to increase compatibility level apart from automatically adding Alpha Convert nodes for byte images. But don't think it's so much great thing to do. It could also be an option of Image Input node which will indicate "I want output of this node have straight alpha", displaying in N panel only and enabled for byte images saved before alpha pipeline cleanup commit.

For mix node i'd agree current behavior is odd. You couldn't actually mix two render results properly. I'm thinking of adding option like "Do linear blending" enabled for older files and disabled fore new ones, and change default behavior in a way David proposed.%%%

%%%Well, very much everything was already described by David. It is indeed all the buffers are properly alpha-premultiplied in compositor and they indeed were straight in older versions of blender. That's why you need to disable "Convert Premul" for alpha over nodes -- you don't need to premultiply inputs extra time. Not sure what's the best to do here to increase compatibility level apart from automatically adding Alpha Convert nodes for byte images. But don't think it's so much great thing to do. It could also be an option of Image Input node which will indicate "I want output of this node have straight alpha", displaying in N panel only and enabled for byte images saved before alpha pipeline cleanup commit. For mix node i'd agree current behavior is odd. You couldn't actually mix two render results properly. I'm thinking of adding option like "Do linear blending" enabled for older files and disabled fore new ones, and change default behavior in a way David proposed.%%%
Author

%%%For the "Alpha Over" Node: Maybe it is possible to just flip the "Convert Premul" setting automatically, when a blend file older than 2.66 is loaded?
%%%

%%%For the "Alpha Over" Node: Maybe it is possible to just flip the "Convert Premul" setting automatically, when a blend file older than 2.66 is loaded? %%%

%%%Robert, unfortunately nope. This nodes could eb used for other purposes like alpha overing keying result (which you would need to premultiply) on a background. I'm currently working on a patch which shall make files more compatible.%%%

%%%Robert, unfortunately nope. This nodes could eb used for other purposes like alpha overing keying result (which you would need to premultiply) on a background. I'm currently working on a patch which shall make files more compatible.%%%

%%%Added compatibility option "Straight Alpha Output" to image input node. When this option is enabled, image input node will convert float buffer to straight alpha and behavior of node tree would be the same as it was in 2.65. This option is available in N-panel.

Patch was commited to svn rev54960.

Now if you'll save the file in 2.65 and open it in trunk compo result should match.

As for Mix node -- we've spen quite a while discussing it today. It's likely be implemented as ether separate node or mix type, but that's not directly related to this bug report. Alpha flow in compositor still needs some rethinking and it's in TODO lists of mine and Ton.

Thanks for the report and comments, but would consider actual bug fixed now.%%%

%%%Added compatibility option "Straight Alpha Output" to image input node. When this option is enabled, image input node will convert float buffer to straight alpha and behavior of node tree would be the same as it was in 2.65. This option is available in N-panel. Patch was commited to svn rev54960. Now if you'll save the file in 2.65 and open it in trunk compo result should match. As for Mix node -- we've spen quite a while discussing it today. It's likely be implemented as ether separate node or mix type, but that's not directly related to this bug report. Alpha flow in compositor still needs some rethinking and it's in TODO lists of mine and Ton. Thanks for the report and comments, but would consider actual bug fixed now.%%%

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
4 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#34461
No description provided.