- Image
- Voro
Script FX
Purpose
Section titled “Purpose”Script FX runs a Python function per frame, using GPU tensors in a shared Python process. Use it for an image effect you can write in Python, to run a Python model, or for what a compiled kernel cannot do: Python libraries, files, JSON, devices and the network. ctx.media plays movies and stills onto an output without Python touching a frame. For per-pixel work, Kernel FX is faster. Face Track, Optical Flow, Track Anything, Video Depth, Portrait Rig and Stream Diffusion use Script FX sources with their model providers.
Place Script FX from the Image view of the Voro menu, under Voro. The docked DAT script_fx_source is the source. Wire an image into image, edit process(ctx), press Reload. ctx.inputs and ctx.outputs are the node’s ports by name. Declare PARAMS at the top of the source and each row becomes a parameter.
This source halves RGB while preserving alpha. Paste it into the DAT and Reload:
def process(ctx): image = ctx.inputs['image'] out = ctx.outputs['out'] out.copy_(image) out[..., :3].mul_(0.5)Change 0.5 to 1.0 and Reload to return to the input brightness. Write the result into ctx.outputs['out']; returning a tensor from the function does not fill the output.
Inputs and outputs
Section titled “Inputs and outputs”A source can declare its ports with INPUTS and OUTPUTS, as Kernel FX does; an empty INPUTS makes a generator. One that declares none, like the example above, has these:
image, required. The frame to process.field, optional. A two-channel field for scripts that read it.out. The processed frame.
Controls
Section titled “Controls”- Reload compiles the candidate. The node switches to it only after it has produced a frame; until then the previous good script keeps running.
- Declared
PARAMSappear as parameters and apply on the next frame. RUN = "step"runs every engine step;RUN = "change"only when an input or control changes. The Lab’sSCRIPT.mdguide covers ports, run modes andctx.media.
- The example edits the output tensor after copying the input. Keep input tensors unchanged when writing your own effect.
Inputs
None
Outputs
-
outimage
Parameters
Section titled “Parameters”Script
op('script_fx').par.Scriptdat - Default:
"" (Empty String)
op('script_fx').par.Reload - Default:
None
op('script_fx').par.Scriptrevision - Default:
0- Range:
- 0 to 2147483600
op('script_fx').par.Artifact - Default:
"" (Empty String)