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
| Name | Type | Notes |
|---|---|---|
e0 | Val | |
e1 | Val | |
x | Val |
Example
const coverage = sub(1, smoothstep(radius, add(radius, softness), dist)) // 1 inside, fading out
See also
step— A hard edge: 0 whenxis belowedge, 1 fromedgeon.mix— A blend fromatobbyt, where 0 givesaand 1 givesb.
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