blur

A blurred copy of a source, read in WGSL by the name you list it under.

blur(source: InputSource, opts: {radius: ScalarArg}): BlurInput

Import blur from shaders/std.

radius is in canvas pixels (a number or a prop). The blur runs at a fixed working resolution, so its cost does not grow with the canvas. Colour comes back with straight alpha, like child.

Parameters

NameTypeNotes
sourceInputSource
opts{radius: ScalarArg}

Example

inputs: {soft: blur(child, {radius: p('softness')})},
effect: wgsl`return mix(child, soft(uv), smoothstep(0.2, 0.6, uv.y));`,

See also

  • bloom — A glow: the child's bright parts spread into a soft halo that adds back on top.
  • downsample — A smaller copy of a source, box-filtered so it does not alias.
  • child — The layer inside this one, as a source for an input.

Keep reading