xyz2lab: CIE XYZ to LAB Color Space Conversion
Perceptually Uniform Color Representation
The xyz2lab
function transforms CIE XYZ coordinates into the LAB color space, where equal distances correspond to equal perceived color differences. This transformation applies the CIE LAB formula with D65 illuminant normalization.
Mathematical Foundation
The conversion applies three stages of transformation. First, values are normalized by the D65 white point:
Then the cube root function or linear approximation is applied:
Finally, LAB coordinates are computed:
LAB Components Visualization
Live Editor
const fragment = () => { const X = uv.x.mul(100) const Y = uv.y.mul(100) const Z = float(50) const xyzColor = vec3(X, Y, Z) const labColor = xyz2lab(xyzColor) return vec4(labColor.normalize(), 1) }