Search Unity

Sharp glyph corners get rounded when using TextMesh Pro

Discussion in 'UGUI & TextMesh Pro' started by Aurigan, Jul 3, 2019.

  1. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    I'm making a game using a font (SF) that has sharp corners. If I create a uGUI text label this is rendered as expected. If I use a TMP font asset with the default settings the corners get rounded. It looks like the amount of rounding can be altered by changing the 'Sampling Point Size' when creating the TMP font asset - are there any other ways to end up with sharper-cornered font rendering in TMP (as in, matches the original font definition)?

    Example (uGUI in green, TMP in white):

     
    Last edited: Jul 3, 2019
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Increasing the sampling point size will provide some improvements.

    Rounded corners at lower sampling point size is something to be mindful when using SDF. However, since most of the time text ends up being displayed at relatively small point size (ie. less than 72 / 48) this is not really noticeable.

    Here is an example of the Arial font sampled at 60, 90 and 120 and displayed at actual 1:1 size using 36, 48 and 72 point size.

    upload_2019-7-3_22-32-33.png

    Note: Using Signed Distance Field, only (1) representation of each character is needed to be added to the atlas texture to display the text at any point size, scale and zoom factor. In addition, unlimited visual variations are possible such as adding an outline, shadow, bevel, glow, etc. and using material preset where the same atlas texture is re-used.

    By contrast when using bitmap font rendering, a representation of each individual character needs to be added to the atlas texture for each point size thus occupying a significantly larger amount of texture space. Visual styling of bitmap fonts requires additional atlas textures unless using scripts like the FX Outline or Shadow which end up duplicating the geometry by 5X to 10X resulting in horrible performance.
     
    Last edited: Jul 4, 2019
  3. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Thanks for the reply and agree there are many advantages to SDF ... are you confirming this is the only way to improve rounded corners though?
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Increasing the sampling point size is the only way to reduce the appearance of these rounded corners with the current Signed Distance Field render modes.
     
  5. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    253
    nbzc and AlejMC like this.