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: To use the GPU when rendering from the command line, add --gpu to your command. For more information on GPU support, see the Release Notes for your version of Nuke.
You can bake kernels, and they 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. To prevent unexpected crashes, the Safety Rails feature can be switched on while prototyping kernels to catch common errors and out-of-bounds memory accesses. However, code compiled from the Kernel Source can still 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 |
|||
Bake | bake | N/A |
Click to disable edits and cache any Library Files into the node for easy copy/paste sharing. The BlinkScript icon will update to display the baked status of the node: ![]() |
Make Live | makeLive | N/A |
Click to enable edits, clear any cached Library Files and read them from the file path specified in the library files tab. The BlinkScript icon will update to display the live status of the node: ![]() |
Protect | protectButton | N/A |
Click to create a version of the node that uses an encrypted source and has all kernel editing options hidden and encrypted. Note: Note: If a live BlinkScript node is protected, the library files will not be baked into the node. The BlinkScript icon will update to display the protected status of the node: ![]() |
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 Source |
kernelSource |
Swirlomatic |
Enter the kernel you intend to compile or edit the default Swirlomatic to suit your purposes. Click the Recompile button to see the result of any changes and view any listed errors. |
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.
Note: If frame rendering on the GPU fails due to lack of memory, it will fall back to the CPU. When this occurs, a warning message will be printed to the console. |
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. |
Safety Rails | safetyRails | disabled |
When enabled, additional code is generated to check for, catch and safely handle out-of-bounds memory accesses, which are a common cause of BlinkScript crashes. Invalid accesses are printed to the Nuke terminal. Warning: When disabled, the code is generated to maximize performance without the Safety Rails preventing any crashes. It is recommended to enable Safety Rails during development and to disable once complete. |
Input Group |
Swirlomatic_src |
rgba |
Specifies input channels for each of BlinkScript’s images to read from. |
Swirl Amount |
Swirlomatic_Amount |
180 Radius: 320 Center: x = 640 y = 320 |
Adjusts the result of the SwirlomaticKernel by this factor. Note: Swirl parameters are the only control exposed by the default SwirlomaticKernel. For more information on writing kernels and some examples, see the Blink Developer’s Guide. |
Output Channels |
outputChannels |
rgba |
Specifies output channels for BlinkScript to write its output to. |
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. |
Library Files Tab |
|||
Library Files | libraryFiles | N/A |
Library Files contain user-defined helper functions and macros that can be used in the BlinkScript. Status information is displayed next to the file path name: • OK - the file is found and loaded. • File Not Found - no file at the specified path. • Compilation Error - the file contains compilation errors. |
File Path | libraryFilePicker | N/A |
Specify a file to be added to the list of Library Files. The library Files extension is .blib. |
Add | addLibraryFile | N/A | Click to add the specified file path to the list of Library Files. |