Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro [SOLVED] Disappearing texts: Linux + OpenGL + AMD GPU

Discussion in 'UGUI & TextMesh Pro' started by OndrejP, May 9, 2020.

  1. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    303
    I have a strange issue with TextMeshPro

    During loading, some UI texts disappear.
    It's during loading, because texts disappear from Loading screen as well.
    It happens in final 10% of loading, which is scene activation.
    When I return to main menu, where texts worked, they're gone as well.
    No errors or warnings in log.
    It's only texts sharing one specific material.
    When I change to Chinese (which uses different atlas), the texts are visible.
    When I change back to English, the texts disappear again.

    Now this happens only on Linux with OpenGL API and AMD GPUs, to be more specific:
    Ubuntu 19.04 & 20.04, Kubuntu 19.10, works on Windows with OpenGL
    OpenGL 4.5 & 4.6, works on Vulkan
    Radeon RX580, RX590, 5700 XT and few others, works on nVidia
    "standard" GPU driver Mesa 19.3 & 20.0

    Do you have any idea what it could be and where should I start?
    The weird part is that it breaks Main menu after returning to it from game, it could be something breaking an asset (material, atlas...).

    I'm making few builds to test:
    1) SDF Mobile shader
    2) OpenGL renderer on Windows with RX580 (EDIT: tested, works well on Windows)

    The white text stays, the only difference between this and missing text is color, otherwise the materials are identical.
    upload_2020-5-9_9-50-48.png
     
    Last edited: May 9, 2020
    cxode likes this.
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Do you have a mixture of <TextMeshPro> and <TextMeshProUGUI> text objects in the scene that happen to share the same material presets or perhaps a mixture of text object in Screen space overlay and Screen space camera or Worldspace? Although this would not be limited to just one platform, it is still worth investigating.

    Are you using an UI Masks or RectMask2D?

    The text completely disappearing, could also be (as you speculated) the result of the text object / material still having a valid reference to the texture but Unity internally not having the correct reference which I have seen before.
     
  3. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    303
    They all share same font asset and atlas, they should use different materials.
    But there might be an error and some might share material, I'll check that.

    Yes, few elements are using UI Masks and/or RectMask2D?
    Is there any possible issue with that I should be aware of?

    Hmm, regarding missing references, that's weird. I cannot image under what conditions would the reference to Font asset and/or atlas go missing.

    Since this is happening only on AMD + OpenGL + Linux, I'm starting to think that this might be related to some parameter in shaders (constant buffer) issue. Atlas obviously works - white texts are there.

    So the difference when binding material to render pipeline is constant buffers and then maybe some render state (stencil state, z-writes, blend states, etc...).

    I'll make few builds with different materials and all masks disabled everywhere and check that UI materials are not used in world space texts. Hopefully it will provide some more info.
     
  4. OndrejP

    OndrejP

    Joined:
    Jul 19, 2017
    Posts:
    303
    OMG, it works!

    I've found few instances of TextMeshPro using material, which was meant for UI. When I fixed that, it started working.

    My conclusion is:
    TextMeshPro and TextMeshProUGUI cannot share same material.

    If you'd like me to help you pinpoint the issue, please let me know, I can test things easily on my system.
    My guess is that "something" happens to material, which breaks it for UI rendering.
    This something might be for example material.SetKeyword or other material.SetXYZ call.

    Anyway, thank you for help, I wouldn't find it by myself.
     
    cxode likes this.
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    This behavior is due to the fact that we have (2) different type of renderers with different requirements fighting over material property settings like ZTest of the shared material. Depending on code execution, drawing and sorting order and other factors, you end up with one renderer setting material properties for its needs to then have it changed by the other which causes the issue.

    The solution to avoid this issue is to simply use two different set of Material Presets. One for the MeshRenderer and another for the Canvas objects.
     
    cxode likes this.