uniform sampler2D FieldSampler;
uniform float Cutoff;
uniform vec4 Color;

const float Wiggle = 0.05;

void main()
{
	vec2 tc = gl_TexCoord[0].st;
	vec4 tex = texture2D(FieldSampler, tc);
	float bottom = tex.r;
	float top = tex.g;
	
	float s = smoothstep(Cutoff-Wiggle, Cutoff+Wiggle, bottom);
	//s = s - 0.5 + max(0.0, top*10.0);
	
	gl_FragColor = Color;
	gl_FragColor.a *= s;
	//gl_FragColor.r = tex.a;
	//gl_FragColor.a = tex.a;
}
