lygia
/color
/space
/hue2rgb
)Converts a hue value to a RGB vec3 color.
Dependencies:
Use:
<vec3> hue2rgb(<float> hue)
#ifndef FNC_HUE2RGB
#define FNC_HUE2RGB
vec3 hue2rgb(const in float hue) {
float R = abs(hue * 6.0 - 3.0) - 1.0;
float G = 2.0 - abs(hue * 6.0 - 2.0);
float B = 2.0 - abs(hue * 6.0 - 4.0);
return saturate(vec3(R,G,B));
}
#endif
Use:
<float3> hue2rgb(<float> hue)
#ifndef FNC_HUE2RGB
#define FNC_HUE2RGB
float3 hue2rgb(float hue) {
float R = abs(hue * 6.0 - 3.0) - 1.0;
float G = 2.0 - abs(hue * 6.0 - 2.0);
float B = 2.0 - abs(hue * 6.0 - 4.0);
return saturate(float3(R,G,B));
}
#endif
Dependencies:
Use:
<float3> hue2rgb(<float> hue)
#ifndef FNC_HUE2RGB
#define FNC_HUE2RGB
float3 hue2rgb( float hue) {
float R = abs(hue * 6.0 - 3.0) - 1.0;
float G = 2.0 - abs(hue * 6.0 - 2.0);
float B = 2.0 - abs(hue * 6.0 - 4.0);
return saturate(float3(R,G,B));
}
#endif
fn hue2rgb(hue: f32) -> vec3f {
let R = abs(hue * 6.0 - 3.0) - 1.0;
let G = 2.0 - abs(hue * 6.0 - 2.0);
let B = 2.0 - abs(hue * 6.0 - 4.0);
return saturate(vec3f(R,G,B));
}
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.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository