Skip to content

Make

Updated

OFX plugins

An extension can carry an OpenFX (OFX) plugin, written in C or C++. It is a library built for each system, and runs in a process of its own. The same plugin runs in other OFX hosts.

Sort sorts runs of pixels by brightness along rows or columns. It is one C file and the OpenFX headers, in the repository at examples/extensions/sort.

sort/
extension.json
sort.c
openfx/
Sort.ofx.bundle/
Contents/
Win64/Sort.ofx
MacOS/Sort.ofx
Linux-x86-64/Sort.ofx

extension.json:

{
"format": 1,
"id": "sort",
"name": "Sort",
"version": "1.0.0",
"summary": "Sorts runs of pixels by brightness.",
"author": "Lumit",
"effects": [
{
"id": "sort",
"name": "Sort",
"category": "Stylise",
"version": 1,
"api": 1,
"ofx": "Sort.ofx.bundle",
"plugin": "com.lumitlab.sort"
}
]
}

1. Build the bundle from the sort folder. On Windows, in an x64 Native Tools prompt:

mkdir Sort.ofx.bundle\Contents\Win64
cl /nologo /O2 /LD sort.c /Fe:Sort.ofx.bundle\Contents\Win64\Sort.ofx /link /NOIMPLIB /NOEXP

On macOS, for both kinds of Mac:

mkdir -p Sort.ofx.bundle/Contents/MacOS
clang -O2 -bundle -arch arm64 -arch x86_64 sort.c -o Sort.ofx.bundle/Contents/MacOS/Sort.ofx

On Linux:

mkdir -p Sort.ofx.bundle/Contents/Linux-x86-64
gcc -O2 -shared -fPIC sort.c -o Sort.ofx.bundle/Contents/Linux-x86-64/Sort.ofx

2. Install the folder from Settings ▸ Addons ▸ Extensions ▸ Install from a folder. The install window says Runs its own code on this computer.

3. Drag Sort from Effects & presets onto a layer. It is under the plugin’s own Stylise heading. Effect controls shows Direction, Threshold and Reverse.

An effect with ofx in place of shader is an OFX plugin. The other fields are as in LFX effects.

FieldWhat it is
ofxThe .ofx.bundle folder, inside the extension.
pluginThe plugin’s OFX identifier, as its describe gives it. A project saves the effect as ofx:<plugin>.
interfaceOptional. An interface page, as for an LFX effect.

An entry with both shader and ofx, or neither, is refused. Make a package refuses a bundle with no library for the computer it runs on. A package can hold the libraries for all three systems.

Lumit is an OpenFX 1.4 host. Images are RGBA, 32-bit float. The contexts are filter, general, generator and transition. A plugin’s parameters are its rows in Effect controls.

Each bundle runs in a process of its own. A render that fails, crashes or runs past its time limit, 10 seconds by default, is a strike. After three the plugin is switched off until Lumit restarts.

A plugin polls abort to stop a frame that is no longer wanted.

A plugin that says it supports CUDA, OpenCL or Metal renders on the graphics card, with images in the card’s memory, as in other OFX hosts.

SystemWhat Lumit offers
Windows, LinuxCUDA on NVIDIA cards, then OpenCL
macOSMetal

A frame the card fails on is drawn again on the CPU. After two failures the plugin stays on the CPU until Lumit restarts. Settings ▸ Preview and cache ▸ Render plugins on the graphics card turns it off for every plugin.

Installing or removing the extension stops its plugin’s process first. A changed library takes effect at the next start.