diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2013-04-04 23:53:30 +0400 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2013-04-04 23:53:30 +0400 |
commit | 6418cd92b2a041b23c1d92d417651e1c8d840c4e (patch) | |
tree | 50e5fd8f65fb3c72cae0592968389043b3d36a65 /source/blender/compositor/operations/COM_ZCombineOperation.cpp | |
parent | 5aee8b1487b49811fb8e00d2d3bf0a41a24c5ff2 (diff) |
Fix for 34703 Mix node (Hue, Saturation) update and rendering error
Fix for 34494 Blender 2.65 regression test error - compo_map_uv_cubes.blend - stripe/artifact between cubes
Hue and saturation node has an early break when saturarion is 0. When this happened the input 1 color needed to be used. This behaviour was not merged.
When no FSAA is used in the ZCombine. a mask will be created, this mask will be antialiased and based on this mask the colors between the two images are blended. This was also behaviour that was not merged correctly. Now it is back making much better z-combines.
Hope nobody uses these gabs as a work around.
- At Mind -
Jeroen & Monique
Diffstat (limited to 'source/blender/compositor/operations/COM_ZCombineOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ZCombineOperation.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index 5e4f90b0269..97a4aefbfac 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -92,3 +92,71 @@ void ZCombineOperation::deinitExecution() this->m_image2Reader = NULL; this->m_depth2Reader = NULL; } + +// MASK combine +ZCombineMaskOperation::ZCombineMaskOperation() : NodeOperation() +{ + this->addInputSocket(COM_DT_VALUE); //mask + this->addInputSocket(COM_DT_COLOR); + this->addInputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_COLOR); + + this->m_maskReader = NULL; + this->m_image1Reader = NULL; + this->m_image2Reader = NULL; +} + +void ZCombineMaskOperation::initExecution() +{ + this->m_maskReader = this->getInputSocketReader(0); + this->m_image1Reader = this->getInputSocketReader(1); + this->m_image2Reader = this->getInputSocketReader(2); +} + +void ZCombineMaskOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float mask[4]; + float color1[4]; + float color2[4]; + + this->m_maskReader->read(mask, x, y, sampler); + this->m_image1Reader->read(color1, x, y, sampler); + this->m_image2Reader->read(color2, x, y, sampler); + + float fac = mask[0]; + // multiply mask with alpha, if mask == 0 color1, else color2 make sure + float mfac = 1.0f-fac; + output[0] = color1[0]*mfac + color2[0]*fac; + output[1] = color1[1]*mfac + color2[1]*fac; + output[2] = color1[2]*mfac + color2[2]*fac; + output[3] = max(color1[3], color2[3]); +} + +void ZCombineMaskAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) +{ + float mask[4]; + float color1[4]; + float color2[4]; + + this->m_maskReader->read(mask, x, y, sampler); + this->m_image1Reader->read(color1, x, y, sampler); + this->m_image2Reader->read(color2, x, y, sampler); + + float fac = mask[0]; + // multiply mask with alpha, if mask == 0 color1, else color2 make sure + float mfac = 1.0f-fac; + float alpha = color1[3]*mfac + color2[3]*fac; + float facalpha = fac * alpha; + mfac = 1.0f-facalpha; + output[0] = color1[0]*mfac + color2[0]*facalpha; + output[1] = color1[1]*mfac + color2[1]*facalpha; + output[2] = color1[2]*mfac + color2[2]*facalpha; + output[3] = max(color1[3], color2[3]); +} + +void ZCombineMaskOperation::deinitExecution() +{ + this->m_image1Reader = NULL; + this->m_maskReader = NULL; + this->m_image2Reader = NULL; +} |