LYGIA Shader Library

luma (lygia/color/luma)

Get the luminosity of a color. From https://github.com/hughsk/glsl-luma/blob/master/index.glsl

Dependencies:

Use:

luma(<vec3|vec4> color)

Check it on Github



#ifndef FNC_LUMA
#define FNC_LUMA
float luma(float v) { return v; }
float luma(in vec3 v) { return rgb2luma(v); }
float luma(in vec4 v) { return rgb2luma(v.rgb); }
#endif

Dependencies:

Use:

luma(<float3|float4> color)

Check it on Github



#ifndef FNC_LUMA
#define FNC_LUMA
float luma(in float color) {
    return float(color);
}

float luma(in float3 color) {
    return rgb2luma(color);
}

float luma(in float4 color) {
    return rgb2luma(color.rgb);
}
#endif

Dependencies:

Use:

luma(<float3|float4> color)

Check it on Github



#ifndef FNC_LUMA
#define FNC_LUMA
float luma(float v) { return v; }
float luma(float3 v) { return rgb2luma(v); }
float luma(float4 v) { return rgb2luma(v.rgb); }
#endif

Dependencies:

Check it on Github




fn luma(color: vec3f) -> f32 {
    return rgb2luma(color);
}

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