{
    "QEN": {
        "description": "Masks the source item with another item and applies threshold values.",
        "fragmentCode": [
            "@main",
            "{",
            "    vec4 maskTexture = texture(thresholdMaskSource, texCoord);",
            "    float alphaMask = maskTexture.a;",
            "    const float mSLow = 1.0 + thresholdMaskSpreadAtMin;",
            "    const float mSUp = 1.0 + thresholdMaskSpreadAtMax;",
            "    float m1 = smoothstep(thresholdMaskThresholdMin * mSLow - (mSLow - 0.999), thresholdMaskThresholdMin * mSLow, alphaMask);",
            "    float m2 = smoothstep((1.0 - thresholdMaskThresholdMax) * mSUp - (mSUp - 0.999), (1.0 - thresholdMaskThresholdMax) * mSUp, (1.0 - alphaMask));",
            "    float mm = m1 * m2;",
            "    fragColor *= (1.0 - float(thresholdMaskInverted)) * mm + float(thresholdMaskInverted) * (1.0 - mm);",
            "}"
        ],
        "name": "Threshold Mask ",
        "properties": [
            {
                "defaultValue": "../images/mask.png",
                "description": "Source item for the mask effect. By default the alpha channel of the source item is used for masking but this can be easily adjusted in the shader.",
                "name": "thresholdMaskSource",
                "displayName": "Source",
                "type": "image"
            },
            {
                "defaultValue": "0",
                "description": "This property defines a lower threshold value for the mask pixels. The mask pixels that have an alpha value below this property are used to completely mask away the corresponding pixels from the source item. The mask pixels that have a higher alpha value are used to alphablend the source item to the display.\n\nThe value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By default, the property is set to 0.0.",
                "maxValue": "1",
                "minValue": "0",
                "name": "thresholdMaskThresholdMin",
                "displayName": "Threshold Min",
                "type": "float"
            },
            {
                "defaultValue": "0",
                "description": "This property defines the smoothness of the mask edges at the min threshold. Setting higher spread values softens the transition from the transparent mask pixels towards opaque mask pixels by adding interpolated values between them.\n\nThe value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge). By default, the property is set to 0.0.",
                "maxValue": "1",
                "minValue": "0",
                "name": "thresholdMaskSpreadAtMin",
                "displayName": "Spread At Min",
                "type": "float"
            },
            {
                "defaultValue": "1",
                "description": "This property defines an upper threshold value for the mask pixels. The mask pixels that have an alpha value below this property are used to completely mask away the corresponding pixels from the source item. The mask pixels that have a higher alpha value are used to alphablend the source item to the display.\n\nThe value ranges from 0.0 (alpha value 0) to 1.0 (alpha value 255). By default, the property is set to 1.0.\n  ",
                "maxValue": "1",
                "minValue": "0",
                "name": "thresholdMaskThresholdMax",
                "displayName": "Threshold Max",
                "type": "float"
            },
            {
                "defaultValue": "0",
                "description": "This property defines the smoothness of the mask edges at the max threshold. Using higher spread values softens the transition from the transparent mask pixels towards opaque mask pixels by adding interpolated values between them.\n\nThe value ranges from 0.0 (sharp mask edge) to 1.0 (smooth mask edge). By default, the property is set to 0.0.",
                "maxValue": "1",
                "minValue": "0",
                "name": "thresholdMaskSpreadAtMax",
                "displayName": "Spread At Max",
                "type": "float"
            },
            {
                "defaultValue": "false",
                "description": "This property switches the mask to the opposite side; instead of masking away the content outside min and max threshold, content between them will get masked away.\n\nBy default, the property is set to false.",
                "name": "thresholdMaskInverted",
                "displayName": "Inverted",
                "type": "bool"
            }
        ],
        "version": 1
    }
}
