const float offset = 1.0 / 64.0;
uniform sampler2D u_Tex0;
varying vec2 v_TexCoord;

void main()
{
	vec4 color = texture2D(u_Tex0, v_TexCoord);
	if (color.a > 0.01) {
		gl_FragColor = color;
		return;
	}

	float alpha = 0.0;
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2( offset,  0.0)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2(-offset,  0.0)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2( 0.0,  offset)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2( 0.0, -offset)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2( offset,  offset)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2(-offset,  offset)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2( offset, -offset)).a);
	alpha = max(alpha, texture2D(u_Tex0, v_TexCoord + vec2(-offset, -offset)).a);

	gl_FragColor = vec4(1.0, 0.02, 0.02, alpha);
}
