[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47948] trunk/blender/source/blender: Core matte input for keying node

Sergey Sharybin sergey.vfx at gmail.com
Fri Jun 15 13:53:57 CEST 2012


Revision: 47948
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47948
Author:   nazgul
Date:     2012-06-15 11:53:51 +0000 (Fri, 15 Jun 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/nodes/COM_KeyingNode.cpp
    trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.h
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_keying.c

Modified: trunk/blender/source/blender/compositor/nodes/COM_KeyingNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_KeyingNode.cpp	2012-06-15 11:44:23 UTC (rev 47947)
+++ trunk/blender/source/blender/compositor/nodes/COM_KeyingNode.cpp	2012-06-15 11:53:51 UTC (rev 47948)
@@ -157,6 +157,7 @@
 	InputSocket *inputImage = this->getInputSocket(0);
 	InputSocket *inputScreen = this->getInputSocket(1);
 	InputSocket *inputGarbageMatte = this->getInputSocket(2);
+	InputSocket *inputCoreMatte = this->getInputSocket(3);
 	OutputSocket *outputImage = this->getOutputSocket(0);
 	OutputSocket *outputMatte = this->getOutputSocket(1);
 	OutputSocket *outputEdges = this->getOutputSocket(2);
@@ -172,6 +173,7 @@
 
 	inputScreen->relinkConnections(keyingOperation->getInputSocket(1), 1, graph);
 	inputGarbageMatte->relinkConnections(keyingOperation->getInputSocket(2), 2, graph);
+	inputCoreMatte->relinkConnections(keyingOperation->getInputSocket(3), 3, graph);
 
 	if (keying_data->blur_pre) {
 		/* chroma preblur operation for input of keying operation  */

Modified: trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp	2012-06-15 11:44:23 UTC (rev 47947)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp	2012-06-15 11:53:51 UTC (rev 47948)
@@ -57,6 +57,7 @@
 	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 @@
 	this->pixelReader = NULL;
 	this->screenReader = NULL;
 	this->garbageReader = NULL;
+	this->coreReader = NULL;
 }
 
 void KeyingOperation::initExecution()
@@ -71,6 +73,7 @@
 	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 @@
 	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 @@
 	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 @@
 	}
 
 	color[0] *= (1.0f - garbageValue[0]);
+
+	color[0] = MAX2(color[0], coreValue[0]);
 }
 
 bool KeyingOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)

Modified: trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.h	2012-06-15 11:44:23 UTC (rev 47947)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.h	2012-06-15 11:53:51 UTC (rev 47948)
@@ -39,6 +39,7 @@
 	SocketReader *pixelReader;
 	SocketReader *screenReader;
 	SocketReader *garbageReader;
+	SocketReader *coreReader;
 
 	float screenBalance;
 

Modified: trunk/blender/source/blender/nodes/composite/nodes/node_composite_keying.c
===================================================================
--- trunk/blender/source/blender/nodes/composite/nodes/node_composite_keying.c	2012-06-15 11:44:23 UTC (rev 47947)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_keying.c	2012-06-15 11:53:51 UTC (rev 47948)
@@ -49,6 +49,7 @@
 	{	SOCK_RGBA,  1, "Image",	        0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
 	{	SOCK_RGBA,  1, "Key Color",     1.0f, 1.0f, 1.0f, 1.0f},
 	{	SOCK_FLOAT, 1, "Garbage Matte", 0.0f, 1.0f, 1.0f, 1.0f},
+	{	SOCK_FLOAT, 1, "Core Matte",    0.0f, 1.0f, 1.0f, 1.0f},
 	{	-1, 0, ""	}
 };
 




More information about the Bf-blender-cvs mailing list