Contents

Reference

Presets: lamino/fx

Functions that expand to a combination of other nodes. No node with the preset's name appears in the IR: the expanded nodes do, with ids of the form <id>/....

This page as Markdown

lightWrap edgeBlur flash withAlpha undistort redistort starGlow turbulentDisplace levels exposure tint tritone monochrome fill dropShadow castShadow outline unsharp posterizeTime tile mirror offset roughenEdges matte

lightWrap

Wrap the background's light around the foreground's edges.

Module lamino/fx, preset

  • Input fg (image): Foreground (premultiplied).
  • Input bg (image): Background.
Parameter Type Default Range Unit Keys Description
size float 0.01 0 or more width units yes Blur sigma in width units.
amount float 0.4 0 or more yes Strength.

Extends and blurs the background, keeps it where the foreground is (merge in: A = blurred bg, B = fg), scales it and screens it onto the foreground.

Expands to:

fg.screen(merge(edgeExtend(bg, { size }).blur({ size }), fg, { op: "in" }).grade({ multiply: amount, unpremult: false }))

Examples:

// Wrap
const wrapped = lightWrap(fx, plate, { size: 0.01, amount: 0.4 });

edgeBlur

Blur only the alpha edge band of a premultiplied image.

Module lamino/fx, preset

  • Input img (image): Source (premultiplied).
Parameter Type Default Range Unit Keys Description
size float 0.001 0 or more width units yes Edge half-width and blur sigma in width units.

The band is |erode(+size) − erode(−size)| of alpha, moved into alpha with shuffle, and used as the mask of an over of the blurred image onto the original.

Expands to:

merge(img.blur({ size }), img, { op: "over", mask: band })  where  band = img.erode({ size: -size }).merge(img.erode({ size }), { op: "difference" }).shuffle({ a: "a" })

flash

Additive flash: add a colour scaled by an (often animated) amount.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
amount float 0.5 0 or more yes Strength.
color vec3 [1, 1, 1] Flash colour (working space rgb).

Adds color · amount to rgb with no alpha change (the 4th component is 0). amount may be t(f => …).

Expands to:

img.grade({ offset: [color.r * amount, color.g * amount, color.b * amount, 0], unpremult: false })

Examples:

// On the beat
flash(sky, { amount: t(f => beats.at(f) * 0.6), color: [0.9, 0.95, 1.0] })

withAlpha

Take alpha from a matte image, optionally eroded. The result is STRAIGHT; call .premult() after.

Module lamino/fx, preset

  • Input img (image): Source (straight or premultiplied rgb; alpha replaced).
  • Input matte (image): Matte image.
Parameter Type Default Range Unit Keys Description
erode float 0 width units yes Erode radius in width units (0 = none).
channel enum "r" Matte channel to use (luma: the luma of its colour). Values: r g b a luma
invert bool false Use 1 − matte.

Alpha comes from the matte's channel (red by default); with channel: "luma" or invert the matte goes through matteOp first. Erode works on the straight result.

Expands to:

img.shuffle(matte, { a: "1." + channel }).erode({ size: erode, channels: "alpha" })   (luma / invert: img.shuffle(matteOp(matte, { sourceA: channel, invertA: invert }), { a: "1.a" }) …)

Examples:

// AI matte
const person = fg.despill({ screen: "green" }).withAlpha(matte, { erode: 0.0005 }).premult();

undistort

Apply an ST map (forward).

Module lamino/fx, preset

  • Input img (image): Source.
  • Input st (data): Forward ST map.

Same as uvMap(img, st); the map is read with aov(..., { kind: "uv" }).

Expands to:

uvMap(img, st)

redistort

Apply the inverse ST map.

Module lamino/fx, preset

  • Input img (image): Source.
  • Input stInverse (data): Inverse ST map.

Same as uvMap(img, stInverse); pass the INVERSE map, not the one used for undistort.

Expands to:

uvMap(img, stInverse)

starGlow

Star-shaped glow: streaks of light from the bright parts.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
threshold float 0.8 0 or more yes Scene-linear level above which pixels throw streaks.
streaks json 4 Number of evenly spaced streaks (2 to 16), or an array of angles in degrees (clockwise from +x).
length float 0.15 0 or more width units yes Length of one streak in width units.
falloff enum "exp" How a streak fades along its length. Values: linear exp box
rotation float 0 degrees yes Turns the whole star, degrees clockwise.
tint vec3 [1, 1, 1] Colour of the streaks (working space rgb multiplier).
intensity float 4 0 or more yes Multiplier on the streaks.
samples int 64 2 to 256 Taps per streak.

Keeps what lies above threshold, softens it a little (so that the taps of the streaks cannot step over a small highlight), draws one one-sided directionalBlur per streak, takes the brightest of them per pixel (max), scales by intensity · tint and adds the result to the input (alpha = the larger of the two). streaks is a count (4, 6, 8 …: evenly spaced, the first pointing right before rotation) or an array of angles in degrees, clockwise from +x. length is the length of one streak. The streaks are normalised blurs, so a small highlight gives a faint streak: raise intensity (3 to 10 is usual) rather than lowering the threshold. All nodes are namespaced <id>/….

Expands to:

merge(max(...angles.map((a) => directionalBlur(bright, { length, angle: a + rotation, falloff, oneSided: true, samples }))).grade({ multiply: tint * intensity, unpremult: false }), img, { op: "add", alpha: "max" })  where  bright = img.grade({ offset: -threshold, clampBlack: true }).blur({ size: length / samples })

Examples:

// Four-point star on highlights
const stars = starGlow(lights, { threshold: 1.0, length: 0.2, rotation: 45 });

// Anamorphic streak
const flare = lights.starGlow({ streaks: [0, 180], length: 0.4, tint: [0.4, 0.6, 1.0], intensity: 6 });

turbulentDisplace

Warp an image with fractal noise (heat haze, water, wobble).

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
amount float 0.01 0 or more width units yes Largest displacement in width units.
size float 0.1 0.0001 or more width units yes Size of the largest swirls in width units.
complexity int 2 1 to 12 Noise octaves (1 = smooth bulges, more = finer wrinkles).
evolution float 0 yes Position on the noise's time axis; 1.0 = one lattice cell.
offset vec2 [0, 0] width units yes Moves the turbulence, [x, y] in width units.
pinEdges bool false Fade the displacement to zero towards the frame edges.
edge enum "clamp" What is read outside the picture. Values: transparent clamp mirror wrap
seed int 0 Noise seed (the second noise uses seed + 1).

Two fractalNoise pictures with different seeds drive the horizontal and the vertical displacement of a displace node: each pixel moves by up to amount. size is the size of the largest swirls, complexity the number of noise octaves, evolution animates the turbulence (it never reads the frame: write t((f) => f * 0.05)), offset moves the turbulence itself. pinEdges fades the displacement to zero towards the frame edges (an elliptical falloff that reaches zero at the middle of each edge), so a full-frame plate keeps its border. edge is what displace reads outside the picture (clamp by default: no transparent border on a plate). All nodes are namespaced <id>/….

Expands to:

displace(img, fractalNoise({ scale: size, octaves: complexity, evolution, offset, seed }).shuffle(fractalNoise({ …, seed: seed + 1 }), { g: "1.r" }), { amount: [amount, amount], edge })

Examples:

// Heat haze
const haze = turbulentDisplace(plate, { amount: 0.003, size: 0.04, evolution: t((f) => f * 0.08) });

// Wobbly title, edges of the frame untouched
const wobble = title.turbulentDisplace({ amount: 0.01, size: 0.2, complexity: 1, pinEdges: true, evolution: t((f) => f * 0.03) });

levels

Input black / white, gamma and output black / white (the After Effects Levels control set).

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
inBlack float 0 yes Input level that becomes black.
inWhite float 1 yes Input level that becomes white.
gamma float 1 0.001 or more yes Gamma (above 1 lifts the midtones).
outBlack float 0 yes Output level of black.
outWhite float 1 yes Output level of white.
channel enum "rgb" Channels the levels apply to. Values: rgb r g b a

out = outBlack + (outWhite − outBlack)·((in − inBlack) / (inWhite − inBlack))^(1/gamma), on straight colour, as two grade nodes (the first maps the input range and applies gamma, the second maps to the output range; the second is left out while outBlack / outWhite are 0 / 1). Nothing is clamped: values outside inBlack..inWhite continue past 0..1 (After Effects clips them at 8 / 16 bpc). channel restricts it to one channel (a: alpha, without gamma). All nodes are namespaced <id>/….

Expands to:

img.grade({ blackpoint: inBlack, whitepoint: inWhite, gamma }).grade({ lift: outBlack, gain: outWhite })

Examples:

// Crush the blacks, lift the mids
const out = levels(plate, { inBlack: 0.02, inWhite: 0.9, gamma: 1.2 });

exposure

Exposure in stops, with offset and gamma.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
stops float 0 stops yes Exposure change in stops (1 = twice the light).
offset float 0 yes Added after the gain.
gamma float 1 0.001 or more yes Gamma after gain and offset.

rgb·2^stops + offset, then ^(1/gamma), on straight colour: one grade node. Animated stops are evaluated per frame before 2^x is taken, so the exposure, not the gain, follows the keys.

Expands to:

img.grade({ multiply: 2 ** stops, offset, gamma })

Examples:

// One stop down
const darker = exposure(plate, { stops: -1 });

tint

Map black and white to two colours.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
black color [0, 0, 0, 1] Colour of black.
white color [1, 1, 1, 1] Colour of white.
amount float 1 0 to 1 yes Blend with the original (1 = tint only).

A two-stop gradientMap on the luma: dark values become black, bright ones white; amount blends with the original.

Expands to:

img.gradientMap({ stops: [{ offset: 0, color: black }, { offset: 1, color: white }], amount })

Examples:

// Sepia
const sepia = tint(plate, { black: "#1a0f08", white: "#ffe9c8" });

tritone

Map shadows, midtones and highlights to three colours.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
shadows color [0, 0, 0, 1] Colour of the shadows.
midtones color [0.5, 0.5, 0.5, 1] Colour of the midtones.
highlights color [1, 1, 1, 1] Colour of the highlights.
amount float 1 0 to 1 yes Blend with the original.

A three-stop gradientMap on the luma (stops at 0, 0.5 and 1).

Expands to:

img.gradientMap({ stops: [{ offset: 0, color: shadows }, { offset: 0.5, color: midtones }, { offset: 1, color: highlights }], amount })

Examples:

// Teal and orange
const look = tritone(plate, { shadows: "#06242b", midtones: "#7a6a5a", highlights: "#ffd9a8", amount: 0.6 });

monochrome

Black and white from weighted channels, optionally tinted.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
weights vec3 [0.2722287, 0.6740818, 0.0536895] Weights of r, g and b in the grey value.
tint vec3 [1, 1, 1] Multiplier on the grey value per output channel.

A colorMatrix whose three colour rows are the same weights (times tint): every channel becomes dot(weights, rgb)·tint. The default weights are the working space's luma (AP1); [0.8, 0.2, 0] is a red filter.

Expands to:

img.colorMatrix({ r: [w.r * tint.r, w.g * tint.r, w.b * tint.r, 0], g: […tint.g…], b: […tint.b…] })

Examples:

// Red-filter black and white
const bw = monochrome(plate, { weights: [0.8, 0.2, 0.0] });

fill

Fill the picture's shape with one colour.

Module lamino/fx, preset

  • Input img (image): Source (its alpha is the shape).
Parameter Type Default Range Unit Keys Description
color color [1, 1, 1, 1] yes Fill colour.
opacity float 1 0 to 1 yes How much of the fill replaces the original colour.

A constant of color cut by the input's alpha (merge in); opacity below 1 blends the fill with the original (merge copy with mix).

Expands to:

merge(merge(constant({ color }), img, { op: "in" }), img, { op: "copy", mix: opacity })

Examples:

// White logo
const white = fill(logo, { color: [1, 1, 1] });

dropShadow

Drop shadow behind a picture.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
color color [0, 0, 0, 1] yes Shadow colour.
opacity float 0.5 0 to 1 yes Shadow opacity.
angle float 45 degrees yes Direction the shadow falls, degrees clockwise from +x.
distance float 0.01 0 or more width units yes Offset of the shadow in width units.
softness float 0.005 0 or more width units yes Blur sigma of the shadow in width units.
shadowOnly bool false Return only the shadow.

The input's shape filled with color, faded by opacity, moved by distance towards angle (degrees clockwise from +x: 45 is down and to the right; After Effects counts from straight up, so its 135° is 45 here), blurred by softness (Gaussian sigma), and put under the input. shadowOnly returns the shadow alone. Animate distance or angle, not both at once.

Expands to:

merge(img, merge(constant({ color }), img, { op: "in" }).opacity(opacity).transform({ translate: [cos(angle)·distance, sin(angle)·distance] }).blur({ size: softness }), { op: "over" })

Examples:

// Title shadow
const titled = dropShadow(title, { distance: 0.006, softness: 0.004, opacity: 0.6 });

castShadow

Long cast shadow towards a directional or point light, its opacity, softness and colour changing along its length.

