cosineRainbow

A smooth rainbow color from a value that wraps every 1.

cosineRainbow(t: Expr, phases: [number, number, number]): Expr

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

phases offset the red, green and blue cycles; [0, 1/3, 2/3] is the full spectrum. The color behind holographic foil and thin-film iridescence.

Parameters

NameTypeNotes
tExpr
phases[number, number, number]

Example

const rgb = cosineRainbow(mul(grazing, 3), [0, 1 / 3, 2 / 3])

See also

  • tintRamp — Maps a lighting value (0 dark, 1 light) onto two colors.

Used by

Holographic