LYGIA Shader Library

luminosity (lygia/color/blend/luminosity)

Luminosity Blend mode creates the result color by combining the hue and luminance of the base color with the saturation of the blend color.

Dependencies:

Use:

blendLuminosity(<float|vec3> base, <float|vec3> blend [, <float> opacity])

Check it on Github



#ifndef FNC_BLENDLUMINOSITY
#define FNC_BLENDLUMINOSITY
vec3 blendLuminosity(vec3 base, vec3 blend) {
  vec3 baseHSL = rgb2hsv(base);
  vec3 blendHSL = rgb2hsv(blend);
  return hsv2rgb(
      vec3(baseHSL.x, baseHSL.y, blendHSL.z));
}
vec3  blendLuminosity(in vec3 base, in vec3 blend, float opacity) { 
    return (blendLuminosity(base, blend) * opacity + base * (1. - opacity)); 
}
#endif

Dependencies:

Use:

blendLuminosity(<float|float3> base, <float|float3> blend [, <float> opacity])

Check it on Github



#ifndef FNC_BLENDLUMINOSITY
#define FNC_BLENDLUMINOSITY
float3 blendLuminosity(float3 base, float3 blend) {
  float3 baseHSL = rgb2hsv(base);
  float3 blendHSL = rgb2hsv(blend);
  return hsv2rgb(
      float3(baseHSL.x, baseHSL.y, blendHSL.z));
}
float3  blendLuminosity(float3 base, float3 blend, float opacity) { 
    return (blendLuminosity(base, blend) * opacity + base * (1. - opacity)); 
}
#endif

License

MIT License (MIT) Copyright (c) 2015 Jamie Owen

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