diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-30 18:39:20 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-30 18:39:20 +0400 |
commit | 6fb53f7c4207240805fa9fc6d3d2f406bb3ef474 (patch) | |
tree | 032484e82b4e5fdbb156f77cbb5cb53822aca471 /source/blender/compositor/operations/COM_KeyingOperation.cpp | |
parent | 39e6acfb0864fa6e5e265a0b9420466cbefef596 (diff) |
Several small fixes to nodes:
- Code formation fix in keying node
- Fixed crash when creating keying screen for frame where there's no movie
- Attempt to improve keying node to handle alpha on hair better
Diffstat (limited to 'source/blender/compositor/operations/COM_KeyingOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_KeyingOperation.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp index 43348568a5d..5f1c9d0640d 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp @@ -47,7 +47,7 @@ static float get_pixel_saturation(float *pixel, float screen_balance) float mid = pixel[0] + pixel[1] + pixel[2] - min - max; float val = (1.0f - screen_balance) * min + screen_balance * mid; - return max - val; + return (max - val) * (1.0f - val) * (1.0f - val); } KeyingOperation::KeyingOperation(): NodeOperation() @@ -92,7 +92,7 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler if (primary_channel != screen_primary_channel) { /* different main channel means pixel is on foreground */ color[0] = 1.0f; - } + } else if (saturation >= screen_saturation) { /* saturation of main channel is more than screen, definitely a background */ color[0] = 0.0f; @@ -102,7 +102,7 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler distance = 1.0f - saturation / screen_saturation; - color[0] = distance; + color[0] = distance * distance; if (color[0] < this->clipBlack) color[0] = 0.0f; @@ -110,5 +110,5 @@ void KeyingOperation::executePixel(float *color, float x, float y, PixelSampler color[0] = 1.0f; else color[0] = (color[0] - this->clipBlack) / (this->clipWhite - this->clipBlack); - } + } } |