Search Unity

TextMesh Pro Issue with font display after upgrading to v2018.1 of TMP

Discussion in 'UGUI & TextMesh Pro' started by xVergilx, May 20, 2018.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Hi, I've followed the guide for upgrading TMP to v2018.1 via package manager. Everything went fine, except on some fonts I'm getting weird shader/text background glitch;

    If I zoom out, or just play the game, font is drawn with it's background.
    shaderIssue_1.PNG

    However, if I zoom more closely - it's completely fine.
    shaderIssue_2.PNG

    Is this distance field shader problem? Any idea how to remove the text background completely?

    Here's my font's material settings:
    upload_2018-5-20_20-58-7.png

    I've also tried mobile/non-mobile shader versions, it's the same result.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Not sure why this would show up after the upgrade but this is due to the padding value being too small relative to the sampling point size. See FAQ Question 2 and 11.
     
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    I've tried doubling padding value. It's better but, if the text gets too small, it receives background anyway.
    Even 10 is not enough now?

    Edit: 20 did the trick for this one.

    But perhaps, there's a better solution? Like altering some value via the shader?
     
    Last edited: May 22, 2018
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In order to avoid seeing those artifacts when the text gets small, the Ratio of Sampling Point Size to Padding should be about 10 - 15%. So if the Sampling Point Size is 100 and the Padding 10 you should be ok.

    Can you post a screenshot showing the material inspector (including the debug section) so I can see the values there?

    Then can you post another screenshot of the font asset inspector where I can see the texture size and padding values?
     
    xVergilx likes this.
  5. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Yeah, now it all makes sense. My old font had some absurt Point Size, 1.6k due to enormous texture size and 5 padding. I though it had multiple unicode ranges included, which actually wasn't the case, leading to memory waste instead.

    The new one I've generated got 200 point size, with 20 padding. Which does the trick.

    My fault, thanks for clarifying this one out.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The LiberationSans included with TextMesh Pro has a sampling point size of 86 which is pretty good. Unless you will be displaying your font asset at large sizes on screen and trying to preserve sharp(er) corners, 200 sampling point size is pretty high. So you might be able to create a smaller font asset (texture size wise) and still get the same visual quality if your text is displayed at smaller size (ie. less than 36 points). This is just a suggestion in terms of optimization.
     
    xVergilx likes this.