I'm writing a Gaussian blur shader and it's coming along pretty well. However, when I run it on a circle, the result is lumpy.
I'm using a simple nested for loop to create the blur. Here's the code in it's current form:
int samples = 10;
int sampledist = 1;
float rt_h = 720; // render target height
float rt_w = 1280; // render target height
vec4 effect(vec4 col, Image tex, vec2 texcoord, vec2 screencoord)
{
vec3 final = vec3(1.0, 0.0, 0.0);
final = Texel(tex, texcoord.xy).rgb;
for (int i=-samples; i<samples; i++)
{
for (int j=-samples; j<samples; j++)
{
final += Texel(tex, texcoord.xy + vec2(i*sampledist, j*sampledist)/vec2(rt_w, rt_h)).rgb * .01;
}
}
return vec4(final, 1.0);
}
(Note: I'm using a variation of the regular GLSL language for Love2D, so the above code isn't completely valid GLSL shader code)
What is wrong with my algorithm?