spectralWeight

The colour one slice of the visible spectrum adds to white light, as linear rgb weights.

spectralWeight(t: Expr): Expr

Import materials from shaders/std and use materials.spectralWeight.

t runs from 0 (deep red) to 1 (violet). Evenly spaced slices sum to white once divided by their summed weights, which is what spectralSum does. The weights never go negative.

Parameters

NameTypeNotes
tExpr

Example

const tint = spectralWeight(0.5) // a green slice

See also

  • spectralSum — Light seen across the whole visible spectrum, added up slice by slice into one rgb colour.
  • cosineRainbow — A smooth rainbow color from a value that wraps every 1.