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. Dismiss Notice

Post Processing + TextMeshPro - Unity Bug?

Discussion in 'UGUI & TextMesh Pro' started by TickTakashi, May 18, 2019.

  1. TickTakashi

    TickTakashi

    Joined:
    Mar 14, 2013
    Posts:
    31
    upload_2019-5-18_3-11-54.png

    Hi, I posted something about a similar issue a while back but no one responded, but have run into it again. As you can see, it seems as though the depth information used in post processing is incorrect for TMP objects - it looks like it's using the depth from the objects behind the text rather than the text plane.

    Is there a setting somewhere that fixes this? or is this a unity bug?
     
  2. TickTakashi

    TickTakashi

    Joined:
    Mar 14, 2013
    Posts:
    31
    For anyone else who comes across this problem in the future, it's related to the way that depth works in transparent shaders. You'll see the same issue if you use a transparent material on a 3D object or any 2D Sprite. As of now I don't have a good solution (mostly because I am not super familiar with shaders) but hopefully this can point someone who comes across the problem in the right direction.
     
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,438
    If you don't need to apply post processing to the text itself, you could render the text as UI element and set the UI Canvas(es) to Screen Space Overlay.

    If the text itself isn't using any alpha, you might also get away with it by rendering the text as opaque, in case TextMesh Pro provides this option, so the text writes to the depth buffer.

    Another option could be to render a depth pass for the text, see this document.
     
  4. OLGV

    OLGV

    Joined:
    Oct 4, 2012
    Posts:
    55
    This is definitely a bug.

    Attaching screen captures with PostProcessing FXAA and without FXAA:
    with PP-FXAA.png without PP-FXAA.png

    Also if changing to ScreenSpace-Overlay is even worse:
    ScreenSpace-Overlay.png

    In a nut shell, using TextMesh Pro with the PostProcessing Stack's FXAA leads to broken rendering of the TMP.

    This changes from case to case.
    Filed as bug.
     
  5. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Looks like the PostProcessing is altering the SDF Scale which is contained in the Y component of UV2.

    For testing purposes, try the SSD version of the TMP shader which does not require SDF Scale. The SSD variant of the shaders.

    upload_2020-6-19_13-34-32.png

    The SSD shaders were added in one of the Preview releases of version 1.5.0 / 2.1.0 and 3.0.0 of the TMP package. They are contained in the updated TMP Essential Resources.
     
  6. OLGV

    OLGV

    Joined:
    Oct 4, 2012
    Posts:
    55
    Thanks for the pointer @Stephan_B.
    Changing to the `Distance Field SSD` shader seems to break the font material.

    TMP v2.1.0, Preview 14.
    Screenshot 2020-06-23 at 16.22.01.png
    Screenshot 2020-06-23 at 16.24.02.png
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    The above point to a shader error.

    Try selecting that shader and using Re-import on it.

    If that does not resolve the issue, re-import the TMP Essential Resources using the Window - TextMeshPro - Import ... option.
     
  8. avishai_unity

    avishai_unity

    Joined:
    Dec 2, 2020
    Posts:
    7

    Hi, I know its been a while, But this seems to have no impact on textmeshpro being blurry due to fxaa, is there something to do about it?
     
  9. jwnder

    jwnder

    Joined:
    Sep 23, 2022
    Posts:
    1
    You will need to set the canvas on world space
     
  10. Kiran_Jodhani

    Kiran_Jodhani

    Joined:
    Mar 8, 2022
    Posts:
    2
    Hi
    Has anyone found solution for this?
    @Stephan_B Changing shader to Distance Field SSD does not work
     

    Attached Files:

  11. C0lonnello

    C0lonnello

    Joined:
    Nov 7, 2022
    Posts:
    24
    Hi, I'm here to find a solution to this same problem, I'm developing VR applications and so I need:

    - FXAA anti aliasing since it less performance-impacting the device than the SMAA
    - World Space canvas with texts

    Using the Distance Shader SSD doesn't change anything in the game view.

    Unity version is 2022.2.xx and this issue is kinda annoying, are there any way to not include text meshes in the antialiasing process?