{
    "QEN": {
        "description": "The masked blur effect softens the source content by blurring it with an algorithm which uses the source content downscaling and bilinear filtering. The intensity of the blur can be controlled for each pixel so that some parts of the source are blurred more than others.",
        "extraMargin": 40,
        "fragmentCode": [
            "@requires BlurHelper",
            "",
            "float maskedBlurWeight(float v) {",
            "    return max(0.0, min(1.0, 1.0 - v * 2.0));",
            "}",
            "",
            "@main",
            "{",
            "    float blurAmount;",
            "    if (maskedBlurImageMasking) {",
            "        // Enable this to use image as a mask.",
            "        blurAmount = maskedBlurAmount * texture(maskedBlurMaskSource, texCoord).a;",
            "    } else {",
            "        // Enable these to use position & radius as a mask.",
            "        float b = distance(texCoord, maskedBlurPos) / maskedBlurRadius;",
            "        b = min(1.0, max(0.0, b));",
            "        blurAmount = maskedBlurAmount * b;",
            "    }",
            "    if (maskedBlurInvert)",
            "        blurAmount = 1.0 - blurAmount;",
            "",
            "    float blurLod = sqrt(blurAmount * (BLUR_HELPER_MAX_LEVEL / 64.0)) * 1.2 - 0.2;",
            "    float bw1 = maskedBlurWeight(abs(blurLod - 0.1));",
            "    float bw2 = maskedBlurWeight(abs(blurLod - 0.3));",
            "    float bw3 = maskedBlurWeight(abs(blurLod - 0.5));",
            "    float bw4 = maskedBlurWeight(abs(blurLod - 0.7));",
            "    float bw5 = maskedBlurWeight(abs(blurLod - 0.9));",
            "    float bw6 = maskedBlurWeight(abs(blurLod - 1.1));",
            "",
            "    float bsum = bw1 + bw2 + bw3 + bw4 + bw5 + bw6;",
            "    vec4 blurWeight1 = vec4(bw1 / bsum, bw2 / bsum, bw3 / bsum, bw4 / bsum);",
            "    vec2 blurWeight2 = vec2(bw5 / bsum, bw6 / bsum);",
            "    ",
            "    vec4 blurredColor = texture(iSource, texCoord) * blurWeight1[0];",
            "    blurredColor += texture(iSourceBlur1, texCoord) * blurWeight1[1];",
            "#if (BLUR_HELPER_MAX_LEVEL > 2)",
            "    blurredColor += texture(iSourceBlur2, texCoord) * blurWeight1[2];",
            "#endif",
            "#if (BLUR_HELPER_MAX_LEVEL > 8)",
            "    blurredColor += texture(iSourceBlur3, texCoord) * blurWeight1[3];",
            "#endif",
            "#if (BLUR_HELPER_MAX_LEVEL > 16)",
            "    blurredColor += texture(iSourceBlur4, texCoord) * blurWeight2[0];",
            "#endif",
            "#if (BLUR_HELPER_MAX_LEVEL > 32)",
            "    blurredColor += texture(iSourceBlur5, texCoord) * blurWeight2[1];",
            "#endif",
            "",
            "    fragColor = blurredColor;",
            "}",
            ""
        ],
        "name": "Masked Blur",
        "properties": [
            {
                "defaultValue": "false",
                "description": "Set this to true to use an image as blur intensity instead of position and radius values.",
                "name": "maskedBlurImageMasking",
                "displayName": "Use Image Mask",
                "type": "bool"
            },
            {
                "defaultValue": "0",
                "description": "Sets the softness of the blur. A larger value causes the edges of the image to appear more blurry.",
                "maxValue": "1",
                "minValue": "0",
                "name": "maskedBlurAmount",
                "displayName": "Amount",
                "type": "float"
            },
            {
                "defaultValue": "",
                "description": "Sets the item that is controlling the intensity of the blur. The pixel alpha channel value defines the actual blur radius that is used for blurring the corresponding source pixel. Note: This is only functional when 'Use Image Mask' is enabled.",
                "name": "maskedBlurMaskSource",
                "displayName": "Mask Source",
                "type": "image"
            },
            {
                "defaultValue": "0.5, 0.5",
                "description": "Sets the center position of the masked blur.",
                "maxValue": "1, 1",
                "minValue": "0, 0",
                "name": "maskedBlurPos",
                "displayName": "Center",
                "type": "vec2"
            },
            {
                "defaultValue": "0.5",
                "description": "Sets the radius of the masked blur.",
                "maxValue": "2",
                "minValue": "0",
                "name": "maskedBlurRadius",
                "displayName": "Radius",
                "type": "float"
            },
            {
                "defaultValue": "false",
                "description": "Set this to true to invert the blur.",
                "name": "maskedBlurInvert",
                "displayName": "Invert",
                "type": "bool"
            }
        ],
        "version": 1
    }
}
