Make "Laplace" an edge filter operation, since it is supposed to be used for edge detection without modifying the alpha channel.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Wouldn't it be better to optionally bypass alpha (for this patch when the alpha is varied there could be some parts that become zero, mixed with other parts that don't).
The thing is, for some of the filters, applying them to the alpha channel as well does make sense (e.g. soften/sharpen). Also, the filters are split into two categories, the "normal" ones, and the edge detection ones, which do not modify the alpha. Perhaps I should have done this in the first place, but I think a better fix would be to move the laplace filter to the edge detection group, since it is used just for that. Like so:
diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender index 7493f24..e8b08ce 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cpp +++ b/source/blender/compositor/nodes/COM_FilterNode.cpp @@ -49,7 +49,7 @@ void FilterNode::convertToOperations(NodeConverter &converter, operation->set3x3Filter(-1, -1, -1, -1, 9, -1, -1, -1, - break; case CMP_FILT_LAPLACE: - operation = new ConvolutionFilterOperation(); + operation = new ConvolutionEdgeFilterOperation(); operation->set3x3Filter(-1 / 8.0f, -1 / 8.0f, -1 / 8.0f, break; case CMP_FILT_SOBEL:
You should be careful with modifying color and not modifying alpha in compositor, since the color should always be properly premultiplied.
Think this patch isnt really a good approach since it will break use-cases that intentionally change alpha and happen to have zero alpha areas.