Page MenuHome

Fix T47520: Compositor Node "Filter" Outputs clear image
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Feb 22 2016, 12:11 PM.

Details

Summary

Make "Laplace" an edge filter operation, since it is supposed to be used for edge detection without modifying the alpha channel.

Diff Detail

Repository
rB Blender

Event Timeline

Kévin Dietrich (kevindietrich) retitled this revision from to Fix T47520: Compositor Node "Filter" Outputs clear image.Feb 22 2016, 12:11 PM
Kévin Dietrich (kevindietrich) updated this object.
Kévin Dietrich (kevindietrich) updated this revision to Diff 6159.

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.

Campbell Barton (campbellbarton) requested changes to this revision.

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.

This revision now requires changes to proceed.Feb 25 2016, 10:43 PM
Kévin Dietrich (kevindietrich) updated this revision to Diff 6179.
  • Make Laplace an edge filter operation.
This revision was automatically updated to reflect the committed changes.