Aller au contenu

Custom Filter Node

By Kriss Norde

Custom Filter exposes an editable convolution matrix (3×3, 5×5 or 7×7). Each cell multiplies the matching pixel in the neighborhood before the sum and division. It is the low-level tool for building your own filters (custom sharpen, emboss, Sobel/Laplace edge detect, asymmetrical directional blur).

Overview

Custom Filter performs a convolution: for each pixel, each neighbor is multiplied by the matching weight in the matrix, the results are added up, divided by the divisor, then a bias is added.

Depending on the weights you choose, you get radically different effects: blur (average), sharpen (local contrast), emboss (directional difference), edge detect (gradient). It is the basic building block of every classic image processing filter - Fusion exposes it directly for those who want absolute control.

Where to find this node

  • Effects Library: Tools > Filter > Custom Filter
  • Quick add: right-click in the Node Editor → Add Tool > Filter > Custom Filter

Convolution explained

For each output pixel, the formula is:

Out(x,y) = (Σ Kernel[i,j] × Input(x+i, y+j)) / Divisor + Bias

Example: 3×3 average (= uniform blur):

[ 1 1 1 ]
[ 1 1 1 ]     Divisor = 9
[ 1 1 1 ]     Bias = 0

Example: 3×3 sharpen:

[  0 -1  0 ]
[ -1  5 -1 ]     Divisor = 1
[  0 -1  0 ]     Bias = 0

Inputs

  • Input (yellow) - image to filter.
  • Effect Mask (blue) - optional.

Setup

MediaIn → Custom Filter (chosen kernel) → MediaOut

Controls tab

Matrix Size
Size of the matrix: 3×3, 5×5 or 7×7. Bigger = more flexibility but slower (7×7 = 49 multiplications per pixel).
Matrix
Grid of numeric cells. Each cell is the weight of the matching pixel in the neighborhood. Center cell = the weight of the pixel itself.
Divisor
Divisor applied after the weighted sum. Typically the sum of the weights to get an average (no change in brightness).
Bias
Value added to the final result. Useful for edge detect kernels that produce negative values (a bias of 0.5 shifts them back to mid gray).
Red / Green / Blue / Alpha
Channels processed. Apply to all or selectively.

Classic kernels

Identity
A matrix with a 1 in the center and 0 everywhere else. Divisor 1. Leaves the image unchanged. The starting point for editing a custom kernel.
Sharpen
[0 -1 0 / -1 5 -1 / 0 -1 0] Divisor 1. Boosts local contrast. Stronger version: [-1 -1 -1 / -1 9 -1 / -1 -1 -1].
Sobel X (horizontal edge detect)
[-1 0 1 / -2 0 2 / -1 0 1] Divisor 1, Bias 0.5. Detects vertical edges (gradient in X).
Sobel Y (vertical edge detect)
[-1 -2 -1 / 0 0 0 / 1 2 1] Divisor 1, Bias 0.5. Detects horizontal edges.
Laplace (omnidirectional edge detect)
[0 -1 0 / -1 4 -1 / 0 -1 0] Divisor 1, Bias 0.5. Detects all edges. More sensitive to noise than Sobel.
Emboss
[-2 -1 0 / -1 1 1 / 0 1 2] Divisor 1, Bias 0.5. A relief / fake 3D effect with diagonal light.
Gaussian Blur 5×5
[1 4 6 4 1 / 4 16 24 16 4 / 6 24 36 24 6 / 4 16 24 16 4 / 1 4 6 4 1] Divisor 256. A soft, controllable Gaussian blur.

Use cases

  • Controlled sharpen - where the standard Sharpen node is limited, a custom kernel lets you dose the effect precisely (center = 5 / neighbors = -1 → classic sharpen, center = 9 → aggressive version).
  • Edge detection - Sobel or Laplace + threshold = an automatic mask of the edges. Useful to isolate crisp shapes.
  • Artistic emboss - an emboss kernel + adjusted weights = an engraving / lithograph effect. Widely used for stylization in motion graphics.
  • Asymmetrical directional blur - uneven weights (e.g. strong on the left, weak on the right) = blur with a direction of travel, useful to simulate a specific motion blur.
  • Custom normal map from gradients - Sobel X and Sobel Y in parallel, packed into the R and G of a channel combiner = a manually generated normal map with more control than Create Bump Map.
  • Artistic - exotic kernels with extreme divisor/bias values = unpredictable visual effects (psychedelic processing, glitch generator).

Tips

  • Divisor = sum of the positive weights for a filter that preserves the average brightness. Change it for a multiplied effect.
  • Bias 0.5 for kernels that produce negatives (edge detect, emboss). Otherwise negative pixels clamp to 0 → half the information is lost.
  • 7×7 = expensive - 49 multiplications + 49 additions per pixel per channel. Avoid it unless you really need it. 3×3 is enough for 90% of cases.
  • Kernel symmetry - classic filters (blur, sharpen) are symmetrical. For a directional effect (motion blur, emboss), break the symmetry on purpose.
  • Test each channel separately - some effects (edge detect) work better applied to luminance only (then merged over the original color image).
  • Resources: the values of classic kernels are documented everywhere online (search for "image convolution kernels"). Copy-paste the matrices to get started, then adjust.