Module lamino/fx, preset

  • Input img (image): Source (its alpha casts the shadow).
Parameter Type Default Range Unit Keys Description
light enum "directional" Parallel light from angle, or a point light at center (the shadow fans out from it). Values: directional point
angle float 45 degrees yes Direction the shadow falls (directional light), degrees clockwise from +x.
center vec2 [-1, -1] width units yes Position of the point light in width units; [-1, -1] = the display centre.
length float 0.1 0 or more width units yes How far the shadow reaches from its caster, in width units.
softness float 0 0 or more width units yes Blur sigma of the shadow where it starts, in width units.
softnessEnd float 0.01 0 or more width units yes Blur sigma of the shadow at length, in width units.
opacity float 1 0 to 1 yes Opacity where the shadow starts.
opacityEnd float 0 0 to 1 yes Opacity at length.
color color [0, 0, 0, 1] yes Shadow colour where it starts.
colorEnd color [0, 0, 0, 1] yes Shadow colour at length.
curve float 1 0.05 to 20 yes Exponent on the position along the shadow before start and end are mixed: above 1 keeps the start values longer, below 1 reaches the end values sooner.
inner bool false Inner shadow: cast by the outside of the shape onto its inside.
shadowOnly bool false Return only the shadow.

shadowRay on the input, with the three blur levels it reads for softness built as blur nodes: level k blurs the input by k/3 of max(softness, softnessEnd) (sampled frame by frame when either is animated; no blur when both are 0). Each pixel takes the shadow of the nearest occluder towards the light within length: opacity, softness and color at the caster, opacityEnd, softnessEnd and colorEnd at length, mixed by (distance / length)^curve. angle is where the shadow falls, degrees clockwise from +x (as in dropShadow). light: point fans the shadow out from center. inner casts the outside of the shape onto its inside. The input is put over the shadow (inner: the shadow over the input); shadowOnly returns the shadow alone. Not covered: textures and fill from the source pixels (merge a texture with op: "in" onto shadowOnly), bevel and global illumination.

Expands to:

shadowRay(img, img.blur({ size: σmax/3 }), img.blur({ size: 2·σmax/3 }), img.blur({ size: σmax }), { …same options })

Examples:

// Long title shadow that softens and fades
const long = castShadow(title, { angle: 45, length: 0.25, softness: 0.001, softnessEnd: 0.02, opacity: 0.8 });

// Shadows fanning out from a lamp
const lit = castShadow(logo, { light: "point", center: [0.5, 0.1], length: 0.4, color: [0.05, 0.02, 0.1, 1], colorEnd: [0.2, 0.1, 0.3, 1] });

outline

Stroke along the edge of a picture's shape (layer-style stroke).

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
width float 0.002 0 or more width units yes Stroke width in width units.
color color [1, 1, 1, 1] yes Stroke colour.
position enum "outside" Where the stroke lies relative to the edge. Values: outside inside center

The band between a grown and / or shrunk copy of the alpha (erode with a disc), filled with color: outside = grown − shape, drawn under the picture; inside = shape − shrunk, drawn over it; center = half of width on each side, drawn over it.

Expands to:

outside: merge(img, merge(constant({ color }), matteOp(img.erode({ size: -width }), img, { op: "subtract" }), { op: "in" }), { op: "over" })

Examples:

// Black outline around a title
const outlined = outline(title, { width: 0.003, color: [0, 0, 0] });

unsharp

Unsharp mask: sharpen by adding back the difference from a blurred copy.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
amount float 1 0 or more yes Strength (1 adds the whole difference).
radius float 0.002 0 or more width units yes Blur sigma in width units (the scale of detail that is sharpened).
threshold float 0 0 or more yes Differences below this are left alone.

img + (img − blur(img, radius))·amount on the premultiplied colour (alpha is the input's; the blur repeats the edge pixels so the frame's border gets no halo). With threshold > 0, differences smaller than it are ignored and larger ones are reduced by it (noise is not sharpened).

Expands to:

merge(merge(img, img.blur({ size: radius, edge: "clamp" }), { op: "subtract" }).grade({ multiply: amount, unpremult: false }), img, { op: "add", alpha: "b" })

Examples:

// Sharpen
const crisp = unsharp(plate, { amount: 0.8, radius: 0.0015 });

posterizeTime

Hold frames to a lower frame rate (stepped, stop-motion look).

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
fps float 12 0.01 or more Frame rate of the result, frames per second.

