downsample

A smaller copy of a source, box-filtered so it does not alias.

downsample(source: InputSource, opts: {scale: number}): DownsampleInput

Import downsample from shaders/std.

Read it by name. Use it to make an expensive read cheap: sample the small copy many times instead of the full one.

Parameters

NameTypeNotes
sourceInputSource
opts{scale: number}

Example

inputs: {small: downsample(child, {scale: 0.25})},

See also

  • blur — A blurred copy of a source, read in WGSL by the name you list it under.
  • pass — Your own WGSL, rendered into a texture every frame before the body runs, read by name: clouds(uv).