LYGIA Shader Library

hue (lygia/color/blend/hue)

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

Dependencies:

Use:

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

Check it on Github



#ifndef FNC_BLENDHUE
#define FNC_BLENDHUE
vec3 blendHue(vec3 base, vec3 blend) {
  vec3 baseHSL = rgb2hsv(base);
  vec3 blendHSL = rgb2hsv(blend);
  return hsv2rgb(
      vec3(blendHSL.x, baseHSL.y, baseHSL.z));
}
vec3  blendHue(in vec3 base, in vec3 blend, float opacity) { 
    return (blendHue(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