lygia
/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 v, in vec3 g) { return pow(v, 1.0 / g); }
vec3 levelsGamma(in vec3 v, in float g) { return levelsGamma(v, vec3(g)); }
vec4 levelsGamma(in vec4 v, in vec3 g) { return vec4(levelsGamma(v.rgb, g), v.a); }
vec4 levelsGamma(in vec4 v, in float g) { return vec4(levelsGamma(v.rgb, g), v.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
Use:
levelsGamma(<float3|float4> color, <float|float3> gamma)
#ifndef FNC_GAMMA
#define FNC_GAMMA
float3 levelsGamma(float3 v, float3 g) { return pow(v, 1.0 / g); }
float3 levelsGamma(float3 v, float g) { return levelsGamma(v, float3(g)); }
float4 levelsGamma(float4 v, float3 g) { return float4(levelsGamma(v.rgb, g), v.a); }
float4 levelsGamma(float4 v, float g) { return float4(levelsGamma(v.rgb, g), v.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