Search Unity

TextMesh Pro World Canvas text is jagged

Discussion in 'UGUI & TextMesh Pro' started by TSabos, Jul 29, 2017.

  1. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    I've followed most suggestions to set world canvas scale to .01 .01 1 and then scaled from there. The following is an example of what I'm getting for results of World space (Top) vs. Screen Space Overlay (Bottom).

    The overlay requires constantly updating position in update so is less than ideal and also scales differently as I zoom my orthographic camera in and out of my world map. In overlay mode it stays same size on screen which is unwanted, so if I can get world space to work that would be preferred.

    Any suggestions for what I could have set incorrectly?

    Also, sometimes I see letters turn into full white blocks when using world space canvas.

     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you provide a screenshot of the inspector panel of the Canvas so I can see the both the RectTransform Scale as well as the other settings on the Canvas.

    Can you also include an image of the text object inspector panel. I would like to also see the RectTransform settings on it as well as the Material Inspector with the Material Debug Panel open.

    On a separate note, if you don't need to use a Canvas, you could use a normal TMP text object which is a replacement for the old TextMesh. Having lots of Canvases in world space results in pretty significant performance overhead as compared to lots of normal TMP objects in world space.
     
  3. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    I'm just using 1 world space canvas and positioning everything from its root, so just the 1 canvas for performance purposes.

    Canvas
    https://snag.gy/rF9nJG.jpg

    Text
    https://snag.gy/FtQiVY.jpg

    What exactly did you want from the Material? Long list of info or if you just meant the font material itself, there's not much besides the huge list of things in Saved Properties.

    The built in Liberation Sans does the same thing with the settings I'm using.
    https://snag.gy/BZeGlE.jpg

    One major note is for the Screen space overlay font I only need to use font size 16-20 but on the world space to be the right size at .01, I use 40-60.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    When using a Canvas in World Space, you have to assign a Camera to it.

    In terms of World Space and point size, this is all relative to the Canvas size and Camera. For instance, if the camera is set to Orthographic, its size will affect all of this.
     
  5. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    Fair enough ;) No change though in what it does.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    In terms of the Material Inspector, expand the material property panel which will expose Outline, Underlay and all those settings. There is also a Debug panel section with information like Texture Atlas Size and Spread value.

    I am also seeing (2) Material Inspector which leads me to believe that you upgraded to a new version of Unity without updating your version of TextMesh Pro to the corresponding version of Unity.

    P.S. The text should be clean without those sharp edges (in the game view) provided the Camera is assigned to the World Space Canvas. Sometimes it is hard to figure out what might be the cause as it could be a number of things, if you can provide me with a Repro project via some private link in a PM or something, I'll be more than happy to take a look to see exactly what is causing the text to not render as it should.
     
  7. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    Something is definitely up with my project... I just created a brand new test, hooked up a basic Ortho camera and 2 canvases and not seeing the same issues. I'll try to see what I can do on my end, but knowing what's broken I'm sure would be nice ;)

    If I figure anything out I'll be sure to pass it along. Thanks for the quick replies.
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Looks in the debug section of the Material Inspector. There is a property called Scale X and Y, those should be set to 1. Otherwise, you could get this harsh / not smooth edges.

    If the Gradient Scale was changes or the Texture width / height be incorrect or the Gradient scale, this could also have to same results.

    Here is an image of my Material Insector panel for LiberationSans so you can compare values.

    upload_2017-7-29_16-42-38.png

    The Texture Width and Height are those of the font atlas texture, this should match the sizes in the font editor panel. The Gradient scale should be Padding + 1. The padding value is also listed in the font asset editor panel for the font you are using.
     
  9. TSabos

    TSabos

    Joined:
    Mar 8, 2015
    Posts:
    94
    Still trying to unravel how completely wiping TMP from my project and re-adding it resolved the problem.. but it did. Sorry should have probably tried that first after seeing the 2 materials on a font, but I wasn't sure if I was simply doing something wrong.

    Thanks for clearing up that it wasn't technically TMP's fault ;)

    Btw, I was on 0b10 and of course the asset store didn't inform me there was 0b11 due to the asset store sometimes not seeing your new version after upgrade. If 0b10 isn't for 5.6.2f1 then that was an oversight because I always make sure TMP is up to date as step 1... followed by Rewired and Nodecanvas ;D
     
    Stephan_B likes this.
  10. Blenderik

    Blenderik

    Joined:
    May 14, 2013
    Posts:
    146
    This is still happening to me. 2019.3.6. Oddly enoug when I select the outline material, it works. Switching back gets me the ugly stuff again. So I just removed the outline from the outline material. Still seems like a weird thing to me.
     
  11. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Can you post a few images of the issue you are seeing?

    Please make sure the images are large enough to see the details.
     
  12. Blenderik

    Blenderik

    Joined:
    May 14, 2013
    Posts:
    146
    These Screenshots used default settings, nothing altered but font size.
    Here is one with Font size 82:
    upload_2020-4-2_16-37-26.png

    It's really jagged and and there is a weird gray background, I can't get rid of.
    I know you said large, but the issue is much worse on smaller text:
    upload_2020-4-2_16-39-31.png

    In this one I switched to outline material (dropdown) and changed the vertex color to black:
    upload_2020-4-2_16-42-50.png
    The outline option seems to be disabled by default. This text looks decent.
    As you can see from the 1. screenshot, this is game view, but I did not alter the scale of the view, it's at 1x.
    This happened in 2019.2.6f1 and 2019.3.6f1. The package is up to date in both projects.
     

    Attached Files:

  13. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The grey outline around the text is normally an indication that the Sampling Point Size to Padding Ratio is too small.

    Is this a new font asset or the default one included with the TMP Package?

    Can you check what the Sampling Point Size and Padding value is on that font asset?

    Can you provide me with an image showing the Material Inspector? Make sure the Debug Section of the Material Inspector is expanded so I can see those values as well.
     
  14. Blenderik

    Blenderik

    Joined:
    May 14, 2013
    Posts:
    146
    As I said, nothing changed, but font size, so yes, it's the standard material.
    upload_2020-4-3_9-52-8.png
    This screenshot should contain all the information, if not, let me know.
    If I increase the sharpness in the debug settings (why is that in the debug settings, if it has an effect on render?) The gray BG disappears, but the font is still aliased. The padding : Sampling point ratio ist 0.1. Idk if that's good or bad.
    I've seen your promotions for TMP everywhere, I was reluctant to switch, bc. it increases the package size for WebGL, and now I'm even more, even though this app is supposed to run on standalone. Could you please make it work out of the box?
     
  15. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for posting these last images.

    By default the Sharpness should be 0 where in this case it is -0.879 which is the likely cause of the issue.

    Let me know if setting it back to 0 solves your issue?

    P.S. Sharpness shifts the SDF scaling which depending on the Sampling Point Size to Padding can as values get closer to -1 or 1 produce these types of visual issues. Normally, these are noticed when messing with the setting but if modified inadvertently without looking at some text object while doing it, it would not be obvious to figure out later why a given text object isn't rendering correctly.
     
    Last edited: Apr 3, 2020