LYGIA Shader Library

rgb2heat (lygia/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(const in vec3 c) { return 1.025 - rgb2hue(c) * 1.538461538; }
float rgb2heat(const in 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: vec3f) -> f32 { return 1.025 - rgb2hue(c) * 1.538461538; }

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