---
title: "softPlus"
description: "A soft hinge: about 0 for values well below zero, about `x` above, rounded near zero."
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#L579"
---

# softPlus

A soft hinge: about 0 for values well below zero, about `x` above, rounded near zero.

```ts
softPlus(x: Expr, k: Val): Expr
```

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

`k` is the width of the rounded corner. Use it where a hard `max(x, 0)` would show a visible crease.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `x` | `Expr` |  |
| `k` | `Val` |  |

## Example

```ts
const past = local(softPlus(sub(beam.along, beam.length), mul(softness, 0.6)), 'past')
```

## See also

- [`max`](/docs/primitives/math/max) — The larger of two values.
- [`smoothstep`](/docs/primitives/math/smoothstep) — A soft edge: 0 below `e0`, 1 above `e1`, an S-curve between.

## Used by

[Prism](/docs/components/prism)