{
    "QEN": {
        "description": "The Glow effect adds soft glowing effect for the source content.",
        "extraMargin": 80,
        "fragmentCode": [
            "@requires BlurHelper",
            "@main",
            "{",
            "    vec4 glowColor = texture(iSource, texCoord) * glowBlurWeight1[0];",
            "    glowColor += texture(iSourceBlur1, texCoord) * glowBlurWeight1[1];",
            "#if (BLUR_HELPER_MAX_LEVEL > 2)",
            "    glowColor += texture(iSourceBlur2, texCoord) * glowBlurWeight1[2];",
            "#endif",
            "#if (BLUR_HELPER_MAX_LEVEL > 8)",
            "    glowColor += texture(iSourceBlur3, texCoord) * glowBlurWeight1[3];",
            "#endif",
            "#if (BLUR_HELPER_MAX_LEVEL > 16)",
            "    glowColor += texture(iSourceBlur4, texCoord) * glowBlurWeight2[0];",
            "#endif",
            "#if (BLUR_HELPER_MAX_LEVEL > 32)",
            "    glowColor += texture(iSourceBlur5, texCoord) * glowBlurWeight2[1];",
            "#endif",
            "",
            "    glowColor = min(glowColor * glowBloom, vec4(glowMaxBrightness));",
            "",
            "    // Blend in the Glow",
            "    if (glowBlendMode == 0) {",
            "        // Additive",
            "        fragColor += glowColor;",
            "    } else if (glowBlendMode == 1) {",
            "        // Screen",
            "        fragColor = clamp(fragColor, vec4(0.0), vec4(1.0));",
            "        fragColor = max((fragColor + glowColor) - (fragColor * glowColor), vec4(0.0));",
            "    } else {",
            "        // Replace",
            "        fragColor = glowColor;",
            "    }",
            "}"
        ],
        "name": "Glow",
        "properties": [
            {
                "defaultValue": "1",
                "description": "Blending mode for the glow effect. 0 = Additive, 1 = Screen, 2 = Replace.",
                "maxValue": "2",
                "minValue": "0",
                "name": "glowBlendMode",
                "displayName": "Blend Mode",
                "type": "int"
            },
            {
                "defaultValue": "1",
                "description": "This value defines the softness of the glow. Values are between 0..1.",
                "maxValue": "1",
                "minValue": "0",
                "name": "glowBlurAmount",
                "displayName": "Blur Amount",
                "type": "float"
            },
            {
                "defaultValue": "1",
                "description": "This value defines the bloom strength of the glow. Suitable values are between 0..2.",
                "maxValue": "2",
                "minValue": "0",
                "name": "glowBloom",
                "displayName": "Bloom",
                "type": "float"
            },
            {
                "defaultValue": "1",
                "description": "Sets the maximum brightness of the glow.",
                "maxValue": "1",
                "minValue": "0",
                "name": "glowMaxBrightness",
                "displayName": "Max Brightness",
                "type": "float"
            }
        ],
        "version": 1,
        "vertexCode": [
            "out vec4 glowBlurWeight1;",
            "out vec2 glowBlurWeight2;",
            "",
            "float glowBlurWeight(float v) {",
            "    return max(0.0, min(1.0, 1.0 - v * 2.0));",
            "}",
            "",
            "@main",
            "{",
            "    float blurLod = sqrt(glowBlurAmount * (BLUR_HELPER_MAX_LEVEL / 64.0)) * 1.2 - 0.2;",
            "    float bw1 = glowBlurWeight(abs(blurLod - 0.1));",
            "    float bw2 = glowBlurWeight(abs(blurLod - 0.3));",
            "    float bw3 = glowBlurWeight(abs(blurLod - 0.5));",
            "    float bw4 = glowBlurWeight(abs(blurLod - 0.7));",
            "    float bw5 = glowBlurWeight(abs(blurLod - 0.9));",
            "    float bw6 = glowBlurWeight(abs(blurLod - 1.1));",
            "",
            "    float bsum = bw1 + bw2 + bw3 + bw4 + bw5 + bw6;",
            "    glowBlurWeight1 = vec4(bw1 / bsum, bw2 / bsum, bw3 / bsum, bw4 / bsum);",
            "    glowBlurWeight2 = vec2(bw5 / bsum, bw6 / bsum);",
            "}"
        ]
    }
}
