diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-13 14:40:42 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-05-13 14:40:42 +0400 |
commit | fa4ef0828e0211fdfdd06b125ed244cba06c1293 (patch) | |
tree | 36b2acbb1c0cf45e97dc3756105b7bec68f7d17e /source/blender/compositor/operations/COM_ZCombineOperation.cpp | |
parent | 4e5541a9a64008526adbbcd676d01cee9751e284 (diff) |
Fix #35327: compositing Z combine node was not giving the same result as previous
versions when the Z values were the same, Also was inconsistent between full sample
on/off.
Diffstat (limited to 'source/blender/compositor/operations/COM_ZCombineOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ZCombineOperation.cpp | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index 4368ba4f9a0..10090294a54 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -123,13 +123,7 @@ void ZCombineMaskOperation::executePixel(float output[4], float x, float y, Pixe 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]); + interp_v4_v4v4(output, color1, color2, 1.0f - mask[0]); } void ZCombineMaskAlphaOperation::executePixel(float output[4], float x, float y, PixelSampler sampler) @@ -142,15 +136,12 @@ void ZCombineMaskAlphaOperation::executePixel(float output[4], float x, float y, 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 fac = (1.0f - mask[0])*(1.0f - color1[3]) + mask[0]*color2[3]; 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[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]); } |