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

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 08:01:41 UTC (rev 47936)
+++ trunk/blender/source/blender/compositor/nodes/COM_KeyingNode.cpp    
2012-06-15 08:26:49 UTC (rev 47937)
@@ -156,6 +156,7 @@
 {
        InputSocket *inputImage = this->getInputSocket(0);
        InputSocket *inputScreen = this->getInputSocket(1);
+       InputSocket *inputGarbageMatte = this->getInputSocket(2);
        OutputSocket *outputImage = this->getOutputSocket(0);
        OutputSocket *outputMatte = this->getOutputSocket(1);
        OutputSocket *outputEdges = this->getOutputSocket(2);
@@ -170,6 +171,7 @@
        keyingOperation->setScreenBalance(keying_data->screen_balance);
 
        inputScreen->relinkConnections(keyingOperation->getInputSocket(1), 1, 
graph);
+       
inputGarbageMatte->relinkConnections(keyingOperation->getInputSocket(2), 2, 
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 08:01:41 UTC (rev 47936)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.cpp  
2012-06-15 08:26:49 UTC (rev 47937)
@@ -56,33 +56,39 @@
 {
        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 @@
 
                color[0] = distance;
        }
+
+       color[0] *= (1.0f - garbageValue[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 08:01:41 UTC (rev 47936)
+++ trunk/blender/source/blender/compositor/operations/COM_KeyingOperation.h    
2012-06-15 08:26:49 UTC (rev 47937)
@@ -38,6 +38,8 @@
 protected:
        SocketReader *pixelReader;
        SocketReader *screenReader;
+       SocketReader *garbageReader;
+
        float screenBalance;
 
 public:

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 08:01:41 UTC (rev 47936)
+++ trunk/blender/source/blender/nodes/composite/nodes/node_composite_keying.c  
2012-06-15 08:26:49 UTC (rev 47937)
@@ -46,8 +46,9 @@
 /* **************** Translate  ******************** */
 
 static bNodeSocketTemplate cmp_node_keying_in[] = {
-       {       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_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},
        {       -1, 0, ""       }
 };
 

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to