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. Join us on March 30, 2023, between 5 am & 1 pm EST, in the Performance Profiling Dev Blitz Day 2023 - Q&A forum and Discord where you can connect with our teams behind the Memory and CPU Profilers.
    Dismiss Notice

Bug TMP letters grey background - wrong sharpness

Discussion in 'UGUI & TextMesh Pro' started by andyz, Sep 8, 2020.

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,005
    If you create certain font sizes (large SDF?) and use certain text sizes (small?) then each character has a feint grey background rectangle which only goes if you increase the sharpness in the debug settings.

    Can this be better or just risk of too large a font?!
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    This is the result of the ratio of sampling point size to padding being too small.

    2. I see visual artifacts around the edges of characters. How do I get rid of them?
    These artifacts can be caused by material properties like Dilation, Outline, Underlay, etc. As these property values get near their maximum range, parts of adjacent characters in the font atlas texture can bleed into each other. The font Asset Creator inserts padding between characters to prevent this from happening. To make these visual artifacts go away, re-create the Font Asset with a larger padding value. Note that the padding value affects the range of those properties but also affects the sampling quality of the Font Asset.

    11. How can I increase the range of text effects like dilation, outline, and underlay?
    The range of these effects is determined by the padding used when creating the font atlas. The larger the padding, the larger the effect range. Of course more padding means less room for character data. So there is a trade-off between character quality and effect range. Use the smallest padding that works for you. Note that the padding is specified in pixels, so if you double the texture size you also have to double the padding to keep the same range.

    See the following post for additional information.
     
    andyz likes this.
  3. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,005
    OK thanks, I guess automating the padding size to a good value would be a good addition?
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    As per the post I linked, the Ratio of Sampling Point Size to Padding is something the user needs to decide based on their intended use of the font asset.

    For instance, will this font be used for big titles with thick outline and shadows? If so, then a larger ratio 15% to 20% might be good.

    Or will this font asset be used mostly for plain white text where in this case, a smaller ratio 5% would be fine as to maximize sampling point size.

    Certainly, a warning if the ratio is too small might make sense in the Font Asset Creator.

    P.S. When creating dynamic font assets using the Create context menu, the default values are 90 sampling point size and padding of 9 for 10%.