lygia
/color
/levels
/outputRange
)Color output range adjustment similar to Levels adjusment in Photoshop Adapted from Romain Dura (http://mouaif.wordpress.com/?p=94)
Use:
levelsOutputRange(<vec3|vec4> color, float minOutput, float maxOutput)
#ifndef FNC_LEVELSOUTPUTRANGE
#define FNC_LEVELSOUTPUTRANGE
vec3 levelsOutputRange(in vec3 v, in vec3 oMin, in vec3 oMax) { return mix(oMin, oMax, v); }
vec4 levelsOutputRange(in vec4 v, in vec3 oMin, in vec3 oMax) { return vec4(levelsOutputRange(v.rgb, oMin, oMax), v.a); }
vec3 levelsOutputRange(in vec3 v, in float oMin, in float oMax) { return levelsOutputRange(v, vec3(oMin), vec3(oMax)); }
vec4 levelsOutputRange(in vec4 v, in float oMin, in float oMax) { return vec4(levelsOutputRange(v.rgb, oMin, oMax), v.a); }
#endif
Use:
levelsOutputRange(<float3|float4> color, float minOutput, float maxOutput)
#ifndef FNC_LEVELSOUTPUTRANGE
#define FNC_LEVELSOUTPUTRANGE
float3 levelsOutputRange(in float3 color, in float3 minOutput, in float3 maxOutput) {
return lerp(minOutput, maxOutput, color);
}
float4 levelsOutputRange(in float4 color, in float3 minOutput, in float3 maxOutput) {
return float4(levelsOutputRange(color.rgb, minOutput, maxOutput), color.a);
}
float3 levelsOutputRange(in float3 color, in float minOutput, in float maxOutput) {
return levelsOutputRange(color, float3(minOutput, minOutput, minOutput), float3(maxOutput, maxOutput, maxOutput));
}
float4 levelsOutputRange(in float4 color, in float minOutput, in float maxOutput) {
return float4(levelsOutputRange(color.rgb, minOutput, maxOutput), color.a);
}
#endif
Use:
levelsOutputRange(<float3|float4> color, float minOutput, float maxOutput)
#ifndef FNC_LEVELSOUTPUTRANGE
#define FNC_LEVELSOUTPUTRANGE
float3 levelsOutputRange(float3 v, float3 oMin, float3 oMax) { return mix(oMin, oMax, v); }
float4 levelsOutputRange(float4 v, float3 oMin, float3 oMax) { return float4(levelsOutputRange(v.rgb, oMin, oMax), v.a); }
float3 levelsOutputRange(float3 v, float oMin, float oMax) { return levelsOutputRange(v, float3(oMin), float3(oMax)); }
float4 levelsOutputRange(float4 v, float oMin, float oMax) { return float4(levelsOutputRange(v.rgb, oMin, oMax), 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