smoothstep

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

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

NameTypeNotes
e0Val
e1Val
xVal

Example

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

See also

  • step — A hard edge: 0 when x is below edge, 1 from edge on.
  • mix — A blend from a to b by t, where 0 gives a and 1 gives b.

Used by

Aurora, Blob, CarbonFiber, Chrome, Crystal, FlowingGradient, Frost, Goo, Heatmap, Hologram, Holographic, Irradiance, LiquidMetal, Marble, MeshGradient, Nebula, Obsidian, Plastic, Prism, ReactionDiffusion, Sparkle, StudioBackground, Voxels, Water, Waveform