LYGIA Shader Library

contrast (lygia/v1.1.6/color/contrast)

bias high pass

Use:

<vec4|vec3|float> contrast(<vec4|vec3|float> value, <float> amount)

Check it on Github


#ifndef FNC_CONTRAST
#define FNC_CONTRAST
float contrast(in float v, in float a) { return (v - 0.5 ) * a + 0.5; }
vec3 contrast(in vec3 v, in float a) { return (v - 0.5 ) * a + 0.5; }
vec4 contrast(in vec4 v, in float a) { return vec4((v.rgb - 0.5 ) * a + 0.5, v.a); }
#endif

Use:

<float4|float3|float> contrast(<float4|float3|float> value, <float> amount)

Check it on Github


#ifndef FNC_CONTRAST
#define FNC_CONTRAST
float contrast(in float value, in float amount) {
    return (value - 0.5 ) * amount + 0.5;
}

float3 contrast(in float3 value, in float amount) {
    return (value - 0.5 ) * amount + 0.5;
}

float4 contrast(in float4 value, in float amount) {
    return float4(contrast(value.rgb, amount), value.a);
}
#endif

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