Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2021-01-05 18:16:18 +0300
committerJeroen Bakker <jeroen@blender.org>2021-01-05 18:34:55 +0300
commit9dbea1db66da5e277e8279811d66096751f38d29 (patch)
tree4fe64c2cb671e0c08f91a37d80c180689c9dec1d /source/blender/compositor/operations
parent357e519575411cc338acfe899fde6e5ea3476801 (diff)
Compositor: Alpha Mode
{D9211} introduced pre-multiplying the color for the keying node. This pre-multiplication should also be done by other keying nodes and should be the default operation for alpha node. This patch will change the logic of keying nodes (Cryptomatte Node, Channel Matte, Chroma Matte, Color Matte, Difference Matte, Distance Matte, Luminance Matte) and breaks old files. The Set alpha node has a mode parameter. This parameter changes the logic to `Apply Mask` the alpha on the RGBA channels of the input color or only replace the alpha channel (old behavior). The replace mode is automatically set for older files. When adding new files the the multiply mode is set. Reviewed By: Sergey Sharybin Differential Revision: https://developer.blender.org/D9630
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_ChannelMatteOperation.cpp6
-rw-r--r--source/blender/compositor/operations/COM_ChromaMatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_ColorMatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cpp (renamed from source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp)18
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h (renamed from source/blender/compositor/operations/COM_KeyingSetAlphaOperation.h)11
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cpp (renamed from source/blender/compositor/operations/COM_SetAlphaOperation.cpp)23
-rw-r--r--source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h (renamed from source/blender/compositor/operations/COM_SetAlphaOperation.h)4
9 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
index 956a2cc86ee..a2c6fd47771 100644
--- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp
@@ -111,10 +111,10 @@ void ChannelMatteOperation::executePixelSampled(float output[4],
alpha = (alpha - limit_min) / limit_range;
}
- /* store matte(alpha) value in [0] to go with
- * COM_SetAlphaOperation and the Value output
+ /* Store matte(alpha) value in [0] to go with
+ * COM_SetAlphaMultiplyOperation and the Value output.
*/
- /* don't make something that was more transparent less transparent */
+ /* Don't make something that was more transparent less transparent. */
output[0] = min(alpha, inColor[3]);
}
diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
index 389aeaf6fed..29e18047578 100644
--- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp
@@ -60,8 +60,8 @@ void ChromaMatteOperation::executePixelSampled(float output[4],
this->m_inputKeyProgram->readSampled(inKey, x, y, sampler);
this->m_inputImageProgram->readSampled(inImage, x, y, sampler);
- /* store matte(alpha) value in [0] to go with
- * COM_SetAlphaOperation and the Value output
+ /* Store matte(alpha) value in [0] to go with
+ * COM_SetAlphaMultiplyOperation and the Value output.
*/
/* Algorithm from book "Video Demistified," does not include the spill reduction part */
diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
index b8749bec4b8..17ada8d89b2 100644
--- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp
@@ -58,8 +58,8 @@ void ColorMatteOperation::executePixelSampled(float output[4],
this->m_inputImageProgram->readSampled(inColor, x, y, sampler);
this->m_inputKeyProgram->readSampled(inKey, x, y, sampler);
- /* store matte(alpha) value in [0] to go with
- * COM_SetAlphaOperation and the Value output
+ /* Store matte(alpha) value in [0] to go with
+ * COM_SetAlphaMultiplyOperation and the Value output.
*/
if (
diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
index 7d79dcc657d..ecc2fc2e85f 100644
--- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cpp
@@ -65,8 +65,8 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4],
distance = this->calculateDistance(inKey, inImage);
- /* store matte(alpha) value in [0] to go with
- * COM_SetAlphaOperation and the Value output
+ /* Store matte(alpha) value in [0] to go with
+ * COM_SetAlphaMultiplyOperation and the Value output.
*/
/*make 100% transparent */
diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
index f7cc6e2d4de..096930d0a83 100644
--- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
+++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp
@@ -68,8 +68,8 @@ void LuminanceMatteOperation::executePixelSampled(float output[4],
alpha = (luminance - low) / (high - low);
}
- /* store matte(alpha) value in [0] to go with
- * COM_SetAlphaOperation and the Value output
+ /* Store matte(alpha) value in [0] to go with
+ * COM_SetAlphaMultiplyOperation and the Value output.
*/
/* don't make something that was more transparent less transparent */
diff --git a/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cpp
index 47daef8d190..3853a953c26 100644
--- a/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.cpp
@@ -13,12 +13,12 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Copyright 2020, Blender Foundation.
+ * Copyright 2011, Blender Foundation.
*/
-#include "COM_KeyingSetAlphaOperation.h"
+#include "COM_SetAlphaMultiplyOperation.h"
-KeyingSetAlphaOperation::KeyingSetAlphaOperation()
+SetAlphaMultiplyOperation::SetAlphaMultiplyOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
@@ -28,16 +28,16 @@ KeyingSetAlphaOperation::KeyingSetAlphaOperation()
this->m_inputAlpha = nullptr;
}
-void KeyingSetAlphaOperation::initExecution()
+void SetAlphaMultiplyOperation::initExecution()
{
this->m_inputColor = getInputSocketReader(0);
this->m_inputAlpha = getInputSocketReader(1);
}
-void KeyingSetAlphaOperation::executePixelSampled(float output[4],
- float x,
- float y,
- PixelSampler sampler)
+void SetAlphaMultiplyOperation::executePixelSampled(float output[4],
+ float x,
+ float y,
+ PixelSampler sampler)
{
float color_input[4];
float alpha_input[4];
@@ -48,7 +48,7 @@ void KeyingSetAlphaOperation::executePixelSampled(float output[4],
mul_v4_v4fl(output, color_input, alpha_input[0]);
}
-void KeyingSetAlphaOperation::deinitExecution()
+void SetAlphaMultiplyOperation::deinitExecution()
{
this->m_inputColor = nullptr;
this->m_inputAlpha = nullptr;
diff --git a/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h
index b786240f215..db58b18688a 100644
--- a/source/blender/compositor/operations/COM_KeyingSetAlphaOperation.h
+++ b/source/blender/compositor/operations/COM_SetAlphaMultiplyOperation.h
@@ -13,7 +13,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
- * Copyright 2020, Blender Foundation.
+ * Copyright 2011, Blender Foundation.
*/
#pragma once
@@ -21,16 +21,17 @@
#include "COM_NodeOperation.h"
/**
- * Operation which is used by keying node to modify image's alpha channels.
- * It keeps color properly pre-multiplied.
+ * This operation will apply a mask to its input image.
+ *
+ * `output color.rgba = input color.rgba * input alpha`
*/
-class KeyingSetAlphaOperation : public NodeOperation {
+class SetAlphaMultiplyOperation : public NodeOperation {
private:
SocketReader *m_inputColor;
SocketReader *m_inputAlpha;
public:
- KeyingSetAlphaOperation();
+ SetAlphaMultiplyOperation();
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cpp
index bf8fbacbfe1..cd6e82902cc 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.cpp
+++ b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.cpp
@@ -16,9 +16,9 @@
* Copyright 2011, Blender Foundation.
*/
-#include "COM_SetAlphaOperation.h"
+#include "COM_SetAlphaReplaceOperation.h"
-SetAlphaOperation::SetAlphaOperation()
+SetAlphaReplaceOperation::SetAlphaReplaceOperation()
{
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
@@ -28,26 +28,25 @@ SetAlphaOperation::SetAlphaOperation()
this->m_inputAlpha = nullptr;
}
-void SetAlphaOperation::initExecution()
+void SetAlphaReplaceOperation::initExecution()
{
this->m_inputColor = getInputSocketReader(0);
this->m_inputAlpha = getInputSocketReader(1);
}
-void SetAlphaOperation::executePixelSampled(float output[4],
- float x,
- float y,
- PixelSampler sampler)
+void SetAlphaReplaceOperation::executePixelSampled(float output[4],
+ float x,
+ float y,
+ PixelSampler sampler)
{
- float alphaInput[4];
+ float alpha_input[4];
this->m_inputColor->readSampled(output, x, y, sampler);
- this->m_inputAlpha->readSampled(alphaInput, x, y, sampler);
-
- output[3] = alphaInput[0];
+ this->m_inputAlpha->readSampled(alpha_input, x, y, sampler);
+ output[3] = alpha_input[0];
}
-void SetAlphaOperation::deinitExecution()
+void SetAlphaReplaceOperation::deinitExecution()
{
this->m_inputColor = nullptr;
this->m_inputAlpha = nullptr;
diff --git a/source/blender/compositor/operations/COM_SetAlphaOperation.h b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h
index a84fb0f2228..b4cab82855b 100644
--- a/source/blender/compositor/operations/COM_SetAlphaOperation.h
+++ b/source/blender/compositor/operations/COM_SetAlphaReplaceOperation.h
@@ -24,7 +24,7 @@
* this program converts an input color to an output value.
* it assumes we are in sRGB color space.
*/
-class SetAlphaOperation : public NodeOperation {
+class SetAlphaReplaceOperation : public NodeOperation {
private:
SocketReader *m_inputColor;
SocketReader *m_inputAlpha;
@@ -33,7 +33,7 @@ class SetAlphaOperation : public NodeOperation {
/**
* Default constructor
*/
- SetAlphaOperation();
+ SetAlphaReplaceOperation();
/**
* the inner loop of this program