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-09 21:15:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-09 21:15:38 +0400
commit6b13203a9ca59c0b066327781e7fc3f4bd7dd9cf (patch)
tree3ba936cdb737b97fcb2b12e468b04804757d9086 /source/blender/compositor/nodes
parent5fe661792c230ac97d85477354a01e3d7aa1149a (diff)
Changes to keying nodes:
- Replace FastGaussian blur with GaussianBokeh blur which should give better results. - Changes a bit formula of saturation which in some cases gives better result. Also included (commented out) original formula which was also checked by Brecht and which gave better result in some other cases. - Made clipping white/black temporal dependent, so hopefully it wouldn't destroy gradients on edges.
Diffstat (limited to 'source/blender/compositor/nodes')
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.cpp35
-rw-r--r--source/blender/compositor/nodes/COM_KeyingNode.h1
2 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.cpp b/source/blender/compositor/nodes/COM_KeyingNode.cpp
index 9e29a99293e..2bc502a5f86 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.cpp
+++ b/source/blender/compositor/nodes/COM_KeyingNode.cpp
@@ -27,12 +27,13 @@
#include "COM_KeyingOperation.h"
#include "COM_KeyingDespillOperation.h"
+#include "COM_KeyingClipOperation.h"
#include "COM_SeparateChannelOperation.h"
#include "COM_CombineChannelsOperation.h"
#include "COM_ConvertRGBToYCCOperation.h"
#include "COM_ConvertYCCToRGBOperation.h"
-#include "COM_FastGaussianBlurOperation.h"
+#include "COM_GaussianBokehBlurOperation.h"
#include "COM_SetValueOperation.h"
#include "COM_DilateErodeOperation.h"
@@ -72,8 +73,9 @@ OutputSocket *KeyingNode::setupPreBlur(ExecutionSystem *graph, InputSocket *inpu
setValueOperation->setValue(1.0f);
graph->addOperation(setValueOperation);
- FastGaussianBlurOperation *blurOperation = new FastGaussianBlurOperation();
+ GaussianBokehBlurOperation *blurOperation = new GaussianBokehBlurOperation();
blurOperation->setData(&preBlurData);
+ blurOperation->setQuality(COM_QUALITY_HIGH);
addLink(graph, separateOperation->getOutputSocket(0), blurOperation->getInputSocket(0));
addLink(graph, setValueOperation->getOutputSocket(0), blurOperation->getInputSocket(1));
@@ -104,8 +106,9 @@ OutputSocket *KeyingNode::setupPostBlur(ExecutionSystem *graph, OutputSocket *po
setValueOperation->setValue(1.0f);
graph->addOperation(setValueOperation);
- FastGaussianBlurOperation *blurOperation = new FastGaussianBlurOperation();
+ GaussianBokehBlurOperation *blurOperation = new GaussianBokehBlurOperation();
blurOperation->setData(&postBlurData);
+ blurOperation->setQuality(COM_QUALITY_HIGH);
addLink(graph, postBLurInput, blurOperation->getInputSocket(0));
addLink(graph, setValueOperation->getOutputSocket(0), blurOperation->getInputSocket(1));
@@ -149,6 +152,20 @@ OutputSocket *KeyingNode::setupDespill(ExecutionSystem *graph, OutputSocket *des
return despillOperation->getOutputSocket(0);
}
+OutputSocket *KeyingNode::setupClip(ExecutionSystem *graph, OutputSocket *clipInput, float clipBlack, float clipWhite)
+{
+ KeyingClipOperation *clipOperation = new KeyingClipOperation();
+
+ clipOperation->setClipBlack(clipBlack);
+ clipOperation->setClipWhite(clipWhite);
+
+ addLink(graph, clipInput, clipOperation->getInputSocket(0));
+
+ graph->addOperation(clipOperation);
+
+ return clipOperation->getOutputSocket(0);
+}
+
void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
InputSocket *inputImage = this->getInputSocket(0);
@@ -163,9 +180,6 @@ void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
/* keying operation */
KeyingOperation *keyingOperation = new KeyingOperation();
- keyingOperation->setClipBlack(keying_data->clip_black);
- keyingOperation->setClipWhite(keying_data->clip_white);
-
inputScreen->relinkConnections(keyingOperation->getInputSocket(1), 1, graph);
if (keying_data->blur_pre) {
@@ -180,11 +194,14 @@ void KeyingNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
graph->addOperation(keyingOperation);
+ postprocessedMatte = keyingOperation->getOutputSocket();
+
+ if (keying_data->clip_black > 0.0f || keying_data->clip_white< 1.0f)
+ postprocessedMatte = setupClip(graph, postprocessedMatte, keying_data->clip_black, keying_data->clip_white);
+
/* apply blur on matte if needed */
if (keying_data->blur_post)
- postprocessedMatte = setupPostBlur(graph, keyingOperation->getOutputSocket(), keying_data->blur_post);
- else
- postprocessedMatte = keyingOperation->getOutputSocket();
+ postprocessedMatte = setupPostBlur(graph, postprocessedMatte, keying_data->blur_post);
/* matte dilate/erode */
if (keying_data->dilate_distance != 0) {
diff --git a/source/blender/compositor/nodes/COM_KeyingNode.h b/source/blender/compositor/nodes/COM_KeyingNode.h
index 894d0ddc095..9d4067ce599 100644
--- a/source/blender/compositor/nodes/COM_KeyingNode.h
+++ b/source/blender/compositor/nodes/COM_KeyingNode.h
@@ -37,6 +37,7 @@ protected:
OutputSocket *setupPostBlur(ExecutionSystem *graph, OutputSocket *postBLurInput, int size);
OutputSocket *setupDilateErode(ExecutionSystem *graph, OutputSocket *dilateErodeInput, int distance);
OutputSocket *setupDespill(ExecutionSystem *graph, OutputSocket *despillInput, InputSocket *inputSrceen, float factor);
+ OutputSocket *setupClip(ExecutionSystem *graph, OutputSocket *clipInput, float clipBlack, float clipWhite);
public:
KeyingNode(bNode *editorNode);
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);