typedef struct
{
    float notUsed;
} subFXVars;

float4 backgroundEffectCore(float4 objectColor, float4 backgroundColor)
{
    float4 invertedBackgroundColor=float4(1.0);
    invertedBackgroundColor.rgb-=backgroundColor.rgb;

    float4 outColor=mix(invertedBackgroundColor,backgroundColor,1.0-objectColor.a);

    outColor*=objectColor.a;

    return outColor;
}

float4 backgroundEffect(float4 objectColor,
                        texture2d<half> blurredBackgroundTexture,
                        texture2d<half> backgroundTexture,
                        float2 screenPosition,
                        constant txShaderUniforms& u,
                        constant subFXVars& vars)
{
    float4 backgroundColor=float4(backgroundTexture.sample(linearSampler,screenPosition*u.uvScale+u.uvOffset));
    return backgroundEffectCore(objectColor,backgroundColor);
}
