I am trying to implement a gaussian blur with convolution matrix on my shader.
This is the code i have:
float4 ppPS(float2 uv : TEXCOORD0, uniform sampler2D t1) : COLOR {
//kernel matrix
float3x3 kernel={1*(1/16),2*(1/16),1*(1/16),
2*(1/16),4*(1/16),2*(1/16),
1*(1/16),2*(1/16),1*(1/16)
};
int x,y;
float2 sum = 0;
for (x = -1; x <= 1; x++)
{
for (y = -1; y <= 1; y++)
{
float2 fl;
fl.x = uv.x+x;
fl.y = uv.y+y;
sum += (fl)*(kernel[x+1][y+1]);
}
}
return tex2D(t1, sum);
}
but for some reason, i get a picture all in one solid color.
Here is the image without the blur:
Here is the image with the so called blur:
any idea of what am i doing wrong over here?