clamp
The value limited to the range lo..hi.
clamp(x: Val, lo: Val, hi: Val): Expr
Import math from shaders/std and use math.clamp.
Parameters
| Name | Type | Notes |
|---|---|---|
x | Val | |
lo | Val | |
hi | Val |
Example
const alpha = clamp(add(body, ring), 0, 1)
See also
Used by
Aurora, BrushedMetal, CarbonFiber, Chrome, CompressionArtifacts, Crystal, FlowingGradient, Frost, Goo, Heatmap, Hologram, Holographic, InkFlow, LiquidMetal, MeshGradient, Nebula, PixelThrow, Plastic, Prism, ReactionDiffusion, Satin, SmokeFill, StudioBackground, Surface3D, Voxels, Water, Waveform