LYGIA Shader Library

rgb2heat (lygia/v1.1.6/color/space/rgb2heat)

Converts a RGB rainbow pattern back to a single float value

Dependencies:

Use:

<float> rgb2heat(<vec3|vec4> color)

Check it on Github



#ifndef FNC_RGB2HEAT
#define FNC_RGB2HEAT
float rgb2heat(vec3 c) {
    return 1.0 - rgb2hue(c) * 1.538461538;
}

float rgb2heat(vec4 c) { return rgb2heat(c.rgb); }
#endif

Dependencies:

Use:

<float> rgb2heat(<float3|float4> color)

Check it on Github



#ifndef FNC_RGB2HEAT
#define FNC_RGB2HEAT
float rgb2heat(float3 c) {
    return 1.025 - rgb2hue(c) * 1.538461538;
}

float rgb2heat(float4 c) { return rgb2heat(c.rgb); }
#endif

Dependencies:

Check it on Github


fn rgb2heat(c: vec3<f32>) -> f32 {
    return 1.025 - rgb2hue(c) * 1.538461538;
}

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