Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Textmesh Pro with URP, is this a glitch?

Discussion in 'UGUI & TextMesh Pro' started by AndreaEttorre, Jun 3, 2020.

  1. AndreaEttorre

    AndreaEttorre

    Joined:
    Oct 9, 2015
    Posts:
    8
    Hello everyone,
    This is my first post in the forum, i hope this is the right place where to write this. First of all, thanks to all of the community, it's really a great place where to look for support and nice tips and tricks!

    So i've spent the whole day trying to understand what was going on with Textmesh Pro using URP (i successfully used TMP with the built-in deferred rendering system in the past). Basically, no matter what i did or what parameter i tweaked (checked the generated font atlas params, tmp shaders, pipeline hdr param, window zoom, pp, and lots more) the text would show up ok in scene mode and glitchy in game mode, like this:

    scene mode
    s1.png

    game mode
    s2.png


    Eventually i landed on the "Render Scale" parameter in the pipeline asset, pumped it up to 2, and it now looks like this in game mode:
    s3.png

    Is this how TMP is supposed to work in URP? Or is this some sort of a soft glitch and should file a bug report?
    And btw, what's the render scale param anyway? I looked its definition in Unity docs, but still can't figure it out.
    Thanks!
     
    Sab_Rango likes this.
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,265
    In order for SDF text to render correctly, scaling information must be passed to it. As you are changing scale in URP, this is not something that TMP is accounting for (as I was not aware of this URP Render Scale) and as such the text will render either too soft or too harsh... ie at incorrect scale.

    I would suggest submitting a bug report with project and steps to reproduce the issue.

    Having said that, in the latest release of TMP which is Preview 13, the is a new shader included in the TMP Essential Resources. This shader has the suffix SSD at the end of it. This shader does not need scale to be passed to it and as such should render correctly in URP.

    So make sure you are using the latest release
    import the update TMP Essential Resources.
    Create a new text object and new material preset.
    Then change the shader to the "TextMeshPro - Mobile - Distance Field SSD"
     
    zhuchun likes this.
  3. AndreaEttorre

    AndreaEttorre

    Joined:
    Oct 9, 2015
    Posts:
    8
    Ok Stephan, i'll try that as soon as i can and report back.
    One thing i noticed, this might only happen when switching on the post processing on the camera (even if with no actual pp in the volume). I'll investigate further and let you know.
     
  4. AndreaEttorre

    AndreaEttorre

    Joined:
    Oct 9, 2015
    Posts:
    8
    So i imported the preview 13 and its essentials, re-created the font atlas and changed the shader to the new SSD ones. It returns these errors (i've tried both the SSD shaders, and also tried converting to URP with no success), so it's basically not compatible with URP.

    s1.jpg
     
  5. AndreaEttorre

    AndreaEttorre

    Joined:
    Oct 9, 2015
    Posts:
    8
    And it's definitely something with the post processing in the new URP. If i check the Post Processing checkbox on ANY camera in the stack, the text gets glitchy. That "Render Scale" parameter has nothing to do with the glitch, if i get it back to 1 (standard value) and disable all post processing checkboxes on all cameras, TMP gets crisp again.
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,265
    Can you submit a bug report so we can have the URP and Post Processing folks take a look?
     
  7. AndreaEttorre

    AndreaEttorre

    Joined:
    Oct 9, 2015
    Posts:
    8
  8. AndreaEttorre

    AndreaEttorre

    Joined:
    Oct 9, 2015
    Posts:
    8
    For anyone reading this later on, i figured it out just before sending the bug report.
    I had the Fast-approximate anti-aliasing active on the camera/s. Changing the anti-aliasing function to None or SMAA fixed the issue. The font was just getting "anti-aliased" as intended.
     
  9. ado20

    ado20

    Joined:
    Feb 27, 2015
    Posts:
    6
  10. ristophonics

    ristophonics

    Joined:
    May 23, 2014
    Posts:
    32
unityunity