Convolve

Convolve lets you create custom filter effects by supplying your own filter image. This image is used as the convolution matrix. In other words, the new value of a pixel is calculated by centering the filter image on the pixel, examining its neighbors, multiplying each pixel value by the corresponding pixel values in the filter image, and then adding the results together. This allows you to defocus a clip and create lens blur effects in the shape of the filter image, for example.

See also Blur and Defocus.

Inputs and Controls

Connection Type

Connection Name

Function

Input

filter

The filter image. This image is used as the convolution matrix.

Note that you don’t necessarily need to crop the filter image to a smaller size, as Fast Fourier Transforms are used to speed up convolutions with large filter images.

image

The image sequence to receive the convolution filter effect.

mask

An optional image to use as a mask. By default, the filter effect is limited to the non-black areas of the mask.

At first, the mask input appears as triangle on the right side of the node, but when you drag it, it turns into an arrow labeled mask. If you cannot see the mask input, ensure that the mask control is disabled or set to none.

Control (UI)

Knob (Scripting)

Default Value

Function

Convolve Tab

channels

channels

all

The filter effect is only applied to these channels.

If you set this to something other than all or none, you can use the checkboxes on the right to select individual channels.

Local GPU

gpuName

N/A

Displays the GPU used for rendering when Use GPU if available is enabled. Local GPU displays Not available when:

Use CPU is selected as the default blink device in the Preferences.

no suitable GPU was found on your system.

it was not possible to create a context for processing on the selected GPU, such as when there is not enough free memory available on the GPU.

You can select a different GPU, if available, by navigating to the Preferences and selecting an alternative from the default blink device dropdown.

Note:   Selecting a different GPU requires you to restart Nuke before the change takes effect.

Use GPU if available

useGPUIfAvailable

enabled

When enabled, rendering occurs on the Local GPU specified, if available, rather than the CPU.

Note:  Enabling this option with no local GPU allows the script to run on the GPU whenever the script is opened on a machine that does have a GPU available.
You should also select this if you wish to render from the command line with the --gpu option.

See Nuke 15 Release Notes for more information on the GPUs Nuke supports.

filter channel

filter_channel

rgba.alpha

The channel to use as the convolution matrix from the filter input.

This control is only available if use input channels is disabled.

use input channels

use_input_channels

disabled

When enabled, Convolve uses the same channels from the filter input as the image input (that is, whatever channels is set to).

filter bounds

filter_bounds

shape

Sets what to use as the filter bounds:

shape - The filter input’s bounding box. In this case, Convolve only uses the bounding box area, and the center of the filter is the center of the bounding box. This is the default value, and you may want to use it if your filter input is a roto shape with a small bounding box that doesn’t fill the entire format area, for example.

format - The filter input’s format. In this case, Convolve uses the entire format area, allowing you to offset the filter image within the format.

normalize

normalize

enabled

When enabled, the filter input is divided by the sum of all the pixels in it before using it. This ensures that the convolution doesn’t change the overall brightness.

mask

N/A

disabled

Enables the associated mask channel to the right. Disabling this checkbox is the same as setting the channel to none.

maskChannelInput

none

The channel to use as a mask. By default, the filter effect is limited to the non-black areas of this channel.

For example, you can use a depth channel here to simulate depth-of-field blurring.

inject

inject

disabled

Copies the mask input to the predefined mask.a channel. Injecting the mask allows you to use the same mask further downstream.

invert

invert_mask

disabled

Inverts the use of the mask channel so that the filter effect is limited to the non-white areas of the mask.

fringe

fringe

disabled

When enabled, only apply the effect to the edge of the mask.

When disabled, the effect is applied to the entire mask.

mix

mix

1

Dissolves between the original image at 0 and the full filter effect at 1.

Step-by-Step Guides

Applying Convolves