# Nodes: lamino/aov, lamino-text, lamino-3d

Nodes for data layers (AOVs), text and shapes, and cards in 3D space.

- **Sources** [`aov`](#aov)
- **Colour** [`despill`](#despill) [`fog`](#fog)
- **Filters** [`motionBlur`](#motionblur)
- **Transforms** [`uvMap`](#uvmap)
- **Text and shapes** [`text`](#text) [`shape`](#shape) [`lottie`](#lottie)
- **3D** [`camera`](#camera) [`card3d`](#card3d) [`stack3d`](#stack3d)
- **Compositing** [`zMerge`](#zmerge)

## Sources

### `aov`

Read a data layer (depth, position, normal, motion, uv) with declared conventions.

Module `lamino/aov`, category Sources, output data

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `path` | path | none |  |  |  | Alias path of the EXR. |
| `layer` | str | `""` |  |  |  | EXR layer name. |
| `channels` | json | `null` |  |  |  | Channel names to read into R,G,B(,A), e.g. ["Z"], ["x","y","z"], ["u","v"]. Default: the layer's channels in R,G,B,A / X,Y,Z / U,V order. |
| `kind` | enum | `"other"` |  |  |  | What the layer holds. Values: `depth` `position` `normal` `motion` `uv` `other` |
| `units` | enum | `"none"` |  |  |  | Length unit of the stored values (depth/position: m/cm/mm; motion: pixels or width). Values: `m` `cm` `mm` `pixels` `width` `none` |
| `metersPerUnit` | float | `1` | 0 or more |  |  | Explicit scale when `units` is none (1 unit = n metres). |
| `depthRange` | vec2 | `[0, 0]` | 0 or more | m |  | Depth stored normalised 0..1 (Cinema 4D): [near, far] in metres mapped linearly; [0, 0] = not normalised. |
| `measure` | enum | `"distance"` |  |  |  | Depth: distance from the camera plane, or length of the camera ray. Values: `distance` `ray` |
| `infinity` | float | `0` |  |  |  | Depth value the renderer writes for infinity (converted to +inf). 0 = none. |
| `space` | enum | `"world"` |  |  |  | Position/normal space in the file. Values: `world` `camera` |
| `handedness` | enum | `"right"` |  |  |  | Coordinate handedness in the file (C4D is left-handed). Values: `right` `left` |
| `up` | enum | `"y"` |  |  |  | Up axis in the file (Blender is Z up). Values: `y` `z` |
| `direction` | enum | `"forward"` |  |  |  | Motion vectors point to the next frame (forward) or the previous one. Values: `forward` `backward` |
| `yAxis` | enum | `"down"` |  |  |  | Sign convention of the stored motion / uv V axis. Values: `down` `up` |
| `range` | enum | `"unit"` |  |  |  | uv: 0..1 per tile (unit) or UDIM-offset (udim; tile index is split into B). Values: `unit` `udim` |
| `encoding` | enum | `"signed"` |  |  |  | Normal: how the components are stored. signed: -1..1 as is; unsigned: 0..1, decoded as 2·v − 1 (the 'N·0.5 + 0.5' packing of game engines). Values: `signed` `unsigned` |
| `premultiplied` | bool | `false` |  |  |  | Normal: the stored components are multiplied by the layer's alpha (antialiased edges); they are divided by alpha before decoding. Needs an alpha channel in the selection. |
| `missing` | enum | `"error"` |  |  |  | What to do when a frame file is missing: fail the frame, hold the nearest earlier existing frame of the sequence (E_FRAME_MISSING when none), or return black. Values: `error` `hold` `black` |
| `frameOffset` | int | `0` |  | frames |  | Added to the comp frame to get the file frame. |

Like `read` but for non-colour data: no colour conversion, no premultiplication, output port `data` (an RGBA f32 buffer holding the normalised data). The renderer's conventions MUST be declared (nothing is guessed) and the node converts them to the internal ones: depth → distance from the camera plane in metres, +inf at infinity; position / normal → world space, right-handed, Y up, metres (normals normalised); motion → width units, Y down, forward (this frame → next); uv → 0..1 with V down (UDIM tile index in B). Normals, in this order: `premultiplied: true` divides x, y, z by the alpha of the selection where alpha > 0 (where alpha is 0 the pixel has no normal and becomes [0, 0, 0]; a selection without an alpha channel is E_INVALID_ARGUMENT); `encoding: "unsigned"` decodes 0..1 to -1..1 (2·v − 1); then the `up` swap, `handedness` and the normalisation (a zero vector stays zero). `inspect` reports each layer's value range so the agent can check the declaration. Script sugar: `read(exr, { layer: "motion", kind: "motion", units: "pixels", direction: "forward" })` compiles to this node. **Kind inference** (one rule for the `read()` sugar and `aov()`, table `AOV_KIND_HINTS`): every convention option given narrows the possible kinds: `depthRange` / `measure` / `infinity` -> depth; `space` / `handedness` / `up` -> position or normal; `encoding` / `premultiplied` -> normal; `direction` -> motion; `range` -> uv; `yAxis` -> motion or uv; `units` m/cm/mm -> depth or position, pixels/width -> motion. Without `kind` the script writes the single remaining kind into the IR (so `depthRange` alone means depth), reports E_IR_PARAM_REQUIRED when several remain and E_IR_PARAM_INVALID when none does (e.g. `direction` together with `depthRange`). An explicit `kind` is used only when it is compatible with every option given; otherwise E_IR_PARAM_INVALID. IR validation enforces the same rule (`aov_convention_conflicts`), so a hand-written IR cannot bypass it; a missing `kind` in the IR counts as `other`, which no convention option is compatible with. Output window: `OutputWindow::Source`, as for `read`. `measure: ray` and `space: camera` need camera data the IR does not carry and are refused with E_NOT_IMPLEMENTED (export camera-plane distance / world space instead). Data layers never use the lossy source proxy: at proxy levels the full frame is read and downsampled in memory. Cryptomatte is not an AOV here (a `cryptomatte` node with a `mask` output is M3).

Examples:

```ts
// Depth from Octane
const z = aov(exr, { layer: "Z", kind: "depth", units: "cm", measure: "distance" });

// Motion vectors
const mv = aov(exr, { layer: "motion", kind: "motion", units: "pixels", direction: "forward" });

// ST map
const st = aov("$SHOTS/SHOW/020/lens/undistort_st.exr", { layer: "uv", kind: "uv", yAxis: "up" });

// Packed normals
const n = aov(exr, { layer: "WorldNormal", kind: "normal", encoding: "unsigned", premultiplied: true, handedness: "left", up: "z" });
```

## Colour

### `despill`

Remove green/blue screen spill from straight RGB.

Module `lamino/aov`, category Colour, output image, pointwise (fused with its neighbours)

- Input `in` (image): Source.

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `screen` | enum | `"green"` |  |  |  | Screen colour. Values: `green` `blue` |
| `method` | enum | `"average"` |  |  |  | Spill limit. Values: `average` `max` `double` |
| `amount` | float | `1` | 0 to 1 |  | yes | Fraction of the excess removed. |
| `restoreLuma` | bool | `true` |  |  |  | Compensate the luminance lost. |
| `luma` | vec3 | `[0.2722287, 0.6740818, 0.0536895]` |  |  |  | Luma weights. |

On unpremultiplied rgb (alpha > 0 only): limit = average: (other1 + other2)/2 · max: max(other1, other2) · double: 2·max(other); excess = max(screen − limit, 0); screen −= excess·amount. `restoreLuma` adds the removed luma back as neutral grey. Alpha untouched; re-premultiplied by alpha where > 0. Pixels with alpha == 0: the operation is homogeneous (f(k·rgb) = k·f(rgb)), so it is applied to their rgb directly.

Examples:

```ts
// Green screen
const clean = fg.despill({ screen: "green", method: "average", restoreLuma: true });
```

### `fog`

Depth fog: blend towards a colour by distance.

Module `lamino/aov`, category Colour, output image, pointwise (fused with its neighbours)

- Input `in` (image): Source.
- Input `depth` (data): Depth AOV (metres, camera-plane distance).

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `near` | float | `1` | 0 or more | m | yes | Fog starts (metres). |
| `far` | float | `100` | 0 or more | m | yes | Fog is full (metres). |
| `color` | color | `[0.5, 0.55, 0.65, 1]` |  |  | yes | Fog colour (working space). |
| `density` | float | `0.6` | 0 to 1 |  | yes | Maximum fog amount. |
| `falloff` | enum | `"linear"` |  |  |  | Curve. Values: `linear` `exp` |

t = clamp((z − near)/(far − near), 0, 1) with z in metres (from the `aov` node); linear: f = t·density; exp: f = 1 − exp(−t·density·4). out = rgb·(1 − f) + color·f·alpha (premultiplied). Pixels at +inf take f = density. Height fog and a camera input are M4 (lamino-3d).

Examples:

```ts
// Atmosphere
const foggy = fog(blurred, depth, { near: 2, far: 40, color: [0.55, 0.6, 0.7], density: 0.6 });
```

## Filters

### `motionBlur`

Vector motion blur from a motion AOV.

Module `lamino/aov`, category Filters, output image

- Input `in` (image): Source (beauty).
- Input `motion` (data): Motion AOV (from `aov` with kind motion).

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `shutter` | float | `0.5` | 0 to 2 |  | yes | Shutter as a fraction of the frame (0.5 = 180°). |
| `samples` | int | `16` | 2 to 128 |  |  | Taps per pixel. |
| `maxLength` | float | `0.05` | 0 or more | width units |  | Clamp of the vector length in width units. |

For each output pixel, `samples` taps along −v·shutter/2 … +v·shutter/2 where v is the (internally normalised) motion vector at the pixel, bilinear, averaged in fixed order. Vectors longer than `maxLength` are clamped (this is also the ROI padding). Gather-style, so thin fast objects smear less than a scatter blur would; good enough for CG passes.

Examples:

```ts
// Octane beauty
const blurred = motionBlur(beauty, mv, { shutter: 0.5, samples: 16 });
```

## Transforms

### `uvMap`

Resample the input through a UV / ST map (lens undistort/redistort, texture mapping).

Module `lamino/aov`, category Transforms, output image

- Input `in` (image): Source.
- Input `uv` (data): UV/ST map (from `aov` with kind uv).

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `filter` | enum | `"bilinear"` |  |  |  | Resampling filter. Values: `bilinear` `bicubic` |
| `outside` | enum | `"black"` |  |  |  | Sampling outside the source: transparent or edge clamp. Values: `black` `clamp` |

For each output pixel reads (u, v) from the `uv` input (0..1, V down after normalisation) and samples the source at (u·W, v·W·H/W) with the chosen filter. `undistort(img, st)` / `redistort(img, stInverse)` in `lamino/fx` are this node with the forward and inverse maps. Output data window = the uv input's data window (overscan is kept when the map is larger than the display).

Examples:

```ts
// Undistort
const work = uvMap(plate, st);
```

## Text and shapes

### `text`

Typeset a string with a project font and rasterise it (generator).

Module `lamino-text`, category Text and shapes, output image

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `text` | str | none |  |  | yes | The string to typeset (UTF-8; `\n` breaks a line). Animatable with hold keys only (`interp: "hold"`; in a script `t(f => String(f))`). |
| `font` | path | none |  |  |  | Alias path of the font file (TTF / OTF / TTC), normally under $FONTS. |
| `size` | float | `0.05` | 0 or more | width units | yes | Em size in width units. |
| `fill` | color | `[1, 1, 1, 1]` |  |  | yes | Fill colour. |
| `strokeColor` | color | `[0, 0, 0, 1]` |  |  | yes | Stroke colour. |
| `strokeWidth` | float | `0` | 0 or more | width units | yes | Stroke width in width units; 0 = no stroke. |
| `align` | enum | `"left"` |  |  |  | Horizontal alignment of each line about the origin. Values: `left` `center` `right` |
| `lineHeight` | float | `1.2` | 0 or more | factor |  | Line advance as a factor of `size`. |
| `tracking` | float | `0` |  | width units | yes | Extra advance between glyphs in width units. |
| `maxWidth` | float | `0` | 0 or more | width units |  | Wrap width in width units; 0 = no wrapping. |
| `axes` | json | `{}` |  |  |  | Variable-font axis values, e.g. { wght: 600, wdth: 90 }. |
| `features` | json | `{}` |  |  |  | OpenType features, e.g. { liga: 1, kern: 1 }. |
| `lang` | str | `""` |  |  |  | BCP 47 language tag for shaping ("" = none). |
| `fallback` | json | `[]` |  |  |  | Array of alias paths of fallback fonts, tried in order per glyph. |
| `vertical` | bool | `false` |  |  |  | Vertical (top-to-bottom) typesetting. Not supported: `true` is E_NOT_IMPLEMENTED. |
| `perGlyph` | json | `[]` |  |  |  | Per-cluster animation: one `{ x, y, rotation, scaleX, scaleY, opacity }` per grapheme cluster (numbers or animations); `[]` = none. Written by `.perGlyph()`. |
| `position` | vec2 | `[0.1, 0.5]` |  | width units | yes | Where the model's anchor lands, [x, y] in width units (`shape::Transform.position`). |
| `rotation` | float | `0` |  | degrees | yes | Rotation about the anchor in degrees, clockwise. |
| `scale` | vec2 | `[1, 1]` |  | factor | yes | Scale [x, y] about the anchor. |
| `anchor` | vec2 | `[0, 0]` |  | width units | yes | Pivot in the model's coordinates, width units. |
| `opacity` | float | `1` | 0 to 1 |  | yes | Multiplies the coverage (0..1). |

`text` is shaped with parley / skrifa / fontique into glyph outlines in the `lamino_core::shape` vocabulary, then rasterised. Coverage is rasterised on the CPU (`NodeDef.prepare`, `CpuPrepare`; tiny-skia, 8-bit coverage) at the evaluated proxy resolution directly (within one pixel of anti-aliasing of a downsampled full-resolution raster) and uploaded as an extra input slot; the kernel then colours it in scene-linear float: numeric colours are working-space linear, `#hex` strings are sRGB through the colour config's `color_picking` role, gradients interpolate in linear light. The coverage cache key holds the transformed geometry, stroke, fill rule, PAR, raster window / origin, proxy factor and `rasterVersion` (bumped when the rasteriser changes). Each fill / stroke (painter) stores the coverage of its own bounding box, and coverage whose outline in pixels did not change is not rasterised again on later frames. Limits (E_RESOURCE_LIMIT, decided for the full-resolution comp before anything is rasterised, so a proxy never passes what full resolution refuses): at most 8192 painters, and their bounding boxes must fit the coverage atlas (12 layers of at most 8192 × 8192 px). All lengths are width units: `size` is the em size, `tracking` is added between glyphs, `maxWidth` wraps lines (0 = no wrapping; line breaks follow parley's defaults), `lineHeight` is a factor of `size`. The layout's origin is the baseline start of the first line (left / center / right of it according to `align`); `position`, `rotation`, `scale`, `anchor` and `opacity` compose a `shape::Transform` on top of the model (`T(position) · R(rotation) · S(scale) · T(−anchor)`; opacity multiplies the coverage); they are animatable. Pixel aspect: the model is drawn in square space, so on a pixel grid with PAR ≠ 1 its x is scaled by 1 / PAR about the anchor and sizes, stroke widths, glyphs and rotations keep their displayed proportions (a circle is an ellipse on the grid and a circle on screen); `position` stays a grid coordinate (x 0..1 across the frame). The font is an alias path; files under the `$FONTS` root are hashed into `lamino.lock`; a file outside `$FONTS` (an alias that reaches a system font folder) lints L_SYSTEM_FONT and is hashed all the same. `axes` sets variable-font axes (`{ wght: 600 }`), `features` OpenType features (`{ liga: 1 }`), `lang` the BCP 47 language for shaping, `fallback` extra font paths tried per glyph in order. A character no font can show lints L_GLYPH_MISSING (with the character). Vertical writing is not supported: parley has no vertical writing mode, so `vertical: true` is E_NOT_IMPLEMENTED. Colour: `fill` and `strokeColor` are RGBA (as written, or a `#hex` string); the stroke (`strokeWidth` > 0) is centred on the outline and drawn over the fill. Per-character animation: `perGlyph` is an array with one entry per grapheme cluster of the string in text order (spaces count, line breaks do not; a ligature belongs to its first cluster), each `{ x, y, rotation, scaleX, scaleY, opacity }` whose values are numbers or animations (`{ keys, interp }`) and whose missing keys are the identity. `x` / `y` offset the cluster in the text's own coordinates (width units, before the node's transform); `rotation` (degrees, clockwise) and `scaleX` / `scaleY` pivot on the baseline at the centre of the cluster's advance (tracking excluded); `opacity` (0..1) multiplies the cluster's fill and stroke. The stroke belongs to its cluster and scales with it. A cluster is rasterised once, where the layout and the node's placement put it: an animated offset / rotation / scale is applied when the cluster is painted (its coverage is sampled bilinearly, so scaling up softens it; at the identity it is as sharp as plain text), a transform written as plain numbers is part of the outline. With per-glyph data the clusters are separate painters composited with `over` (where two clusters' anti-aliased edges share a pixel it is a + b·(1 − a), not the union of the outlines); entries that are all the identity as written draw exactly plain text. An empty array is no per-glyph data; any other length than the number of clusters is E_TEXT_CLUSTER_COUNT (never truncated or padded). The script's `text(…).perGlyph((g, i) => …)` fills it: the host lays the string out with its fonts to count the clusters and records the fonts in `source.imports`. Output window: the display window; glyphs outside it are clipped. The string itself is animatable: `text` takes hold keys (`{ keys: [[frame, "…"], …], interp: "hold" }`; a string cannot be interpolated, so linear keys or an ease are E_IR_PARAM_INVALID), and the string shown at a frame is laid out and rasterised for that frame — a frame counter is `text(t(f => String(f)), …)` in a script. Every key's string is checked (L_GLYPH_MISSING), and with `perGlyph` every key's string must have as many clusters as the list has entries (E_TEXT_CLUSTER_COUNT).

Examples:

```ts
// Title
const title = text("FIREWORKS", { font: "$FONTS/Inter-Bold.ttf", size: 0.08, fill: "#ffffff", position: [0.1, 0.5] });

// Animated size
const pop = text("BOOM", { font: "$FONTS/Inter-Black.ttf", size: keys([[1001, 0.02], [1006, 0.1, ease.out]]), align: "center", position: [0.5, 0.3] });

// Frame counter
const counter = text(t((f) => String(f).padStart(4, "0")), { font: "$FONTS/Inter-Regular.ttf", size: 0.03, position: [0.02, 0.05] });

// Per-character fade-up
const title = text("TITLE", { font: "$FONTS/Inter-Bold.ttf", size: 0.06, position: [0.3, 0.5] }).perGlyph((g, i) => g.animate("opacity", [[1001 + i * 2, 0], [1007 + i * 2, 1]], ease.out).animate("y", [[1001 + i * 2, 0.015], [1007 + i * 2, 0]], ease.out));
```

### `shape`

Rasterise a vector shape model (rect / ellipse / polygon / path with fills and strokes; generator).

Module `lamino-text`, category Text and shapes, output image

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `shape` | shape | none |  |  |  | The shape model (`lamino_core::shape` JSON); built with `shape.rect(…)` etc. in the script. |
| `window` | vec4 | `[0, 0, 0, 0]` |  | width units | yes | Output data window [x0, y0, x1, y1] in width units; [0, 0, 0, 0] = the display window. Set it to draw outside the display (overscan, a larger plate). |
| `position` | vec2 | `[0, 0]` |  | width units | yes | Where the model's anchor lands, [x, y] in width units (`shape::Transform.position`). |
| `rotation` | float | `0` |  | degrees | yes | Rotation about the anchor in degrees, clockwise. |
| `scale` | vec2 | `[1, 1]` |  | factor | yes | Scale [x, y] about the anchor. |
| `anchor` | vec2 | `[0, 0]` |  | width units | yes | Pivot in the model's coordinates, width units. |
| `opacity` | float | `1` | 0 to 1 |  | yes | Multiplies the coverage (0..1). |

`shape` is a `lamino_core::shape::Shape` as JSON (`{ items: [...] }`: Lottie-aligned vocabulary — groups, paths, rect / ellipse / polygon (star), solid / linear / radial fills with spread, strokes with width / join / cap / miter / dash, trim, repeater, transforms, fill rule, clips). Painters (`fill`, `stroke`) inside the model are the only source of colour: a model without a painter draws nothing. The script builders `shape.rect / ellipse / polygon / path` write groups of geometry + painters. Coverage is rasterised on the CPU (`NodeDef.prepare`, `CpuPrepare`; tiny-skia, 8-bit coverage) at the evaluated proxy resolution directly (within one pixel of anti-aliasing of a downsampled full-resolution raster) and uploaded as an extra input slot; the kernel then colours it in scene-linear float: numeric colours are working-space linear, `#hex` strings are sRGB through the colour config's `color_picking` role, gradients interpolate in linear light. The coverage cache key holds the transformed geometry, stroke, fill rule, PAR, raster window / origin, proxy factor and `rasterVersion` (bumped when the rasteriser changes). Each fill / stroke (painter) stores the coverage of its own bounding box, and coverage whose outline in pixels did not change is not rasterised again on later frames. Limits (E_RESOURCE_LIMIT, decided for the full-resolution comp before anything is rasterised, so a proxy never passes what full resolution refuses): at most 8192 painters, and their bounding boxes must fit the coverage atlas (12 layers of at most 8192 × 8192 px). `position`, `rotation`, `scale`, `anchor` and `opacity` compose a `shape::Transform` on top of the model (`T(position) · R(rotation) · S(scale) · T(−anchor)`; opacity multiplies the coverage); they are animatable. Pixel aspect: the model is drawn in square space, so on a pixel grid with PAR ≠ 1 its x is scaled by 1 / PAR about the anchor and sizes, stroke widths, glyphs and rotations keep their displayed proportions (a circle is an ellipse on the grid and a circle on screen); `position` stays a grid coordinate (x 0..1 across the frame). The model is in comp width units (origin top-left), so with the default transform it is drawn where its coordinates say (with PAR ≠ 1 a model x of 1.0 lands at 1 / PAR of the frame width: place shapes with `position`). **Animation inside the model**: any number or array of numbers in the model may be an animation (`{ keys, interp }`), resolved at the frame before the model is drawn; a path's or mask's `vertices` is keyed as a whole path (After Effects' model): each key is the compact vertex list `[x, y, inX, inY, outX, outY, …]` (tangents relative to their vertex), and linear interpolation needs the same vertex count at every key (E_IR_PARAM_INVALID otherwise; `hold` keys may change it). A node with an animation in its model is frame-dependent; a static model is time-invariant. **Roto masks**: a `mask` item is a closed path with `mode` (add / subtract / intersect / difference / lighten / darken / none), `inverted`, `opacity`, `feather`, `expansion` (width units) and `falloff` (smooth / linear); a `fill` that paints masks paints their combined matte (AE's mode arithmetic, `lamino_core::shape::MaskMode`; the stack starts opaque when its first mask subtracts, intersects or darkens). Coverage of a mask: s = the signed distance (square pixels; positive inside, by the fill's rule) to the flattened outline, s' = s + expansion, w = max(feather, 1 px), t = clamp(0.5 + s'/w, 0, 1), coverage = t²(3 − 2t) (smooth) or t (linear): the feather is centred on the expanded outline, half inside, half outside; expansion grows corners round. Feather and expansion are measured on the output picture (not scaled by `scale` or group transforms); the matte is 8-bit coverage like every painter. The script builds them with `shape.mask(path, { … })` and `shape.roto([masks], { color })`. **Output window**: `window` = [x0, y0, x1, y1] in width units (positional, like `position`: x 0..1 across the frame, y in width units) declares the data window, so a mask for an overscan plate or a plate larger than the comp is not clipped (pixels that overlap the box are kept, rounded outward at full resolution and scaled down at a proxy); [0, 0, 0, 0] (the default) = the display window, geometry outside it is clipped. A box with x1 ≤ x0 or y1 ≤ y0 or a non-finite value is E_IR_PARAM_RANGE. Not muteable: a generator.

Examples:

```ts
// Rounded box
const box = shape(shape.rect(0.3, 0.1, { roundness: 0.02, fill: "#202020" }), { position: [0.5, 0.28] });

// Outline
const ring = shape(shape.ellipse(0.2, 0.2, { fill: null, stroke: [1, 0.8, 0.2], strokeWidth: 0.004 }), { position: [0.5, 0.28] });

// Roto mask
const matte = shape(shape.roto([shape.mask(keys([[1001, [[0.3, 0.2], [0.6, 0.25], [0.5, 0.5]]], [1024, [[0.35, 0.2], [0.65, 0.3], [0.5, 0.55]]]]), { feather: 0.01, expansion: 0.002 })]), { window: [-0.05, -0.05, 1.05, 0.6125] });
const cut = merge(plate, matte, { op: "in" });

// AE mask data
// AE mask vertices / tangents are layer pixels: divide x and y by the comp width (here the 2160×1440 layer sits 1:1 at the comp origin)
const W = 1920;
const wu = (v) => v.map((n) => n / W); // [x, y, inX, inY, outX, outY] per vertex
// aePath(f): the exported vertex list of frame f; Mask Feather 30 px, Mask Expansion -2 px
const matte = shape(shape.roto([
  shape.mask(t((f) => aePath(f).map(wu)), { feather: 30 / W, expansion: -2 / W }),
  shape.mask([[0, 0], [2160 / W, 0], [2160 / W, 1440 / W], [0, 1440 / W]], { mode: "intersect", feather: 40 / W }),
]), { window: [0, 0, 2160 / W, 1440 / W] });
```

### `lottie`

Play a Lottie / Bodymovin JSON animation (generator).

Module `lamino-text`, category Text and shapes, output image

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `path` | path | none |  |  |  | Alias path of the Bodymovin JSON. |
| `frameOffset` | int | `0` |  | frames |  | Added to the comp frame to get the file frame. |
| `loop` | bool | `false` |  |  |  | Wrap to the first animation frame after the last one (otherwise hold the last). |
| `position` | vec2 | `[0, 0]` |  | width units | yes | Where the model's anchor lands, [x, y] in width units (`shape::Transform.position`). |
| `rotation` | float | `0` |  | degrees | yes | Rotation about the anchor in degrees, clockwise. |
| `scale` | vec2 | `[1, 1]` |  | factor | yes | Scale [x, y] about the anchor. |
| `anchor` | vec2 | `[0, 0]` |  | width units | yes | Pivot in the model's coordinates, width units. |
| `opacity` | float | `1` | 0 to 1 |  | yes | Multiplies the coverage (0..1). |

Parsed with velato's Lottie schema (`lamino-lottie`; vello is not a dependency) into the `lamino_core::shape` vocabulary per frame (Lottie pixels divided by the animation width become width units), then rasterised. Coverage is rasterised on the CPU (`NodeDef.prepare`, `CpuPrepare`; tiny-skia, 8-bit coverage) at the evaluated proxy resolution directly (within one pixel of anti-aliasing of a downsampled full-resolution raster) and uploaded as an extra input slot; the kernel then colours it in scene-linear float: numeric colours are working-space linear, `#hex` strings are sRGB through the colour config's `color_picking` role, gradients interpolate in linear light. The coverage cache key holds the transformed geometry, stroke, fill rule, PAR, raster window / origin, proxy factor and `rasterVersion` (bumped when the rasteriser changes). Each fill / stroke (painter) stores the coverage of its own bounding box, and coverage whose outline in pixels did not change is not rasterised again on later frames. Limits (E_RESOURCE_LIMIT, decided for the full-resolution comp before anything is rasterised, so a proxy never passes what full resolution refuses): at most 8192 painters, and their bounding boxes must fit the coverage atlas (12 layers of at most 8192 × 8192 px). `position`, `rotation`, `scale`, `anchor` and `opacity` compose a `shape::Transform` on top of the model (`T(position) · R(rotation) · S(scale) · T(−anchor)`; opacity multiplies the coverage); they are animatable. Pixel aspect: the model is drawn in square space, so on a pixel grid with PAR ≠ 1 its x is scaled by 1 / PAR about the anchor and sizes, stroke widths, glyphs and rotations keep their displayed proportions (a circle is an ellipse on the grid and a circle on screen); `position` stays a grid coordinate (x 0..1 across the frame). Time: animation frame = ip + (frame + frameOffset − first comp frame) · fr / fps, i.e. the animation starts at the first comp frame (frame 1 when the comp declares none) and runs at its own frame rate; past op it holds the last frame, or wraps to ip when `loop` is true. Colours in the file are sRGB and go through the colour config like `#hex` strings. Features the parser does not support (expressions, effects, some mattes, …) lint L_LOTTIE_UNSUPPORTED and are skipped — the output is then incomplete, never guessed. The JSON file is hashed into `lamino.lock` and the cache key. Output window: the display window.

Examples:

```ts
// Lower third
const lt = lottie("$ASSETS/lower_third.json", { frameOffset: 12, position: [0.05, 0.4] });
```

## 3D

### `camera`

A camera from an EXR header or a `lamino-camera-v1` JSON — a planning-time value for the 3D nodes.

Module `lamino-3d`, category 3D, output camera

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `path` | path | none |  |  |  | Alias path of the `lamino-camera-v1` JSON or the camera EXR (sequence with `####`, or a still for a static camera). |
| `fit` | enum | `"file"` |  |  |  | Gate fit: `file` keeps the file's, the others override it (perspective cameras only). Values: `file` `horizontal` `vertical` `fill` `overscan` |
| `metersPerUnit` | float | `0` | 0 or more | m |  | Metres per file length unit; 0 = from the file (metersPerUnit / unit, else 1), > 0 overrides. |
| `frameOffset` | int | `0` |  | frames |  | Added to the comp frame to get the file frame. |

Output port `camera` carries no image: the evaluator resolves this node per frame to a `lamino_core::camera::CameraFrame` and injects it into the consumers' `camera` parameters (`ParamKind::Camera`, written in the IR as this node's id). The model: `cameraToWorld` 4×4 column-major in the OpenGL convention (right-handed, Y up, −Z forward, metres) and a projection that is either perspective (`focalLengthMm`, `sensorMm`, `fit`, `lensShift`, `near`, `far`) or a matrix (`worldToNdc`), plus `renderAspect` (pixel W/H) and `par`. `path` is a `lamino-camera-v1` JSON or an EXR (`####` sequence). The JSON layout: `{ "schema": "lamino-camera-v1", "unit": "m", "renderAspect": 1.7778, "frames": { "1001": { "cameraToWorld": [16 numbers], "focalLengthMm": 35, "sensorMm": [36, 24] } } }`: `frames` is an object keyed by frame number (not an array) and the lens values sit directly in each frame record; `lamino schema --camera` prints the full JSON Schema with a minimal example. Exporter scripts for Blender and Cinema 4D (`blender_export_camera.py`, `c4d_export_camera.py`; axis, up-vector and handedness conversions happen on the export side) ship in `contrib/` next to the lamino executable (`lamino --version` prints its location). An EXR camera is a file whose header matches a renderer profile of `CAMERA_HEADER_PROFILES` (Arnold `worldToCamera` + `worldToNDC`; Redshift / Octane to confirm) — camera-looking attributes in any other layout are E_IMAGE_FORMAT, nothing is guessed. A file with matrices but no lens data yields a `matrix` projection used exactly as such; features needing a physical lens are then errors. `fit`: `file` keeps the file's gate fit (`CameraLoadOptions.fit = None`); horizontal / vertical / fill / overscan override it for perspective frames (an error on a matrix camera; formulas in `lamino_core::camera`). `metersPerUnit`: 0 = from the file (`metersPerUnit` / `unit`, else 1); > 0 overrides it; applied **once** at import to the translation and near / far, never to the millimetre lens values. Frames are exact (no interpolation, no hold): a frame the file lacks is an error of this node. The one exception is a **static** camera: a JSON file with exactly one frame, or a still EXR (no `####`), is used on every comp frame and lints L_CAMERA_STATIC (info); an EXR `####` pattern stays exact even when one file exists. `frameOffset` is added to the comp frame to pick the file frame (no effect on a static camera). A JSON file may also hold named 3D `points` (the camera's axes and unit): `camera(file).point(name)` in the script gives one to `project()`; a file with points and no camera frames is valid for that use only. Depth produced by the 3D nodes is the camera-plane distance in metres, +inf where nothing is drawn. The camera file is hashed into `lamino.lock` and the cache key deps.

Examples:

```ts
// Render camera
const cam = camera("$SHOTS/SHOW/010/render/beauty.####.exr", { metersPerUnit: 0.01 });

// Exported JSON
const cam = camera("$SHOTS/SHOW/010/cam/shot_cam.json", { fit: "horizontal" });
```

### `card3d`

Place an image on a card in 3D and render it through a camera (image + depth).

Module `lamino-3d`, category 3D, output image

- Input `in` (image): The image mapped onto the card (premultiplied).

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `camera` | camera | none |  |  |  | The `camera` node the card is seen through. |
| `position` | vec3 | `[0, 0, -1]` |  | m | yes | Card centre in world space, metres. |
| `rotation` | vec3 | `[0, 0, 0]` |  | degrees | yes | Euler angles in degrees, extrinsic X → Y → Z (R = Rz·Ry·Rx). |
| `scale` | vec3 | `[1, 1, 1]` |  | factor | yes | Scale about the card centre. |
| `width` | float | `1` | 0.000001 or more | m | yes | Card width in metres (> 0); the height is width · H / (W · par) of the layer's display window. |
| `backface` | bool | `true` |  |  |  | Draw the card when it faces away from the camera. |
| `filter` | enum | `"bilinear"` |  |  |  | Texture filter when sampling the layer (`render3d::Filter3d`). Values: `nearest` `bilinear` `bicubic` |

One quad with its pivot at the card centre (`lamino_core::render3d`), `width` metres wide and `width · H / (W · par)` high (the comp's display window and pixel aspect, which every layer shares; overscan is not shown — an asset of another resolution sits 1:1 at the comp's origin, so fit it to the comp with `transform` before `card3d`), placed by `T(position) · Rz · Ry · Rx · S(scale)` (position in metres, rotation in degrees, extrinsic X → Y → Z), and rasterised through `camera` with perspective-correct UVs and the chosen `filter`; geometry in front of the near plane is clipped, nothing at far; the back face is drawn unless `backface` is false. Edges are anti-aliased: the colour is multiplied by the card's analytic coverage of the pixel (the box-filtered area of each projected edge, about one pixel wide; the near-plane cut included), and the layer's border texels are extended instead of fading to transparent, so the coverage alone shapes the edge. Where one output pixel spans more than one texel the layer is box-filtered over the pixel's footprint (taps one texel apart along both pixel axes, up to 17 per axis; a card minified more than 17× per axis is sampled sparsely); at or below one texel per pixel a single `filter` tap is taken. Outputs: `out` — premultiplied RGBA over the display window (transparent where the card is absent) — and `depth` (`card.depth` in the script, `"<id>:depth"` in the IR) — R = the camera-plane distance in metres of the card's plane at the pixel centre wherever the coverage is above 0 (partially covered edge pixels included, never blended with the background), +inf elsewhere, A = 1 where drawn. The camera is a planning-time value: the `camera` parameter holds the id of a `camera` node and the evaluator resolves it per frame. Deterministic (the first `Render3d` implementation); CPU and GPU agree within the filter tolerance. Cannot be muted (the layer is a texture, not a screen-space image). Output window: the display window.

Examples:

```ts
// A plate on a card
const card = card3d(plate, { camera: cam, position: [0, 1.2, -4], rotation: [0, 15, 0], width: 3.2 });

// Fog from the card's depth
const foggy = fog(card, card.depth, { near: 2, far: 12 });
```

### `stack3d`

Render several cards through one camera with a per-pixel depth sort (correct intersections).

Module `lamino-3d`, category 3D, output image

| Parameter | Type | Default | Range | Unit | Keys | Description |
|---|---|---|---|---|---|---|
| `camera` | camera | none |  |  |  | The `camera` node the cards are seen through. |
| `cards` | json | none |  |  |  | Array with one placement per connected input: { position, rotation, scale, width, backface, filter } as in `card3d`. |

The inputs are the layer images of up to 8 cards (`MAX_INPUT_SLOTS`); `cards[i]` places input i with the `card3d` parameters (`position`, `rotation`, `scale`, `width`, `backface`, `filter`; omitted keys take `card3d`'s defaults). All cards are rasterised through `camera` and, **per pixel**, sorted by camera-plane distance and composited back to front with `over` (equal depths keep input order, a later input on top) — intersecting cards are therefore correct pixel by pixel, which a chain of pairwise merges cannot do. Translucent intersections are ordered per pixel, not deep-composited. Every card has `card3d`'s anti-aliased edges and minification filter: a card enters the sort wherever its coverage is above 0, with its plane's depth at the pixel centre and its colour times the coverage. Outputs: `out` (premultiplied RGBA over the display window) and `depth` (the nearest card's camera-plane distance in metres, +inf where nothing is drawn). The script's `stack3d([cards], { camera })` accepts `card3d` nodes (their layer input and placement are lifted into this node and the `card3d` node leaves the IR when nothing else uses it) or plain `{ layer, position, … }` specs; the camera defaults to the first card's. Cannot be muted. Output window: the display window.

Examples:

```ts
// Parallax layers
const scene = stack3d([card3d(sky, { camera: cam, position: [0, 0, -20], width: 40 }), card3d(trees, { camera: cam, position: [0, -1, -6], width: 12 }), card3d(hero, { camera: cam, position: [0.3, -0.8, -3], width: 2 })]);
```

## Compositing

### `zMerge`

Composite two images by per-pixel depth: the nearer pixel goes over the farther one.

Module `lamino-3d`, category Compositing, output image, pointwise (fused with its neighbours)

- Input `a` (image): First image (premultiplied).
- Input `aDepth` (data): Depth of `a` (camera-plane metres in R, +inf = empty).
- Input `b` (image): Second image (premultiplied).
- Input `bDepth` (data): Depth of `b`.

For every pixel the input with the smaller depth is in front and `over` is applied once (front + back · (1 − front.a), every channel); +inf means nothing there and loses to any finite depth; equal depths put A over B. Depths are camera-plane distances in metres read from R: `card3d` / `stack3d` (`card.depth`) or a renderer's depth AOV (`aov(..., { kind: "depth" })`). The order comes from the two depth values alone: translucent surfaces that intersect within a pixel are not deep-composited — for several cards use `stack3d`, which sorts them together. Outputs: `out` and `depth` (the per-pixel minimum). Output data window: the union of the inputs' windows (depth reads +inf outside its window). Muting passes B through (like `merge`, the background survives).

Examples:

```ts
// Card into a render
const comp = zMerge(card, card.depth, beauty, z);   // z = aov(exr, { layer: "Z", kind: "depth", units: "m" })
```
