opengl es - Anti aliasing outlined distance field font -


I have a distance area font that I want to outline with a large white border. I have got a different job from this fact that I am not sure how to remove the transition between color and outline.

Enter image details here

My current piece shader Looks like

  uniform sampler2d u_texture; Curve 4 v_color; Vec2 v_texCoord different; Const float smoothing = 1.0 / 16.0; Zero main () {float distance = texture 2d (u_text, v_tex cord). a; Name alpha = lube (0.3 - smoothing, 0.3+ smoothing, distance); If (distance <0.5) gl_FragColor = vec4 (1.0, 1.0, 1.0, alpha); Else gl_FragColor = vec4 (v_color.rgb, alpha); }  

Any sign in how I get a smooth transition would be great. I finally went there when I discovered the mix function in the shader.

My last shader code looks like this:

  Uniform sample 2DU_text; Curve 4 v_color; Vec2 v_texCoord different; Const float smoothing = 1.0 / 16.0; Zero main () {float distance = texture 2d (u_text, v_tex cord). a; Name alpha = lube (0.3 - smoothing, 0.3+ smoothing, distance); Gl_FragColor = Blend (vec4 (1.0, 1.0, 1.0, alpha), vec4 (v_color.rgb, alpha), (distance - 0.45) * 10.0); (Distance> 0.45 & amp; amp; distance & amp; else if (distance <0.45) gl_FragColor = vec4 (1.0, 1.0, 1.0, alpha); Else gl_FragColor = vec4 (v_color.rgb, alpha);}  

Creating the image below.

image Enter Details Here


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -