lygia
/v1.1.4
/color
/levels
/gamma
)Color gamma correction similar to Levels adjusment in Photoshop Adapted from Romain Dura (http://mouaif.wordpress.com/?p=94)
Use:
levelsGamma(<vec3|vec4> color, <float|vec3> gamma)
#ifndef FNC_GAMMA
#define FNC_GAMMA
vec3 levelsGamma(in vec3 color, in vec3 gammaAmount) {
return pow(color, 1. / gammaAmount);
}
vec3 levelsGamma(in vec3 color, in float gammaAmount) {
return levelsGamma(color, vec3(gammaAmount));
}
vec4 levelsGamma(in vec4 color, in vec3 gammaAmount) {
return vec4(levelsGamma(color.rgb, gammaAmount), color.a);
}
vec4 levelsGamma(in vec4 color, in float gammaAmount) {
return vec4(levelsGamma(color.rgb, gammaAmount), color.a);
}
#endif
Use:
levelsGamma(<float3|float4> color, <float|float3> gamma)
#ifndef FNC_GAMMA
#define FNC_GAMMA
float3 levelsGamma(in float3 color, in float3 gammaAmount) {
return pow(color, 1. / gammaAmount);
}
float3 levelsGamma(in float3 color, in float gammaAmount) {
return levelsGamma(color, float3(gammaAmount, gammaAmount, gammaAmount));
}
float4 levelsGamma(in float4 color, in float3 gammaAmount) {
return float4(levelsGamma(color.rgb, gammaAmount), color.a);
}
float4 levelsGamma(in float4 color, in float gammaAmount) {
return float4(levelsGamma(color.rgb, gammaAmount), color.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.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository