LYGIA Shader Library

vividLight (lygia/color/blend/vividLight)

Photoshop Vivid Light blend mode mplementations sourced from this article on https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/

Dependencies:

Use:

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

Check it on Github



#ifndef FNC_BLENDVIVIDLIGHT
#define FNC_BLENDVIVIDLIGHT
float blendVividLight(in float base, in float blend) {
    return (blend < .5)? blendColorBurn(base, (2.*blend)): blendColorDodge(base, (2. * (blend - .5)));
}

vec3 blendVividLight(in vec3 base, in vec3 blend) {
    return vec3(blendVividLight(base.r, blend.r),
                            blendVividLight(base.g, blend.g),
                            blendVividLight(base.b, blend.b));
}

vec3 blendVividLight(in vec3 base, in vec3 blend, in float opacity) {
    return (blendVividLight(base, blend) * opacity + base * (1. - opacity));
}
#endif

Dependencies:

Use:

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

Check it on Github



#ifndef FNC_BLENDVIVIDLIGHT
#define FNC_BLENDVIVIDLIGHT
float blendVividLight(in float base, in float blend) {
    return (blend < .5)? blendColorBurn(base, (2.*blend)): blendColorDodge(base, (2. * (blend - .5)));
}

float3 blendVividLight(in float3 base, in float3 blend) {
    return float3(  blendVividLight(base.r, blend.r),
                    blendVividLight(base.g, blend.g),
                    blendVividLight(base.b, blend.b) );
}

float3 blendVividLight(in float3 base, in float3 blend, in float opacity) {
    return (blendVividLight(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