lygia
/color
/space
/srgb2luma
)Get's the luminosity from sRGB. Based on from Rec601 luma (see https://en.wikipedia.org/wiki/Grayscale)
Use:
<float> rgb2luma(<vec3|vec4> srgb)
#ifndef FNC_SRGB2LUMA
#define FNC_SRGB2LUMA
float srgb2luma(const in vec3 srgb) { return dot(srgb, vec3(0.299, 0.587, 0.114)); }
float srgb2luma(const in vec4 srgb) { return rgb2luma(srgb.rgb); }
#endif
Use:
<float> rgb2luma(<float3|float4> srgb)
#ifndef FNC_SRGB2LUMA
#define FNC_SRGB2LUMA
float srgb2luma(float3 srgb) { return dot(srgb, float3(0.299, 0.587, 0.114)); }
float srgb2luma(float4 srgb) { return rgb2luma(srgb.rgb); }
#endif
Use:
<float> rgb2luma(<float3|float4> srgb)
#ifndef FNC_SRGB2LUMA
#define FNC_SRGB2LUMA
float srgb2luma( float3 srgb) { return dot(srgb, float3(0.299, 0.587, 0.114)); }
float srgb2luma( float4 srgb) { return rgb2luma(srgb.rgb); }
#endif
fn srgb2luma(srgb : vec3f) -> f32 { return dot(srgb, vec3f(0.299, 0.587, 0.114)); }
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