Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Ugly Text Outline

Discussion in 'UGUI & TextMesh Pro' started by Stream, Oct 7, 2014.

  1. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    1px text outline looking good, but when I set more - outline looks ugly. Is It going to be fixed?
     
  2. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Looking for more control over text outline, shadows, gradient colors and a lot more?



    Or perhaps control over bevel, glow and even more.

     
  3. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The text rendering will be updated after the 4.6 release according to the UI developers.
     
    Stream likes this.
  4. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    I hope so
     
  5. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Btw I definitely recommend Text Mesh Pro - it's absolutely the best solution I've used in -any- engine.
    ...Even if you do report it as spam ;)

    Unity's outline method will not be fixed, it's just drawing the same mesh behind offset which is slower and not the same solution as TMP uses, which is SDF, so it always knows its real outline.

    I doubt a fix is coming for this, as the method is different.
     
  6. sschaem

    sschaem

    Joined:
    Feb 14, 2014
    Posts:
    148
    I believe unity 4.6 uses 6 render pass to add a hard shadow, and an outline.
    You also will get incorrect blending if the text is semie transparent.


    So a little tech detail followup on the method TM Pro uses, and why its a nice alternative:

    The text in the GIF is rendered using the following shader in a single pass (plain shader model 2.0)
    Works on anything and everything.

    The shader offer the following features:

    - an ARGB outline with fractional pixel thickness control
    - an ARGB gradient for the face
    - Control of dilation of the face
    - A shadow (secondary layer) with
    - Softness control
    - Offset
    - Dilation
    - ARGB color

    Any and all parameter are animatable at run-time.

    Yet the biggest benefit is the zero overhead/allocation for text rendered at any size,
    so scaling text doesn't impact performance. (and its always pixel perfect)

    Code (CSharp):
    1.  
    2. fixed4 PixShader(pixel_t i) : COLOR
    3.         {
    4.             half d = tex2D(_MainTex, i.t0).a * i.p.x;
    5.             fixed4 c = lerp(i.outlineColor, i.faceColor, saturate(d - i.p.z));
    6.             c *= saturate(d - i.p.y);
    7.             d = tex2D(_MainTex, i.t1).a * i.u.x;
    8.             c += i.underlayColor * (saturate(d - i.u.y) * (1-c.a));
    9.             return c;
    10.         }
    11.