Motion SDK

Stylise

Make flat art read as inked and printed - hatching, ink outlines, paper, halftone, speckled colour, line boil and light shafts.

post.stylise draws over the finished frame the way a printmaker would: hatching in the shadows, ink on the edges, paper under everything. Simple flat shapes (an SVG drawing, vector shapes, unlit materials) come out looking hand made. Every effect is 0 (off) until you set it.

"post": {
  "tone_mapping": "none",
  "stylise": {
    "hatch": 0.6, "hatch_threshold": 0.45, "cross_threshold": 0.22,
    "ink": 0.45, "paper": 0.6,
    "posterize": 12, "dither": 0.9,
    "boil": 1.1, "boil_fps": 12
  },
  "rays": {"from": [0.5, 0.45], "strength": 1.4, "threshold": 0.7, "color": "#ffc070"}
}

Hatching

hatch lays parallel ink strokes wherever the image is darker than hatch_threshold (luminance 0..1). Strokes thicken as it gets darker, waver a little and break where the pen lifted. Below cross_threshold a second set crosses them. hatch_scale is the stroke spacing and hatch_angle the direction. hatch_follow (0..1) bends the strokes to run along the forms: around outlines and through soft shading, the way a pen follows a cheek or a fold. Paint the shading in (soft gradient shapes on the shadow side) and the hatching follows it.

Ink, Paper and Print

  • ink: outlines drawn wherever colour changes sharply, ink_width wide, in ink_color. On art that already has outlines it thickens and roughens them.
  • paper: fibres, blotches and a warm tint that break up flat fills. paper_scale sizes them.
  • halftone: printed dots that grow in the shadows (halftone_scale apart).
  • posterize: reduce colour to this many steps. Add dither (0..1) to speckle the steps with noise: soft gradients like a blush or a glow turn into grainy, printed-looking dots.
  • ramp: a gradient map [dark, light], mixed in by ramp_amount.

Line Boil

boil wobbles the whole frame by a few pixels, re-drawn boil_fps times a second (12 is on twos). The hatching and paper jitter with it, so a still drawing looks freshly traced on every frame. For noise on one value (a hand-held camera, a flickering lamp), use a track's wiggle.

Light Shafts

post.rays streams light from a point on screen (from, [0, 0] top left to [1, 1] bottom right) through everything brighter than threshold: rays through a doorway, sun through mist. length is how far they reach and color tints them.

Keeping Captions Crisp

Set "overlay": true on a node (a caption, a title, a logo) to keep it and its children out of stylise and rays: it is drawn after them, sharp and on top of everything, with the same tone mapping and grade. Depth of field and line boil don't touch it either.

Per Shot

A shot can carry its own stylise and rays: they replace the scene's while that shot plays, so a soft close-up and a hatched wide shot can share one scene.

In TypeScript

inked(overrides) from @motion-sdk/scene returns the look above as a starting point, and wiggle(amount, options) builds a track's wiggle:

import { inked, track, wiggle } from "@motion-sdk/scene";

const post = { tone_mapping: "none", stylise: inked({ hatch: 0.8 }) };
const shake = track("camera_rig", "rotation", [], { wiggle: wiggle([0, 0, 1.5], { frequency: 4 }) });

Where it Runs

Native rendering and export (the CLI) have it, and in the browser the authoring bundle and the WebGL2 fallback do: createPlayer loads the authoring bundle for any scene that uses stylise, rays, overlay or wiggle. The small WebGPU player bundle leaves it out.

For a low-resolution game look with a fixed palette, see Pixel Art.

API Reference

Stylise

Hand-drawn look applied to the whole frame after tone mapping. Every effect is off at 0, so set only the ones you want.

PropertyTypeDefaultDescription
boilnumber (0 to 16)0Line boil: the frame wobbles by up to this many pixels (at 1080p height), re-drawn boil_fps times a second, like hand-drawn lines traced again on every drawing. 0 = off.
boil_fpsnumber (1 to 60)12How often the boil (and the hatch and paper jitter) changes.
cross_thresholdnumber (0 to 1)0.22Luminance below which a second, crossing set of strokes is added.
dithernumber (0 to 1)0Speckle the steps of posterize with noise, 0..1, so soft gradients (blush, glow) break up into grainy, printed-looking dots.
halftonenumber (0 to 1)0Halftone dots in the mid tones and shadows, 0..1.
halftone_scalenumber (2 to 64)8Dot grid spacing in pixels at 1080p height.
hatchnumber (0 to 1)0Ink hatching in the shadows, 0..1: parallel strokes whose width grows as the image gets darker.
hatch_anglenumber35Stroke direction in degrees (0 = horizontal).
hatch_follownumber (0 to 1)0How much hatching turns to follow the forms, 0..1: strokes bend to run along shapes' outlines and shading (like a pen following a cheek or a fold) instead of all lying at hatch_angle.
hatch_scalenumber (2 to 64)7Spacing between hatch strokes in output pixels at 1080p height.
hatch_thresholdnumber (0 to 1)0.45Luminance (0..1) below which hatching starts.
inknumber (0 to 1)0Ink outlines found from edges in the frame, 0..1.
ink_colorColor"#120b14"Ink color for strokes, outlines and halftone dots.
ink_widthnumber (0.5 to 8)1.5Outline width in pixels at 1080p height.
papernumber (0 to 1)0Paper texture, 0..1: fibres and blotches that tint and break up flat fills.
paper_scalenumber (0.1 to 10)1Paper texture size (1 = default).
posterizeinteger (0 to 16)0Reduce each channel to this many levels (0 = off, 2..16).
rampColor[]—Gradient map: luminance remapped from [dark, light], mixed in by ramp_amount.
ramp_amountnumber (0 to 1)1How much of the gradient map to mix in, 0..1.

Rays

Light shafts (god rays) streaming from a point on screen through the bright parts of the frame.

PropertyTypeDefaultDescription
colorColor"#ffffff"Tint of the shafts (white keeps the source colours).
from[x, y][0.5,0.3]Light position on screen: [0, 0] top left, [1, 1] bottom right (may lie outside the frame).
lengthnumber (0 to 1)0.6How far the shafts reach, as a fraction of the way to the light.
strengthnumber (0 to 4)1Brightness of the shafts, 0..4.
thresholdnumber (0 to 4)0.7Luminance above which pixels cast shafts.