Search Unity

TextMesh Pro Text appears different in scene and game

Discussion in 'UGUI & TextMesh Pro' started by elpuerco63, Oct 16, 2017.

  1. elpuerco63

    elpuerco63

    Joined:
    Jun 26, 2014
    Posts:
    271
    I have placed a TextMesh Pro text on a game object as follows:

    Parent
    ->child1 (has a semi transparent shader applied)
    ->child2

    So in the editor the text appears sharpe, crisp and jet black as required.

    But in in the game the text appears very light grey as if I have the TMP object as a child of child1 with the transparency....but I don't?

    Why would this happen?

    Thanks
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you post an image showing the scene hierarchy and inspector values of each of those objects?

    For the TextMesh Pro object, make sure we can see the value for the material inspector as well including the debug panel expanded to show those settings as well.
     
  3. kabumere

    kabumere

    Joined:
    Oct 2, 2016
    Posts:
    31
    So I didn't start this thread, but just started using TextMesh Pro and came across the same issue.

    I have attached pictures of the scene view, where TMP Text is crisper than Unity UI's Text, as expected (Unity UI is top, TMP is bottom). However in the game view you can see that both are equally blurry - TMP loses its sharpness.

    I have also attached the inspect window properties for TMP Text, my Canvas and my Camera, just in case it's needed.
     

    Attached Files:

  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Enabling "Extra Padding" on the text object inspector and using Linear Color space should help improve the rendering of small text.

    Having said that, when the text is finally rendered by the GPU, it still comes down to resolution / point size / number of pixels available to render the shape of the text. So regardless of the text rendering technique used, you are still constraint by the number of pixels available to define the shape of the text.

    When it comes to rendering small text, using a bitmap font atlas using Hinted Smooth will always render best provided the text is displayed at 1:1. So for each point size used, the font atlas needs a representation of each letter and for each of the point sizes. Having multiple representations of those characters and for each of the point sizes greatly limits the number of characters that can ultimately fit in a font atlas texture.

    By contrast, when using Signed Distance Field (SDF) which is what TMP uses by default, only (1) representation of each character is needed for all point sizes. This greatly increases the number of characters that can be included in a font atlas texture. At small sizes, the text rendered using Signed Distance Field should be pretty similar to the bitmap text. As the point size increases, the benefits of using Signed Distance Field get more significant as the rendering improves while providing the ability to use material presets to dynamically style the visual appearance of the text by adding outline, shadow, textures, etc. As such and for most use case, you would only need (1) font asset per source font file to render that font / text at any point size and resolution and with an unlimited number of visual variations / material presets. By contrast, using a bitmap font atlas, you would need (1) font atlas texture per visual variation each potentially containing multiple representations of each character resulting in potential resource duplication and larger build size.

    As stated above, there are benefits to both text rendering techniques. I personally find Signed Distance Field to be much more flexible and versatile and a must for world space and VR text rendering.
     
  5. kabumere

    kabumere

    Joined:
    Oct 2, 2016
    Posts:
    31
    Thanks for the reply Stephan,

    I'm sorry I forgot to mention: both screenshots are of the text objects zoomed in. At regular zoom in the game view, both Unity Ui Text and TextMesh Pro look fine. I was just expecting that when zoomed in within game view, TMP would keep its sharpness just like it does when zoomed in within scene view.

    Now regarding your response: I know what constitutes a 'large' text size is relative to the size of an object/canvas it's being rendered on, but what do you consider large in your reply? Both titles were size 85 font with a target resolution of 1080p width. I would've thought that would constitute large in this particular case, and thus little blurriness when zoomed.

    I'll try to enable Extra Padding now and use Linear Color to see if anything changes. Do you have any documentation about what those settings are actually doing, though (or at least what effect they have in general)?

    Thanks for the help.

    (EDIT: I enabled Extra Padding, which helped a bit. By 'using Linear Color' though, I'm assuming you just meant don't use a gradient?)
     
    Last edited: Oct 30, 2017
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In the game view, the TMP text object should render as it does in the scene view. That is provided the camera moves towards the object or the scale of the object is being used. The zoom feature of the game view just scales rendering output (pixel wise).

    By Linear Space, I mean Preferences - Player Settings - Other Settings - Color Space.
     
  7. ndoell

    ndoell

    Joined:
    Sep 8, 2017
    Posts:
    1
    upload_2023-3-7_14-55-28.png

    In case you ended up on this old thread just based on the title: Adjusting the scale factor on the canvas may be what you are looking for.