Search Unity

TextMesh Pro Changing resolution glitches/corrupts TextMeshProUGUI on Xbox One

Discussion in 'UGUI & TextMesh Pro' started by AGSMarcinDraszczuk, Jun 22, 2018.

  1. AGSMarcinDraszczuk

    AGSMarcinDraszczuk

    Joined:
    Mar 31, 2015
    Posts:
    30
    Hello,

    we've noticed that changing screen resolution in runtime causes random glitches on TextMeshProUGUI objects. This happens when switching from 1080p to 4K and back, but we've also tested switching between 1080p and 720p and it also caused glitches to appear (only that they were bigger).

    Here's a screenshot of what the glitches look like:



    And here's a high quality video where you can see the issue in detail:

    http://www.awesomegamesstudio.com/_tmp/TextMeshProGlitch.avi

    You can notice that the glitches are relative to the screen and not to the text in the second part of the video where the "Night 1" text zooms in over time.

    We've updated to TextMesh Pro Release 1.2.2 - Unity 2017.3 to see if it would solve the issue, but it didn't - the video above is running this version. We've previously been using 1.0.56 I think, and the glitches looked somewhat different on that version:



    If you need any more information please let me know.
     
    Last edited: Jun 22, 2018
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Are you using any texture on the text itself? It looks like just plain text with an outline but just making sure?

    Do you have any post process as these artifacts appear to be coming from some other texture somewhere? Texture compression maybe on whatever this other thing is?
     
  3. AGSMarcinDraszczuk

    AGSMarcinDraszczuk

    Joined:
    Mar 31, 2015
    Posts:
    30
    No, we're not using any texture, it's just plain text with an outline. We've disabled rendering of the entire scene except for the UI and te glitch was still present. We're trying to narrow the issue down to the smallest reproduction possible, but some other issues came up and we'll have to address them first as the game is already out. I'll update the thread if we find any new information.
     
    Stephan_B likes this.
  4. AGSMarcinDraszczuk

    AGSMarcinDraszczuk

    Joined:
    Mar 31, 2015
    Posts:
    30
    We were able to get a really simple reproduction, here's a youtube video:


    And the reproduction project can be downloaded here:
    <Link removed>

    Please let me know when you have downloaded the file.
     
    Last edited: Jun 28, 2018
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thank you for providing the Repro project which I have just downloaded.

    I am travelling this week but will be back over the weekend and should be able to look into this next week.
     
  6. AGSMarcinDraszczuk

    AGSMarcinDraszczuk

    Joined:
    Mar 31, 2015
    Posts:
    30
    Thanks. It looks that the corruption is caused by changing the font on TextMeshPro object (not UGUI), but affects TextMeshProUGUI objects as well. Maybe it's something about the font itself, but this is the furthest we were able to narrow it down so far.
     
  7. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I believe the issue is the result of having a mixture of <TextMeshProUGUI> and <TextMeshPro> objects which share the same material. In such case, the Canvas system and the Mesh Renderer are fighting over the ZTest on the shared material which can produce similar behaviors.

    The solution is to use a different set of material presets for objects that use the Mesh Renderer (like the <TextMeshPro> objects) and a different set of material presets for the text objects using the Canvas and Canvas Renderer.

    Create another set of material presets for the objects using the Mesh Renderer and let me know if that solves the issue.

    P.S. While looking at the example you provided, I notices that some of the material properties are using the max range value of 1 which I don't recommend since this means we are reading right at the edge of the adjacent character in the atlas. As a rule of thumb, whenever you feel the need to set these values to something larger than 0.8, it is usually indicative that the padding value relative to the sampling point size is too small.

    Just in case you were not aware, the ratio of sampling point size to padding, determines the effective range of those material properties. For instance, a sampling point size of 80 with padding of 4 will give you a very limit range on properties like outline whereas a sampling point size of 80 with padding of 8 will give you 2x the range. For typical use, I recommend having a ratio of 10% or more. In the case of your font, the sampling point size is 87 with padding of 5 which gives you a limit range on dilation, outline, etc which is most likely why you are using values at max.
     
    novastrangers and Joelspeanuts like this.
  8. AGSMarcinDraszczuk

    AGSMarcinDraszczuk

    Joined:
    Mar 31, 2015
    Posts:
    30
    Thanks a lot for looking into it! Our console programmer is out of office this week, but we'll try your suggestion when he's back and confirm if it solved the issue.

    Also thanks for the suggestion about padding, we'll probably leave it as it is because we're happy with how it looks now, but we'll keep it in mind for our future projects.
     
    Stephan_B likes this.
  9. AGSMarcinDraszczuk

    AGSMarcinDraszczuk

    Joined:
    Mar 31, 2015
    Posts:
    30
    Yes you were right, after creating a separate material for TextMeshPro object the issue disappeared. Thanks again!
     
    Joelspeanuts and Stephan_B like this.
  10. Joelspeanuts

    Joelspeanuts

    Joined:
    Oct 5, 2016
    Posts:
    8
    Had the same problem, but we fixed it by basically doing the stuff mentioned in this post!

    The glitch also applied to a tiled background image on one of our screen space overlay canvases, which threw us off for a little while. In the end, changing all our instances of TextMeshPro into using World Space canvases with TextMeshProUGUI solved the problem.

    The TextMeshPro-objects we removed used the same TMP font as the TextMeshProUGUI objects that were glitching out in our screen space overlay canvases.



    Only appeared on Xbox builds.

    (Running Unity 2018.4.24f1)
     
  11. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Thanks for sharing this information.

    Ran into another case last week where I believe in addition to the potential ZTest issue, we might also be looking at another issue which is related to the Stencil buffer perhaps not getting cleared correctly in the Canvas code.

    This would explain why instead of objects disappearing which is usually the ZTest issue, we get these strange patterns in the text.

    Do you have any text objects that are using a UI Mask in your scenes? If so, I would be curious to see if the issue still occurs if you remove the UI Mask component.
     
  12. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    @Stephan_B

    I'm seeing this issue in a build (when changing resolution). Have checked every instance of TextMeshPro and TextMeshProUGUI and confirmed that they are all using the correct material presets.

    We're not using any UI Mask components, all our canvases are Overlay.

    One interesting thing is that our game is localised, and if I switch fonts (by changing language) the text reappears. On switching back to the original font set, they disappear again. (The way I've set up the localisation system, each font has an identical set of material presets that are switched when the font is replaced.)

    We also have an issue with a UI Graphic disappearing. I'm not sure if that's related. Pretty confused at this point.

    Just wondered if you had any other ideas for the potential cause?
     
  13. flashframe

    flashframe

    Joined:
    Feb 10, 2015
    Posts:
    798
    Oh, interesting

    Debugging the material presets while running, it appears some of the material presets for UI text in a prefab are being changed to the world space presets. So that may be be the problem (I assume somewhere in my code).

    Sorry to derail this thread