BlinkScript

The BlinkScript node runs Foundry's Blink framework enabling us to write our code once and run it on any supported device. This is achieved through code translation, in which the Blink code is turned into specific code for each target device. Code is generated and compiled on-the-fly, allowing you to switch between devices at will.

BlinkScript runs a Blink "kernel" over every pixel in the output, where a Blink kernel is similar to a C++ class, but with some special parameter types and functions. Through translation, the code in the BlinkScript node can be turned into normal C++ or SIMD code for the CPU, or OpenCL for the GPU.

The Blink framework streamlines plug-in development workflow significantly, as you no longer have to exit Nuke to compile your code.

Note:  GPU acceleration requires an NVIDIA GPU and drivers for CUDA 4.2 or above. To use the GPU when rendering from the command line, add --gpu to your command.

You can publish kernels in Group nodes which can then be saved as gizmos, if required. Published kernels can be encoded to protect your IP using BlinkScript's built-in kernel protection. Protected kernels are not readable when the published node is saved to a script.

Warning:  BlinkScript is very flexible, as there are no restrictions on the code you can write within a kernel. As a result, code complied from the Kernel Source can cause Nuke to crash, so please use caution!

Inputs and Controls

Connection Type

Connection Name

Function

Input

src

The image to which the BlinkScript kernel is applied.

Control (UI)

Knob (Scripting)

Default Value

Function

BlinkScript Tab

Kernel File

kernelSourceFile

none

Sets the file path of the kernel used for Load and Save operations. BlinkScript kernels use the .rpp file extension.

Load

reloadKernelSourceFile

N/A

Click to load and compile the kernel specified in the Kernel File field.

Save

saveKernelFile

N/A

Click to save the current kernel to the location and file name specified in the Kernel File field.

Clear

clearKernelSource

N/A

Click to clear the Kernel Editor.

Recompile

recompile

N/A

Click to recompile the kernel currently in the Kernel Editor. Any compile errors present are displayed on screen.

Kernel Source

Kernel Editor

kernelSource

SaturationKernel

Enter the kernel you intend to compile or edit the default SaturationKernel to suit your purposes.

Click the Recompile button to see the result of any changes.

Kernel Parameters Tab

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 Windows, Mac OS X and macOS, or Linux for more information on the GPUs Nuke supports.

Vectorize on CPU

vectorize

enabled

When enabled, use SIMD instructions on the CPU where possible.

Note:  This is currently an experimental feature and vectorization might fail for some valid Blink kernels.

Multiply

InvertKernel_Multiply

1

Multiplies the result of the InverKernel by this factor.

Note:  Multiply is the only control exposed by the default InvertKernel. For more information on writing kernels and some examples, see Help > Documentation.

Publish

publishButton

N/A

Click to create a Group node containing a copy of the current node. The Group can then be saved as a gizmo.

The kernel parameters and GPU controls are exposed as user controls in the published version of the node.

Protect kernel

protectKernel
WhenPublishing

disabled

When enabled, the kernel in the published group is encoded and is not readable when the published node is written to a script.

format

format

Dependent on Project Settings

Sets the output format when Specify output format is enabled, but otherwise defaults to the input format size.

Specify output format

specifiedFormat

disabled

When enabled, allows you to set the output format using the format control.

Enabling this control also exposes the format dropdown in the published Group node.

Settings Tab

Percentage of GPU memory to use

maxGPUMemory

50

Sets the maximum percentage of GPU memory that is available for the BlinkScript node to allocate.

Percentage of image height per tile

maxTileLines

10

Sets the maximum percentage of the image height that the BlinkScript attempts to render in a single tile, that is, before updating the output.

Note:  If the Percentage of image height per tile is less than 100, the destination image is rendered in a number of horizontal stripes. The destination height within the BlinkScript kernel is then the height of the current stripe, rather than the full height of the image.

If you need to use the output image height within a BlinkScript kernel, we recommend passing it in as a parameter.

Processing is always done in tiles. On the CPU, the processing is sometimes done in scanlines rather than tiles, so this parameter does not always have an effect.

Step-by-Step Guides

Using the BlinkScript Node

Example Nuke Scripts

Note:  Loading example scripts only works if you launched the help from Nuke and have set documentation source to local in the Behaviors > Documentation tab of the Preferences.

See Using Script Links for more information.

Examples of all the knob types that can be added to Kernel Parameters

A balloon-like effect that uses random access and bilinear interpolation

A one-dimensional box blur

A two-dimensional box blur

A weighted blur where the weights are taken from a second input

A rippling curtain effect that uses 1D-ranged access

A simple lens flare generator that requires no inputs

A 5x5 average that uses Blink's median function

A swirl effect that uses random access, trigonometric functions and bilinear interpolation

A two-pass resize implemented with two Blink kernels chained together

A simple transition effect