---
title: "smoothstep"
description: "A soft edge: 0 below `e0`, 1 above `e1`, an S-curve between."
group: "space"
groupTitle: "Shapes, frames & warps"
categoryId: "math"
categorySlug: "math"
categoryTitle: "Math"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/math.ts#L294"
---

# smoothstep

A soft edge: 0 below `e0`, 1 above `e1`, an S-curve between.

```ts
smoothstep(e0: Val, e1: Val, x: Val): Expr
```

Import `math` from `shaders/std` and use `math.smoothstep`.

The everyday word for turning a distance into a soft mask. Swap `e0` and `e1` to fade the other way.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `e0` | `Val` |  |
| `e1` | `Val` |  |
| `x` | `Val` |  |

## Example

```ts
const coverage = sub(1, smoothstep(radius, add(radius, softness), dist)) // 1 inside, fading out
```

## See also

- [`step`](/docs/primitives/math/step) — A hard edge: 0 when `x` is below `edge`, 1 from `edge` on.
- [`mix`](/docs/primitives/math/mix) — A blend from `a` to `b` by `t`, where 0 gives `a` and 1 gives `b`.

## Used by

[Aurora](/docs/components/aurora), [Blob](/docs/components/blob), [CarbonFiber](/docs/components/carbonfiber), [Chrome](/docs/components/chrome), [Crystal](/docs/components/crystal), [FlowingGradient](/docs/components/flowinggradient), [Frost](/docs/components/frost), [Goo](/docs/components/goo), [Heatmap](/docs/components/heatmap), [Hologram](/docs/components/hologram), [Holographic](/docs/components/holographic), [Irradiance](/docs/components/irradiance), [LiquidMetal](/docs/components/liquidmetal), [Marble](/docs/components/marble), [MeshGradient](/docs/components/meshgradient), [Nebula](/docs/components/nebula), [Obsidian](/docs/components/obsidian), [Plastic](/docs/components/plastic), [Prism](/docs/components/prism), [ReactionDiffusion](/docs/components/reactiondiffusion), [Sparkle](/docs/components/sparkle), [StudioBackground](/docs/components/studiobackground), [Voxels](/docs/components/voxels), [Water](/docs/components/water), [Waveform](/docs/components/waveform)