Skip to content

Spectrum — colour along the frequency axis

spectrum is the one line system on this surface, and it uses the palette for something the shader scenes cannot: it colours by position in frequency, so the gradient becomes a legend. Element i of n samples the LUT at

hue + hue_spread * (i / n)

then crossfades by palette_mix, desaturates by saturation, and scales by brightness — one CPU sample per element per frame, not per pixel.

ParamDefaultWhat it does
hue_spread0.0How far the palette is walked from the lowest element to the highest. 0 = the whole figure is one hue; 1 = the full gradient spans the axis, so you can see where a peak is without counting positions.
hue0.0The offset the walk starts from — rotate the whole readout through the gradient, or drive it off the audio.

Three notes specific to this scene:

  • On radial_ring, hue_spread = 1 walks the gradient exactly once around the circle — the sample coordinate steps evenly from 0 to (n-1)/n, so the last spoke sits one step short of the first and the ring is covered without a repeat. Whether that reads as continuous is a property of the gradient, not of the layout: only a cyclic gradient meets itself at the wrap. spectrum (the cosine) is cyclic; ember, ice, mono and aurora are not — each runs dark to light, so at hue_spread = 1 the ring carries a hard dark/light seam wherever hue currently puts the wrap. Either pick spectrum, write custom stops that return to their starting colour at at = 1.0, or keep the seam deliberately (it marks where the frequency axis begins).
  • hue may be per element. It is one of the five spectrum params that accept a per-element binding, so hue = "bin(index) * 0.4" colours by loudness rather than by position — a different reading of the same figure. hue_spread itself is whole-figure.
  • hue = "index" is not the same walk as hue_spread = 1, and the difference shows on a ring. index normalizes over the span (i/(n-1), so the last element is exactly 1.0), which is what makes bin(index) cover the whole spectrum; hue_spread normalizes over the count (i/n), which is what makes the steps around a closed figure even. Walking hue from 0 to 1 by hand therefore lands the last element on the same colour as the first — a duplicated colour rather than a closed loop. Use hue_spread for a ring, and index when you want the ends to be the ends.

Built from a8ce055 at version 0.115.0. This site tracks main and is not versioned per release.