Fix T50849: Transparent background produces artifacts in this compositing setup

The issue was caused by sometimes negative color returned by the filter node.

Seems to be caused by precision issues. Don't see any reason why we would want
negative colors in output. Those only causing issues later on.
This commit is contained in:
Sergey Sharybin 2017-03-08 15:56:50 +01:00
parent 97c4c2689f
commit 817e975dee
Notes: blender-bot 2023-02-14 07:10:42 +01:00
Referenced by issue #50849, Transparent background produces artifacts in this compositing setup
2 changed files with 12 additions and 0 deletions

View File

@ -94,4 +94,10 @@ void ConvolutionEdgeFilterOperation::executePixel(float output[4], int x, int y,
output[2] = output[2] * value[0] + in2[2] * mval;
output[3] = in2[3];
/* Make sure we don't return negative color. */
output[0] = max(output[0], 0.0f);
output[1] = max(output[1], 0.0f);
output[2] = max(output[2], 0.0f);
output[3] = max(output[3], 0.0f);
}

View File

@ -107,6 +107,12 @@ void ConvolutionFilterOperation::executePixel(float output[4], int x, int y, voi
output[1] = output[1] * value[0] + in2[1] * mval;
output[2] = output[2] * value[0] + in2[2] * mval;
output[3] = output[3] * value[0] + in2[3] * mval;
/* Make sure we don't return negative color. */
output[0] = max(output[0], 0.0f);
output[1] = max(output[1], 0.0f);
output[2] = max(output[2], 0.0f);
output[3] = max(output[3], 0.0f);
}
bool ConvolutionFilterOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)