XNA to Monogame Guassian Blur Effect broken

Hi guys! I have been developing a game in XNA for a very long time now, and recently decided to upgrade to monogame to take advantage of pultiple platforms and portability. The only issue I’ve had so far is that my guassian blur effect does not work anymore. What used to result in a blurred image now results in a blank green screen. Below I will post my code and what the effect looks like in XNA and Monogame. Thanks!



Here is the .fx file that I use to do the effect:

#define RADIUS 2
#define KERNEL_SIZE (RADIUS * 2 + 1)

float weights[KERNEL_SIZE];
float2 offsets[KERNEL_SIZE];

sampler2D colorMap : register(s0);

float4 PS_GaussianBlur(float2 texCoord : TEXCOORD0) : COLOR0
{
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);

for (int i = 0; i < KERNEL_SIZE; ++i)
    color += tex2D(colorMap, texCoord + offsets[i]) * weights[i];
    
return color;

}

technique GaussianBlur
{
pass
{
PixelShader = compile ps_4_0_level_9_1 PS_GaussianBlur();
}
}

If you need any more info than feel free to ask! Thanks!

Any new Information regarding this? I have the same issue and I am searching for hours now…

The input you take in the pixel shader must match the output of the vertex shader. In the case of a SpriteEffect the vertex shader is the one used by SpriteBatch. Its output is the following:

struct VertexShaderOutput
{
	float4 Position : SV_POSITION;
	float4 Color : COLOR0;
	float2 TextureCoordinates : TEXCOORD0;
};

If you modify your code to make that the type of the input, does it fix your issue?