LYGIA Shader Library

hsv2rgb (lygia/color/space/hsv2rgb)

Convert from HSV to linear RGB

Dependencies:

Use:

<vec3|vec4> hsv2rgb(<vec3|vec4> hsv)

Check it on Github


#ifndef FNC_HSV2RGB
#define FNC_HSV2RGB
vec3 hsv2rgb(const in vec3 hsv) { return ((hue2rgb(hsv.x) - 1.0) * hsv.y + 1.0) * hsv.z; }
vec4 hsv2rgb(const in vec4 hsv) { return vec4(hsv2rgb(hsv.rgb), hsv.a); }
#endif

Dependencies:

Use:

<float3|float4> hsv2rgb(<float3|float4> hsv)

Check it on Github


#ifndef FNC_HSV2RGB
#define FNC_HSV2RGB
float3 hsv2rgb(in float3 hsb) {
    return ((hue2rgb(hsb.x) - 1.0) * hsv.y + 1.0) * hsv.z;
}
float4 hsv2rgb(in float4 hsb) { return float4(hsv2rgb(hsb.rgb), hsb.a); }
#endif

Dependencies:

Check it on Github


fn hsv2rgb(hsv : vec3f) -> vec3f {
    return return ((hue2rgb(hsv.x) - 1.0) * hsv.y + 1.0) * hsv.z;
}

License

LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.

Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).

It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.

Get the latest news and releases

Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository