---
title: "grainNoise"
description: "One octave of smooth signed noise along and across a direction, for grain."
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#L524"
---

# grainNoise

One octave of smooth signed noise along and across a direction, for grain.

```ts
grainNoise(
  coords: {along: Expr; across: Expr},
  opts: {freq: [Expr | number, Expr | number]; offset?: [number, number]; drift?: Expr},
): Expr
```

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

`coords` come from `directionFrame(...).coordsOf(p)`. `freq` sets the feature density per axis (a high across value gives fine streaks). Returns roughly −1 to 1. Sum octaves and apply gains at the call site.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `coords` | `{along: Expr; across: Expr}` |  |
| `opts` | `{freq: [Expr \| number, Expr \| number]; offset?: [number, number]; drift?: Expr}` |  |

## Example

```ts
const sheen = grainNoise(brush.coordsOf(pat), {freq: [1.3, 6.5], drift: driftA})
```

## See also

- [`surfaceNoise`](/docs/primitives/materials/surfacenoise) — Smooth signed noise at a 2D point, roughly −1 to 1, with features about one unit wide.
- [`tiltNormal`](/docs/primitives/materials/tiltnormal) — Tilts a normal along and across a direction, for brushed or woven relief.
- [`smearAlong`](/docs/primitives/materials/smearalong) — Blurs any 2D lookup along a direction, for streaked reflections and motion smear.

## Used by

[BrushedMetal](/docs/components/brushedmetal), [Satin](/docs/components/satin)