spectralLens

Fan the child out into many color-shifted copies through a warped lens, the spectral-lens look.

spectralLens(slots: SpectralLensSlots): (params: GpuFragmentParams) => Expr

Import effects from shaders/std and use effects.lens.spectralLens.

A whole fragment for a gpu: definition; the child is read as a texture. count copies spread along angle around center, dispersion colors them across the spectrum, the focus slots fade the split near the center and the edges, lensBulge and lensCircle warp the whole image, and swirl, noise and the grain slots scatter it. Every slot is a prop ref; the field list on SpectralLensSlots gives units and ranges.

Parameters

NameTypeNotes
slotsSpectralLensSlots

Example

gpu: {fragment: spectralLens({center: p('center'), spread: p('spread'), bias: p('bias'), angle: p('angle'), perspective: p('perspective'), count: p('count'), dispersion: p('dispersion'), dispersionShift: p('dispersionShift'), dispersionColor: p('dispersionColor'), focusCenter: p('focusCenter'), focusEdges: p('focusEdges'), swirl: p('swirl'), noise: p('noise'), noiseFrequency: p('noiseFrequency'), noiseOffset: p('noiseOffset'), lensBulge: p('lensBulge'), lensCircle: p('lensCircle'), grainMixer: p('grainMixer'), grainOverlay: p('grainOverlay')})}

Tip. Every pixel samples the child count times, and phones cap count at 24. Keep it low on large canvases.

See also

  • chromaticFan — Split the child into red, green and blue copies pushed apart along one direction.

Used by

LensDistortion