---
title: "perlinSlope"
description: "The slope of smooth noise at a point, for wavy or molten relief."
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#L850"
---

# perlinSlope

The slope of smooth noise at a point, for wavy or molten relief.

```ts
perlinSlope(q: Expr, gain: Expr | number): Expr
```

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

Returns a 2D slope scaled by `gain` and clamped to ±4, so relief never spikes into seams. Feed its x and y to `nudgeNormal`.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `q` | `Expr` |  |
| `gain` | `Expr \| number` |  |

## Example

```ts
const hg = perlinSlope(pat, 0.62)
const n = nudgeNormal(nGeo, mul(hg.member('x'), -0.5), mul(hg.member('y'), -0.5))
```

## See also

- [`nudgeNormal`](/docs/primitives/materials/nudgenormal) — Tilts a normal by a slope in x and y, turning a height field into relief.
- [`fdSlope`](/docs/primitives/materials/fdslope) — The value and slope of any field at a point: `value`, `dx` and `dy`.
- [`flowWarp`](/docs/primitives/materials/flowwarp) — A slowly folding 2D offset to add to pattern coordinates, for molten or wind-blown motion.

## Used by

[Chrome](/docs/components/chrome), [LiquidMetal](/docs/components/liquidmetal)