---
title: "surfacePattern"
description: "Coordinates for a pattern that sticks to the shape's surface."
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#L403"
---

# surfacePattern

Coordinates for a pattern that sticks to the shape's surface.

```ts
surfacePattern(frame: SurfaceFrame, field: SurfaceField, opts: {uv?: Expr} = {}): Expr
```

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

On a flat shape they are the placement coordinates centred on the shape (0,0 at its centre). On a 3D shape they follow the surface as it rotates, when the effect declares `pattern: 'raw'` or `'triplanar'`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `frame` | `SurfaceFrame` |  |
| `field` | `SurfaceField` |  |
| `opts` | `{uv?: Expr}` | Optional. Default `{}`. |

## Example

```ts
const pat = surfacePattern(frame, field)
```

## See also

- [`shapedSurface`](/docs/primitives/materials/shapedsurface) — Turns a shape prop into a surface your material shades.
- [`rotationSensor`](/docs/primitives/materials/rotationsensor) — How far a 3D shape has rotated, as a 2D pan you can move content by.
- [`surfaceNoiseAt`](/docs/primitives/materials/surfacenoiseat) — `surfaceNoise` at a 2D point you already hold.

## Used by

[BrushedMetal](/docs/components/brushedmetal), [CarbonFiber](/docs/components/carbonfiber), [Chrome](/docs/components/chrome), [Crystal](/docs/components/crystal), [Frost](/docs/components/frost), [Holographic](/docs/components/holographic), [LiquidMetal](/docs/components/liquidmetal), [Obsidian](/docs/components/obsidian), [Plastic](/docs/components/plastic), [Water](/docs/components/water)