float4 main( float4 color_in : COLOR0, float2 texCoord_in : TEXCOORD0, uniform sampler2D diffuseMap : register(S0) ) : COLOR0 { float distance = tex2D(diffuseMap, texCoord_in).a; const float w = 0.5/3; const float threshold = 0.5f; float alpha = smoothstep( threshold-w, threshold+w, distance ); return float4(color_in.rgb,alpha * color_in.a); }