const float dx = 0.001;
const float dy = 0.0013;
uniform sampler2D tex;

void main()
{
	vec2 tc = gl_TexCoord[0].st;

	tc.s = tc.s - dx;
	vec4 cl = texture2D(tex, tc);

	tc.s = tc.s + 2.0 * dx;
	vec4 cr = texture2D(tex, tc);

	tc.s = tc.s - dx;
	tc.t = tc.t + dy;
	vec4 cd = texture2D(tex, tc);

	tc.t = tc.t - 2.0 * dy;
	vec4 cu = texture2D(tex, tc);

	float r = (cl.r + cr.r + cd.r + cu.r) / 4.0125;
	float g = (cl.g + cr.g + cd.g + cu.g) / 4.0125;
	float b = (cl.b + cr.b + cd.b + cu.b) / 4.0125;
	float a = (cl.a + cr.a + cd.a + cu.a) / 4.0125;

	if (r < 0.05) r = 0.0;
	if (g < 0.05) g = 0.0;
	if (b < 0.05) b = 0.0;
	if (a < 0.05) a = 0.0;

	gl_FragColor = vec4(r,g,b,a);
}
