Skip to content

Instantly share code, notes, and snippets.

@riklomas
Created November 8, 2020 20:57
Show Gist options
  • Save riklomas/181e49a3eb171b64c82d8b3aa161b55f to your computer and use it in GitHub Desktop.
Save riklomas/181e49a3eb171b64c82d8b3aa161b55f to your computer and use it in GitHub Desktop.
hsv2rgb.glsl
vec3 hsv2rgb(float h, float s, float v) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(h + K.xyz) * 6.0 - K.www);
return v * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment