bloom

The glow around a source's bright parts, read by name.

bloom(
  source: InputSource,
  opts: {threshold?: ScalarArg; radius?: ScalarArg} = {},
): BloomInput

Import bloom from shaders/std.

threshold is the brightness (0–1, linear luminance) where glow starts; radius is how far it spreads, in canvas pixels. The result holds only the glow, so add it to your colour.

Parameters

NameTypeNotes
sourceInputSource
opts{threshold?: ScalarArg; radius?: ScalarArg}Optional. Default {}.

Example

inputs: {halo: bloom(child, {threshold: 0.7, radius: 40})},
effect: wgsl`return vec4f(child.rgb + halo(uv).rgb * glow, child.a);`,

See also

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