---
title: "spectralLens"
description: "Fan the child out into many color-shifted copies through a warped lens, the spectral-lens look."
group: "effects"
groupTitle: "Filters & effects"
categoryId: "effects.lens"
categorySlug: "effects-lens"
categoryTitle: "Lens"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/effects/lens.ts#L137"
---

# spectralLens

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

```ts
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

| Name | Type | Notes |
|---|---|---|
| `slots` | `SpectralLensSlots` |  |

## Example

```ts
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`](/docs/primitives/effects-lens/chromaticfan) — Split the child into red, green and blue copies pushed apart along one direction.

## Used by

[LensDistortion](/docs/components/lensdistortion)