diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-29 18:00:47 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-29 18:00:47 +0400 |
commit | 876665ac25a731bcf5937d4e06de7337d6e8af6a (patch) | |
tree | f8cf21ac7f6a3bbfeebe3a6ee159769062a3f656 /source/blender/compositor/operations/COM_KeyingOperation.h | |
parent | f5917b15b5f603f0b9b567915b4aa93320d6dc54 (diff) |
Initial commit of new keying nodes
First node is called Keying Screen (Add -> Matte -> Keying Screen) and it's
aimed to resolve issues with gradients on green screens by producing image
with gradient which is later used as an input for screen color in keying nodes.
This node gets motion tracks from given movie clip and trackign object and uses
them to define color and position of points of gradient: for position marker's
position on current frame is sued, for color average color of pattern area is
used.
Gradient is calculating in the following way:
- On first step voronoi diagram is creating for given tracks.
- On second step triangulation of this diagram happens by connecting sites
to edges which defines area this site belongs to.
- On third step gradient filling of this triangles happens. One of triangle
vertices is colored with average track color, two rest vertoces are colored
with average color between two neighbor sites. Current pixel's color in
triangle is calculating as linear combination of vertices colors and
barycentric coordinates of this pixel.
This node is implemented for both tile and legacy compositor systems.
Second node is basically a combination of several existing nodes to make keying
more straighforward and reduce spagetti mess in the compositor, but it also
ships some fresh approaches calculating matte which seems to be working better
for not actually green screens.
This node supports:
- Chroma preblur
- Dispilling
- Clip white/black
- Dilate/Erode
- Matte post blur
This node doesn't support chroma pre-blur for legacy compositor (yet).
There're still lots of stuff to be improved here, but this nodes night already
be used i think.
Some details might be found on this wiki page:
http://wiki.blender.org/index.php/User:Nazg-gul/Keying
This patch also contains some currently unused code from color math module, but
it was used for tests and might be used for tests in the future. Think it's ok
to have it in branch at least.
Diffstat (limited to 'source/blender/compositor/operations/COM_KeyingOperation.h')
-rw-r--r-- | source/blender/compositor/operations/COM_KeyingOperation.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.h b/source/blender/compositor/operations/COM_KeyingOperation.h new file mode 100644 index 00000000000..546ff355573 --- /dev/null +++ b/source/blender/compositor/operations/COM_KeyingOperation.h @@ -0,0 +1,57 @@ +/* + * Copyright 2012, Blender Foundation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor: + * Jeroen Bakker + * Monique Dewanchand + * Sergey Sharybin + */ + + +#ifndef _COM_KeyingOperation_h +#define _COM_KeyingOperation_h + +#include <string.h> + +#include "COM_NodeOperation.h" + +#include "BLI_listbase.h" + +/** + * Class with implementation of keying node + */ +class KeyingOperation : public NodeOperation { +protected: + SocketReader *pixelReader; + SocketReader *screenReader; + float screenBalance; + float clipBlack; + float clipWhite; + +public: + KeyingOperation(); + + void initExecution(); + void deinitExecution(); + + void setClipBlack(float value) {this->clipBlack = value;} + void setClipWhite(float value) {this->clipWhite = value;} + + void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]); +}; + +#endif |