Skip to content

Writing an effect plugin

Write your own effects, generators and transitions as WGSL shaders, share them as a file, and install, update and turn them off in the plugin manager.

An effect plugin is an effect you write yourself: a WGSL shader and a short manifest of the settings it takes, in one .oryvio-effect file. It’s put on clips like any effect, keyframed, masked, blended, copied, saved in a look and drawn in exports.

Effect plugins are part of Pro. On the free plan they’re marked Pro, and can’t be installed, put on clips or changed. Plugin effects and transitions already in a project (from when the account had Pro, or someone else’s project) keep their settings, and are drawn as if they were off, saying why: see below. The plugins you’ve kept stay in your account.

A plugin is a shader and nothing else. No script runs, so it can’t reach the network, your files, your account or the page. All it can do is say what color each pixel is, from the pictures and settings it’s given.

Install and manage plugins

Open the bin’s Effects tab and choose Manage effect plugins… at the end of it, or choose Manage plugins where a message names one. The plugin manager lists the plugins in the open project and your own.

  1. Click Install from file… and choose a .oryvio-effect file.
  2. It’s checked, and compiled in this browser. If anything’s wrong, nothing is installed and the manager lists every reason, by line of the shader.
  3. It’s put in the open project, and kept in your plugins (when you’re signed in), so it’s there in every project.

Installing a newer version of a plugin the project has puts it in place of the old one, in one undo step. Its effects keep their settings: a setting the new version has keeps its value, one it renamed (see was) carries over, and one it dropped goes, with its keyframes.

For each plugin you can:

  • Update this project, when your plugins have a newer version than the project’s.
  • Turn it off with On here. Its effects are then drawn as if they were off, in the preview and in exports, on this device only.
  • View source to read its shader, or Save as a file to share it.
  • Remove from this project. Its effects keep their settings and keyframes, marked Missing in the Inspector and drawn as if they were off, until it’s installed again.
  • Remove from your plugins. Projects that have it keep their own copy.

Plugins aren’t offered in the marketplace, and packs can’t contain them.

Use a plugin effect

Plugins are listed first in the bin’s Effects tab, under Plugins, and at the end of the Inspector’s Add an effect list. Click one to add it to the selected clips. A plugin of yours that the project doesn’t have yet goes into the project as you add it, so a shared project carries what it needs.

Its settings are in the Inspector as its plugin names them. Numbers, angles and points animate; whole numbers, switches, colors and choices are set once. Mix, Blend mode, masks and qualifiers work as they do on any effect. Copy and paste, looks, grade versions and node graphs carry plugin effects too.

A transition plugin goes from one picture to another as its progress runs from 0% to 100%. Use it between two clips like any transition: it’s listed under Plugins in the bin’s Transitions tab, and in the Type list of the Inspector’s Transition in section. Drag it onto a cut, or select clips and click it. Its progress follows the transition’s own length, alignment and easing, and its settings are under them in the Inspector. While it can’t be drawn (see below), it’s drawn as a cut.

A transition plugin can also be a node of a clip’s node graph, with two inputs as a merge has: the picture wired into it is where it starts, and the picture laid over it is where it ends. There, keyframe its Progress to play it.

When you open a project that uses plugins, a message says which, with a way to turn them off. Nothing is asked.

When a plugin isn’t drawn

A plugin’s effect is drawn as if it were off, and marked in the Inspector, when:

  • the account’s plan doesn’t have effect plugins, which are part of Pro. Its settings are kept, shown but not changed, until it has Pro again;
  • the project doesn’t have its plugin (Missing). Its settings are kept as they were, and listed;
  • the plugin is turned off on this device;
  • its shader doesn’t compile in this browser. The plugin manager says why;
  • the browser draws with Canvas 2D rather than WebGPU. Plugins are drawn by WebGPU alone.

A transition plugin between two clips is drawn as a cut then, halfway through, with its settings kept.

The export dialog says beforehand which effects will be left off, and why, and the finished export lists them.

A plugin that makes frames take far too long (over three quarters of a second a frame, three frames in a row), or that’s being drawn when the graphics device is reset, is turned off on this device, said, and drawn as if it were off. Choose Try it again in the plugin manager to turn it back on.

The file

A .oryvio-effect file is JSON, at most 256 KB:

{
  "format": "oryvio-effect",
  "formatVersion": 1,
  "id": "com.example.soft-vignette",
  "name": "Soft Vignette",
  "version": "1.0.0",
  "author": "You",
  "description": "Darkens the picture toward its edges.",
  "category": "Vignette",
  "kind": "filter",
  "inputs": ["source"],
  "params": [ ... ],
  "wgsl": "fn render(uv: vec2f) -> vec4f { ... }"
}
  • id: lowercase letters and digits, in parts joined by dots or hyphens, such as com.example.soft-vignette. It stays the same from one version to the next.
  • version: numbers joined by dots, such as 1.2.0. A later version takes an earlier one’s place.
  • kind: filter changes the picture it’s given; generator draws a picture of its own over it; transition goes from one picture to another.
  • inputs: optional. If given, ["source"] for a filter or a generator, ["from", "to"] for a transition.
  • name (up to 60 characters), author, description and category are shown as you write them.

Anything else in the file, or anything wrong in it, is refused, with every reason listed.

Settings

params lists up to 48 settings, each with a key (letters only, starting lowercase, up to 24), a type, a label, a default and an optional tip:

