{ "QEN": { "description": "The effect is similar to what happens when a colorized glass is put on top of a grayscale image. Colorize uses the hue, saturation, and lightness (HSL) color space. You can specify a desired value for each property. You can shift all HSL values with the HueSaturation effect.\n\nAlternatively, you can use the ColorOverlay effect to colorize the source item in the RGBA color space.", "fragmentCode": [ "float RGBtoL(vec3 color)", "{", " float cmin = min(color.r, min(color.g, color.b));", " float cmax = max(color.r, max(color.g, color.b));", " float l = (cmin + cmax) / 2.0;", " return l;", "}", "float hueToIntensity(float v1, float v2, float h)", "{", " h = fract(h);", " if (h < 1.0 / 6.0)", " return v1 + (v2 - v1) * 6.0 * h;", " else if (h < 1.0 / 2.0)", " return v2;", " else if (h < 2.0 / 3.0)", " return v1 + (v2 - v1) * 6.0 * (2.0 / 3.0 - h);", " return v1;", "}", "vec3 HSLtoRGB(vec3 color)", "{", " float h = color.x;", " float l = color.z;", " float s = color.y;", " if (s < 1.0 / 256.0)", " return vec3(l, l, l);", " float v1;", " float v2;", " if (l < 0.5)", " v2 = l * (1.0 + s);", " else", " v2 = (l + s) - (s * l);", " v1 = 2.0 * l - v2;", " float d = 1.0 / 3.0;", " float r = hueToIntensity(v1, v2, h + d);", " float g = hueToIntensity(v1, v2, h);", " float b = hueToIntensity(v1, v2, h - d);", " return vec3(r, g, b);", "}", "@main", "{", " vec4 samp = vec4(fragColor.rgb / max(1.0/256.0, fragColor.a), fragColor.a);", " float light = RGBtoL(samp.rgb);", " float c = step(0.0, colorizeLightness);", " samp.rgb = HSLtoRGB(vec3(colorizeHue, colorizeSaturation, mix(light, c, abs(colorizeLightness))));", " fragColor = vec4(samp.rgb * samp.a, samp.a);", "}" ], "name": "Colorize", "properties": [ { "defaultValue": "1", "description": "This property defines the hue value which is used to colorize the source.\n\nThe value ranges from 0.0 to 1.0. By default, the property is set to \\c 0.0, which produces a slightly red color.", "maxValue": "1", "minValue": "0", "name": "colorizeHue", "type": "float" }, { "defaultValue": "1", "description": "This property defines the saturation value which is used to colorize the source.\n\nThe value ranges from 0.0 (desaturated) to 1.0 (saturated). By default, the property is set to \\c 1.0 (saturated).", "maxValue": "1", "minValue": "0", "name": "colorizeSaturation", "type": "float" }, { "defaultValue": "0", "description": "This property defines how much the source lightness value is increased or decreased.\n\nUnlike hue and saturation properties, lightness does not set the used value, but it shifts the existing source pixel lightness value.\n\nThe value ranges from -1.0 (decreased) to 1.0 (increased). By default, the property is set to \\c 0.0 (no change).", "maxValue": "1", "minValue": "-1", "name": "colorizeLightness", "type": "float" } ], "version": 1 } }