From f68c3d557aa847743b09d8b837278ea785ec40f6 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 22 Oct 2020 11:13:34 +0200 Subject: Compositor: Ensure keying node result is pre-multiplied Historically the result of the keying node was violating alpha pre-multiplication rules in Blender: it was simply overriding the alpha channel of input. This change makes it so keying node mixes alpha into the input, which solves the following issues: - The result is properly pre-multiplied, no need in separate alpha-convert node anymore. - Allows to more easily stack keying nodes. This usecase was never really investigated, but since previously alpha is always overwritten it was never possible to easily stack nodes. Now it is at something to be tried. Unfortunately, this breaks compatibility with existing files, where alpha-convert node is to be manually removed. From implementation side this is done as a dedicated operation since there was no ready-to-use operation. Maybe in the future it might be replaced with some sort of vector math node. Reviewed By: brecht Differential Revision: https://developer.blender.org/D9211 --- source/blender/compositor/nodes/COM_KeyingNode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/compositor/nodes') diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp index b75d06763b7..a0ccaf0b9da 100644 --- a/source/blender/compositor/nodes/COM_KeyingNode.cpp +++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp @@ -32,7 +32,7 @@ #include "COM_DilateErodeOperation.h" -#include "COM_SetAlphaOperation.h" +#include "COM_KeyingSetAlphaOperation.h" #include "COM_GaussianAlphaXBlurOperation.h" #include "COM_GaussianAlphaYBlurOperation.h" @@ -322,7 +322,7 @@ void KeyingNode::convertToOperations(NodeConverter &converter, } /* set alpha channel to output image */ - SetAlphaOperation *alphaOperation = new SetAlphaOperation(); + KeyingSetAlphaOperation *alphaOperation = new KeyingSetAlphaOperation(); converter.addOperation(alphaOperation); converter.mapInputSocket(inputImage, alphaOperation->getInputSocket(0)); -- cgit v1.2.3