Skip to main content

Module spectral_blend

Module spectral_blend 

Source
Expand description

P7.3 — σ spectral blend as interpolation on the spectral manifold. P7.3 — σ spectral blend as interpolation on the spectral manifold.

Blending colours in spectral space (interpolating SPDs) is physically correct: it preserves the spectral power distribution’s structure, unlike RGB lerp which can produce intermediate colours that don’t correspond to any physical spectrum.

§Algorithm

Spectral blend: S_blend(t) = (1-t)·S_a + t·S_b in SPD space, then project to XYZ/RGB.

RGB lerp: RGB_blend(t) = (1-t)·RGB_a + t·RGB_b in sRGB space.

The divergence between the two is the ΔE of their XYZ projections.

§Determinism

All operations are deterministic: SPD lerp is a pure function, and the CMF projection is a compile-time constant.

Functions§

blend_divergence
Compute the ΔE divergence between spectral blend and gamma-encoded sRGB lerp at parameter t.
rgb_lerp
RGB lerp in linear sRGB space (for comparison with spectral blend).
spectral_blend_emf
Blend two EMF payloads in spectral space and return the resulting XYZ.
spectral_blend_spd
Blend two SPDs in spectral space: S(t) = (1-t)·a + t·b.