Search Unity

TextMesh Pro Safe to use DebugSettings Sharpness?

Discussion in 'UGUI & TextMesh Pro' started by Mloren, Apr 2, 2021.

  1. Mloren

    Mloren

    Joined:
    Aug 20, 2011
    Posts:
    83
    Hi,

    I'm using TextMeshPro UGUI to draw quite a small font and it looks a bit blurry but I discovered that if I increase the Sharpness in the material's Debug Settings to 1 then it looks great.

    Is there any downside to this? I'm just a bit cautious because it's called "Debug Settings" which makes it sound like it's not suitable for use in the final game.
    Is changing this setting an okay solution?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This setting simply tweaks the Signed Distance Field calculations thus making the text sharper or softer. If it most definitely safe to use.
     
    xLeo, nyonge and futurlab_xbox like this.
  3. nyonge

    nyonge

    Joined:
    Jul 11, 2013
    Posts:
    49
    Thanks for clarifying @Stephan_B! Can you go into a bit of detail as to what exactly this does?

    More specifically I'm wondering if there's ever a reason NOT to just crank it to 1, esp for small text.

    This is like ~16pt font in the bottom corner of an FHD screen:

    Sharpness 0:
    upload_2021-8-4_18-1-39.png

    Sharpness 1:
    upload_2021-8-4_18-1-56.png

    Wayyyyyyyyyy more legible, esp on a small screen
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The Sharpness simply alters the SDF value read from the texture which either makes the glyph appear softer or sharper.

    In terms of why not always crank this to 1, simply because as humans we all evaluate text differently. To some sharper is better. To other softer or bolder, etc. Gamma settings on a monitor can also affect the appearance of the text. Color space, font design and selection, etc. Ie. it is very subjective hence why I add this sharpness slider :)
     
  5. Loden_Heathen

    Loden_Heathen

    Joined:
    Sep 1, 2012
    Posts:
    480
    upload_2021-10-25_13-11-52.png
    Notice the faint white block behind the letters, this is with sharpness set to 0

    upload_2021-10-25_13-13-40.png
    Same font sharpness set to 1

    I notice this issue is worce with larger atlases e.g. I can leave sharpness to 0 if I shrink the atlas size

    I manage to work around it but I feel like I am fighting the tools here ...
    Can anyone chime in as to why this happens with larger atlases and what the ideal settings would be in an ideal use case ... I can shift from that known point if I knew it ... I think :)
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The visual ghosting artifact is the result of Sampling Point Size to Padding ratio being too small. See the following FAQ 2 in the following post for more information on this. Also review FAQ 10 as it is also related to the Sampling Point Size to Padding ratio.

    Sharpness in the debug section of the material inspector shifts the SDF range which would have a similar affect to a slight increase or decrease of the Sampling Point Size to Padding Ratio which is why it makes the visual artifacts go away but it alters the sharpness whereas regenerating the font asset to increase the ratio will not affect sharpness.
     
    leobilck likes this.
  7. Loden_Heathen

    Loden_Heathen

    Joined:
    Sep 1, 2012
    Posts:
    480
    Playing with padding helped tons
    Also makes the features such as outline and all much more useful ... always felt the limited range of outline and underlay for drop shadow was uslessly narrow.

    Looking forward to more imrpovements to Unity's font rendering capability its been a pain point for ... well since uGUI was released :)
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    That is why the vast majority of users have been using TMP :)