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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-15 15:53:51 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-15 15:53:51 +0400
commit82473f67b358cc76c6e60ced68d73d7dac06a7b0 (patch)
treec25ecfd47d1c2105054240a77730a73a75045feb /source/blender/compositor/operations
parentfa3dd67b42adc12cc227bfd353a3f6469e82eaf6 (diff)
Core matte input for keying node
This matte could be used to force alpha be at high values in areas where algorithm detects it as edge or background color.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.cpp8
-rw-r--r--source/blender/compositor/operations/COM_KeyingOperation.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp
index 599989d52dc..e04c79f6713 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.cpp
+++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp
@@ -57,6 +57,7 @@ KeyingOperation::KeyingOperation(): NodeOperation()
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_COLOR);
this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_VALUE);
this->screenBalance = 0.5f;
@@ -64,6 +65,7 @@ KeyingOperation::KeyingOperation(): NodeOperation()
this->pixelReader = NULL;
this->screenReader = NULL;
this->garbageReader = NULL;
+ this->coreReader = NULL;
}
void KeyingOperation::initExecution()
@@ -71,6 +73,7 @@ void KeyingOperation::initExecution()
this->pixelReader = this->getInputSocketReader(0);
this->screenReader = this->getInputSocketReader(1);
this->garbageReader = this->getInputSocketReader(2);
+ this->coreReader = this->getInputSocketReader(3);
}
void KeyingOperation::deinitExecution()
@@ -78,6 +81,7 @@ void KeyingOperation::deinitExecution()
this->pixelReader = NULL;
this->screenReader = NULL;
this->garbageReader = NULL;
+ this->coreReader = NULL;
}
void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
@@ -85,10 +89,12 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler
float pixelColor[4];
float screenColor[4];
float garbageValue[4];
+ float coreValue[4];
this->pixelReader->read(pixelColor, x, y, sampler, inputBuffers);
this->screenReader->read(screenColor, x, y, sampler, inputBuffers);
this->garbageReader->read(garbageValue, x, y, sampler, inputBuffers);
+ this->coreReader->read(coreValue, x, y, sampler, inputBuffers);
int primary_channel = get_pixel_primary_channel(screenColor);
@@ -108,6 +114,8 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler
}
color[0] *= (1.0f - garbageValue[0]);
+
+ color[0] = MAX2(color[0], coreValue[0]);
}
bool KeyingOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h
index 657a1ff807c..8d0e7851ee5 100644
--- a/source/blender/compositor/operations/COM_KeyingOperation.h
+++ b/source/blender/compositor/operations/COM_KeyingOperation.h
@@ -39,6 +39,7 @@ protected:
SocketReader *pixelReader;
SocketReader *screenReader;
SocketReader *garbageReader;
+ SocketReader *coreReader;
float screenBalance;