---
title: "sensorGrain"
description: "Adds a fine per-pixel brightness jitter, so rendered light reads as photographed."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "materials"
categorySlug: "materials"
categoryTitle: "Materials & surfaces"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/materials.ts#L1397"
---

# sensorGrain

Adds a fine per-pixel brightness jitter, so rendered light reads as photographed.

```ts
sensorGrain(
  rgb: Expr,
  opts: {amount: Expr | number; pixel: Expr; clock: Expr | number},
): Expr
```

Import `materials` from `shaders/std` and use `materials.sensorGrain`.

Each pixel is scaled by up to half of `amount` either way. `pixel` is the pixel coordinate (uv times the viewport size); `clock` re-rolls the grain each frame.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `rgb` | `Expr` |  |
| `opts` | `{amount: Expr \| number; pixel: Expr; clock: Expr \| number}` |  |

## Example

```ts
const rgb = sensorGrain(glow, {amount: 0.08, pixel: mul(uv, viewport), clock: t})
```

## See also

- [`hashNoise`](/docs/primitives/materials/hashnoise) — Random 0–1 per point, with no smoothness between neighbours.
- [`interleavedNoise`](/docs/primitives/materials/interleavednoise) — A 0–1 dither pattern over device pixels where neighbours differ as much as possible.
- [`exposureTone`](/docs/primitives/materials/exposuretone) — Turns light that piles past 1 into a soft burn toward white, like film.