Skip to main content

hsv2rgb: HSV to RGB Cone Model Transformation

Cone Model Color Space Mathematics

HSV represents colors within a cone where the apex contains black and the base contains pure colors at maximum value. Unlike HSL's double-cone structure, HSV maintains full color intensity at maximum value regardless of saturation.

The transformation formula applies cone geometry:

RGB=((hue2rgb(h)1)×s+1)×v\text{RGB} = ((hue2rgb(h) - 1) \times s + 1) \times v

Where (h,s,v)(h, s, v) represent hue [0,1]\in [0,1], saturation [0,1]\in [0,1], and value [0,1]\in [0,1].

The cone model ensures:

  • v=1,s=1v = 1, s = 1: Pure saturated colors
  • v=1,s=0v = 1, s = 0: White
  • v=0v = 0: Black regardless of hue or saturation
  • Intermediate ss values: Linear interpolation between white and pure color
Live Editor
const fragment = () => {
      const cell = uv.x.mul(uv.y).pow(0.3)
      const hue = cell.add(iTime.mul(0.3)).fract()
      const sat = uv.x.pow(1.5)
      const value = uv.y.pow(0.7).add(0.3)
      const color = hsv2rgb(vec3(hue, sat, value))
      return vec4(color, 1)
}