---
title: "pixelGrid"
description: "Frames a field on the pixel grid: one value per block of `grain` device pixels."
group: "light"
groupTitle: "Noise, light & materials"
categoryId: "noise"
categorySlug: "noise"
categoryTitle: "Noise"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/paint/noise.ts#L453"
---

# pixelGrid

Frames a field on the pixel grid: one value per block of `grain` device pixels.

```ts
pixelGrid(field: Field, slots: {grain: PropRef; seed: PropRef}): Field
```

Import `noise` from `shaders/std` and use `noise.pixelGrid`.

For patterns that live on pixels rather than on the canvas (blue noise, dither). `grain` is the block size in pixels (1 = every pixel), `seed` picks a different block of the pattern. The field inside gets whole-number pixel coordinates.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `field` | `Field` |  |
| `slots` | `{grain: PropRef; seed: PropRef}` |  |

## Example

```ts
paint: rampOver(noiseTone(pixelGrid(blueSpeckle(), {grain: p('grain'), seed: p('seed')}), {contrast: p('contrast'), balance: p('balance')}), stops(p('colorSpace')))
```

## See also

- [`blueSpeckle`](/docs/primitives/noise/bluespeckle) — Fine, even speckle with no clumps: blue noise, one random value per pixel block.
- [`seededPlane`](/docs/primitives/noise/seededplane) — Frames a field on a zoomable plane: how big the pattern is and where it starts.

## Used by

[BlueNoise](/docs/components/bluenoise)