softPlus

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

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

NameTypeNotes
xExpr
kVal

Example

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

See also

  • max — The larger of two values.
  • smoothstep — A soft edge: 0 below e0, 1 above e1, an S-curve between.

Used by

Prism