lygia
/color
/space
/rgb2luma
)Get's the luminosity from linear RGB, based on Rec709 luminance (see https://en.wikipedia.org/wiki/Grayscale)
Use:
<float> rgb2luma(<vec3|vec4> rgb)
#ifndef FNC_RGB2LUMA
#define FNC_RGB2LUMA
float rgb2luma(const in vec3 rgb) { return dot(rgb, vec3(0.2126, 0.7152, 0.0722)); }
float rgb2luma(const in vec4 rgb) { return rgb2luma(rgb.rgb); }
#endif
Use:
<float> rgb2luma(<float3|float4> rgb)
#ifndef FNC_RGB2LUMA
#define FNC_RGB2LUMA
float rgb2luma(const in float3 rgb) { return dot(rgb, float3(0.2126, 0.7152, 0.0722)); }
float rgb2luma(const in float4 rgb) { return rgb2luma(rgb.rgb); }
#endif
Use:
<float> rgb2luma(<float3|float4> rgb)
#ifndef FNC_RGB2LUMA
#define FNC_RGB2LUMA
float rgb2luma( float3 rgb) { return dot(rgb, float3(0.2126, 0.7152, 0.0722)); }
float rgb2luma( float4 rgb) { return rgb2luma(rgb.rgb); }
#endif
fn rgb2luma(rgb: vec3f) -> f32 { return dot(rgb, vec3(0.2126, 0.7152, 0.0722)); }
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