TypeDefaultAlsoIn the shader
floata numbermin, max, slider, unitf32
inta whole numbermin, max, slider, uniti32
angledegreesmin, max, sliderf32, in radians
booltrue or falseu32, 0 or 1
color"#rrggbb"vec4f, its channels as stored, alpha 1
point[x, y], shares of the picturemin, max (each axis, -2 to 3 by default)vec2f
choiceone option’s valueoptions: up to 32 of { "value", "label" }i32, the option’s place from 0
  • min and max are a number’s range: values are kept within it. slider is the slider’s narrower range, as [low, high].
  • unit says how a number’s shown: px, pct (a 0 to 1 value shown as a percentage), x, s, hz, ev or count.
  • was: keys the setting had in earlier versions, so values saved with them carry over when the plugin’s updated.
  • A point’s values are kept as two settings, its key with X and with Y after it. A transition has a setting of its own, progress, before the rest.
  • mix and progress can’t be keys, nor can WGSL’s own words. A key a built-in effect has (amount, angle, softness…) must keep within that key’s range.

There are no curve settings yet.

The shader

The plugin’s WGSL defines one function, which is called for every pixel:

fn render(uv: vec2f) -> vec4f

uv is where the pixel is, from 0 to 1 across and down the picture being worked on. It returns the pixel’s color, premultiplied by its alpha. Before the plugin’s code, Oryvio declares:

  • frame, of what’s drawn: size (the picture being worked on, in pixels), texel (1 / size), picture (the clip’s picture’s size, in its own pixels as it’s fitted to the frame), crop (its crop, in working pixels: x0, y0, x1, y1), time (seconds into the clip), progress (a transition’s, 0 to 1), wide (1 when the project is in a wide or HDR working space) and seed (different for each effect).
  • params, a struct of its settings, by key, in the types above.
  • source(uv) and sourcePx(p: vec2i): the picture under a filter or a generator. A transition has outgoing(uv) and incoming(uv), with outgoingPx and incomingPx.
  • toPicture(uv): where uv is in the clip’s picture, in its own pixels from its top left; and fromPicture(p), back. inCrop(uv): whether it’s within the crop.
  • toLinear(rgb) and toStored(rgb): the pictures’ values are stored as the built-in effects receive them, with sRGB’s curve; take them to linear light for light math, and back. unpremultiply, premultiply, luma(rgb) and random(p).

What render returns is kept to what a picture can be: no NaN or infinity, alpha from 0 to 1. A plugin draws within the clip’s picture, its crop: what it draws past it is cut.

A plugin can’t declare bindings, entry points, overrides, directives, textures or samplers of its own, or anything in another address space (var<storage>, var<uniform>, var<workgroup>). The code’s checked for those before it’s compiled, and Oryvio makes the bind group’s layout itself.

Example: a vignette

A filter that takes the picture toward a color at its edges, in linear light. Download soft-vignette.oryvio-effect, with amount, reach, softness, center (a point), tint (a color) and round (a switch):

fn render(uv: vec2f) -> vec4f {
  let c = source(uv);
  let p = toPicture(uv) - params.center * frame.picture;
  let half = frame.picture * 0.5;
  let r = select(p / half, p / min(half.x, half.y), params.round != 0u);
  let d = length(r);
  let soft = max(params.softness * params.reach, 0.0001);
  let k = smoothstep(params.reach - soft, params.reach + soft * 0.5, d) * params.amount;
  let s = unpremultiply(c);
  let lit = mix(toLinear(s.rgb), toLinear(params.tint.rgb), k);
  return premultiply(vec4f(toStored(lit), s.a));
}

Example: a wipe transition

A transition with two inputs, its edge soft and lit. Download soft-wipe.oryvio-effect, with angle, softness, glow and glowColor:

fn render(uv: vec2f) -> vec4f {
  let a = outgoing(uv);
  let b = incoming(uv);
  let p = toPicture(uv) / frame.picture - 0.5;
  let dir = vec2f(cos(params.angle), sin(params.angle));
  let span = max(0.5 * (abs(dir.x) + abs(dir.y)), 0.0001);
  let s = dot(p, dir) / span * 0.5 + 0.5;
  let soft = max(params.softness, 0.0001);
  let edge = frame.progress * (1.0 + soft) - soft;
  let keep = smoothstep(edge, edge + soft, s);
  let c = mix(b, a, keep);
  let lit = params.glow * (1.0 - abs(2.0 * keep - 1.0));
  return vec4f(c.rgb + params.glowColor.rgb * lit * c.a, c.a);
}

A generator is written the same way: moving-stripes.oryvio-effect draws two colors in bands that drift with frame.time.

Limits

  • A file is at most 256 KB; its shader at most 128 KB and 4,000 lines; 48 settings, 32 options a choice.
  • A project keeps at most 64 plugins.
  • Plugins are drawn by WebGPU. Without it (Canvas 2D), their effects are left off.
  • A frame that takes over three quarters of a second, three times in a row, turns the plugin off on this device. Keep loops bounded.

Debug a plugin

  • Install it: the plugin manager lists what’s wrong with the manifest, and what compiling said, each by line of your shader.
  • Open View source to see the line numbers it’s compiled with.
  • Return a setting or a value as a color to see it, such as return vec4f(vec3f(fract(toPicture(uv).x / 100.0)), 1.0);.
  • Change the file, raise its version and install it again: the project’s effects move to the new version, their settings kept.
  • With the agent API, installPlugin, listPlugins, addPluginEffect and setPluginParams do the same from a script. See the agent API.