A retime whose time is a staircase: with the comp's rate R and first frame f0, frame f shows the input at f0 + floor((f − f0)·fps / R)·R / fps, taken at the nearest whole frame. Needs the comp's frames.

Expands to:

img.retime({ time: t((f) => f0 + Math.floor((f - f0) * fps / R) * R / fps), sample: "nearest" })

Examples:

// On twos at 24 fps
const stepped = posterizeTime(anim, { fps: 12 });

tile

Repeat the picture as tiles (Motion Tile).

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
tileSize vec2 [0.5, 0.5] yes Size of one tile relative to the frame, [x, y] (a number sets both).
center vec2 [-1, -1] width units yes Point that stays in place, [x, y] in width units; [-1,-1] = display centre.
mirror bool false Mirror every other tile so the seams match.

A transform that scales the picture to tileSize of the frame about center and fills the rest of the plane with repeats (edge: wrap), or with mirrored repeats when mirror is set (edge: mirror).

Expands to:

img.transform({ scale: tileSize, anchor: center, edge: mirror ? "mirror" : "wrap" })

Examples:

// 3 × 3 tiles
const tiles = tile(pattern, { tileSize: 1 / 3 });

mirror

Reflect one side of the picture onto the other across a line.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
center vec2 [-1, -1] width units A point on the mirror line, [x, y] in width units; [-1,-1] = display centre.
angle float 90 degrees Direction of the mirror line, degrees clockwise from +x.

The line runs through center at angle (degrees clockwise from +x). The side the angle turns towards (below a horizontal line) is replaced by the reflection of the other side: a flipped transform copied over the input through a half-plane matte (a clamped two-stop ramp). center and angle are fixed values.

Expands to:

merge(img.transform({ scale: [1, -1], rotate: 2 * angle, anchor: center }), img, { op: "copy", mask: halfPlane })

Examples:

// Left half mirrored onto the right
const sym = mirror(plate, { angle: 90 });

offset

Shift the picture, wrapping around the frame.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
shift vec2 [0, 0] width units yes Shift [x, y] in width units.

A transform with edge: wrap: what leaves on one side comes back on the other.

Expands to:

img.transform({ translate: shift, edge: "wrap" })

Examples:

// Scroll a seamless texture
const scroll = offset(texture, { shift: t((f) => [f * 0.002, 0]) });

roughenEdges

Roughen the edge of a picture's shape with noise.

Module lamino/fx, preset

  • Input img (image): Source.
Parameter Type Default Range Unit Keys Description
border float 0.01 0 or more width units yes Width of the roughened band in width units.
sharpness float 4 1 or more Crispness of the new edge (1 = as soft as the band).
scale float 0.02 0.0001 or more width units yes Size of the noise features in width units.
evolution float 0 yes Position on the noise's time axis.
seed int 0 Noise seed.

The alpha is softened over border, a fractalNoise (feature size scale) is added to it, and the sum is tightened back to an edge (sharpness: the larger, the crisper); the picture is cut by the result. The edge only moves inwards (outside the shape there is no colour to show). evolution animates the noise.

Expands to:

img.inside(matteOp(merge(fractalNoise({ scale, evolution, seed }).grade({ offset: -0.5 }), matteOp(img).blur({ size: border / 2 }), { op: "add" }).grade({ blackpoint: 0.5 − 0.5 / sharpness, whitepoint: 0.5 + 0.5 / sharpness, clampBlack: true, clampWhite: true }), { sourceA: "r" }))

Examples:

// Torn paper edge
const torn = roughenEdges(card, { border: 0.015, scale: 0.01 });

matte

Cut a picture with another layer's alpha or luma (track matte, Set Matte).

Module lamino/fx, preset

  • Input img (image): Source.
  • Input matte (mask): Matte layer.
Parameter Type Default Range Unit Keys Description
source enum "alpha" What of the matte layer is the matte. Values: alpha luma
invert bool false Cut with 1 − matte.

The picture is multiplied by the matte: source: "alpha" uses the matte's alpha, "luma" the luma of its colour (through matteOp); invert cuts with 1 − matte instead (merge out, so the picture stays whole outside the matte's data window). The four After Effects track mattes are alpha, alpha + invert, luma, luma + invert.

Expands to:

merge(img, source === "luma" ? matteOp(matte, { sourceA: "luma" }) : matte, { op: invert ? "out" : "in" })

Examples:

// Luma track matte
const cut = matte(texture, gradientLayer, { source: "luma" });