add

The sum of two values.

add(a: Val, b: Val): Expr

Import math from shaders/std and use math.add.

Works on numbers and on vectors of the same size.

Parameters

NameTypeNotes
aVal
bVal

Example

const lifted = add(mul(noise, 0.5), 0.5) // a −1..1 signal moved into 0..1

See also

  • sub — The first value minus the second.
  • mul — The product of two values.

Used by

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