diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-15 12:26:49 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-15 12:26:49 +0400 |
commit | c9f1477fb07a89be657b5ca5d2fd29b29b556e5d (patch) | |
tree | 1333c9b8ed5dd1bb43d0e66b78bd4163a402e6f3 /source/blender/compositor/operations/COM_KeyingOperation.cpp | |
parent | 9c55e7b9956313bbaf034925e49abbd0260fe457 (diff) |
Garbage mate input for keying node
This adds garbage matte input to new keying node which is used to
force occluding things which can not be eliminated by color operations.
White areas defines areas which should be removed from final result.
Diffstat (limited to 'source/blender/compositor/operations/COM_KeyingOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_KeyingOperation.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp index fba4dc65faf..599989d52dc 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp @@ -56,33 +56,39 @@ KeyingOperation::KeyingOperation(): NodeOperation() { this->addInputSocket(COM_DT_COLOR); this->addInputSocket(COM_DT_COLOR); + this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); this->screenBalance = 0.5f; this->pixelReader = NULL; this->screenReader = NULL; + this->garbageReader = NULL; } void KeyingOperation::initExecution() { this->pixelReader = this->getInputSocketReader(0); this->screenReader = this->getInputSocketReader(1); + this->garbageReader = this->getInputSocketReader(2); } void KeyingOperation::deinitExecution() { this->pixelReader = NULL; this->screenReader = NULL; + this->garbageReader = NULL; } void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { float pixelColor[4]; float screenColor[4]; + float garbageValue[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); int primary_channel = get_pixel_primary_channel(screenColor); @@ -100,6 +106,8 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler color[0] = distance; } + + color[0] *= (1.0f - garbageValue[0]); } bool KeyingOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) |