div
The first value divided by the second.
div(a: Val, b: Val): Expr
Import math from shaders/std and use math.div.
Dividing by zero produces infinity on the GPU, so guard a prop with max first.
Parameters
| Name | Type | Notes |
|---|---|---|
a | Val | |
b | Val |
Example
const normalized = div(dist, max(params.uniforms.radius, 0.001))
See also
Used by
Aurora, CarbonFiber, Chrome, CompressionArtifacts, Crystal, FlowingGradient, Frost, Goo, Heatmap, Hologram, Holographic, Irradiance, Marble, MeshGradient, Plastic, Prism, ReactionDiffusion, Sparkle, StudioBackground, TimeTrail, Water, Waveform