[Bf-blender-cvs] [e1cf002] blender-v2.78-release: Fix T49789: Compositor mix node interpolation bug
Sergey Sharybin
noreply at git.blender.org
Mon Oct 24 12:34:35 CEST 2016
Commit: e1cf002ee680e8272f66b2c0223adc830f9f8125
Author: Sergey Sharybin
Date: Fri Oct 21 17:56:09 2016 +0200
Branches: blender-v2.78-release
https://developer.blender.org/rBe1cf002ee680e8272f66b2c0223adc830f9f8125
Fix T49789: Compositor mix node interpolation bug
===================================================================
M source/blender/compositor/operations/COM_TextureOperation.cpp
===================================================================
diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp
index 665bffc..bba5c87 100644
--- a/source/blender/compositor/operations/COM_TextureOperation.cpp
+++ b/source/blender/compositor/operations/COM_TextureOperation.cpp
@@ -110,8 +110,18 @@ void TextureBaseOperation::executePixelSampled(float output[4], float x, float y
int retval;
const float cx = this->getWidth() / 2;
const float cy = this->getHeight() / 2;
- const float u = (x - cx) / this->getWidth() * 2;
- const float v = (y - cy) / this->getHeight() * 2;
+ float u = (x - cx) / this->getWidth() * 2;
+ float v = (y - cy) / this->getHeight() * 2;
+
+ /* When no interpolation/filtering happens in multitex() foce nearest interpolation.
+ * We do it here because (a) we can't easily say multitex() that we want nearest
+ * interpolaiton and (b) in such configuration multitex() sinply floor's the value
+ * which often produces artifacts.
+ */
+ if ((m_texture->imaflag & TEX_INTERPOL) == 0) {
+ u += 0.5f / cx;
+ v += 0.5f / cy;
+ }
this->m_inputSize->readSampled(textureSize, x, y, sampler);
this->m_inputOffset->readSampled(textureOffset, x, y, sampler);
More information about the Bf-blender-cvs
mailing list