Search Unity

TextMesh Pro Bad rendering artifacts when canvas is very small and rotated

Discussion in 'UGUI & TextMesh Pro' started by CityWizardGames, Apr 24, 2018.

  1. CityWizardGames

    CityWizardGames

    Joined:
    Nov 6, 2013
    Posts:
    21
    We have a use case where we have to scale our canvas to about 0.0002f (both X & Y). Width & Height are screen resolution (usualy 1920x1080). We found that in this case, if you then rotate the text or the canvas, there are some rotation points at which TextMesh Pro components render very poorly and look very "blocky".

    The example I provided requires you to open the scene in a project with TMP, I wasn't able to package all of TMP in the zip because it said upload was too large with that.
     

    Attached Files:

  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The artifact on the small text is due to the ratio of Sampling Point Size to Padding being too small on the Font Asset. See FAQ Question 2 and 11 for more insight.

    In addition, with small text you might need to enable the Extra Padding on the text object inspector panel. Also make sure, the Perspective Filtering in the Debug section of the Material Inspector is not contributing to this. It should not be the case but still worth exploring.
     
  3. CityWizardGames

    CityWizardGames

    Joined:
    Nov 6, 2013
    Posts:
    21
    Hey Stephan, so we tried increasing the padding on our font asset from 5 to 20 but that didn't do the trick. Enabling 'Extra Padding' changed how it rendered but still did not look how we wanted it to.

    But changing value of 'Perspective Filtering' from 0.875 to 0 did the trick! So far it looks like this has completely fixed the problem. Thanks for the advice.
     
    maewionn likes this.
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    Just in case anyone is curious. Perspective filtering softens the edges of the text when viewed at sharp angles. When using a perspective camera (like in the example 24 - Surface Shader included with TMP) it works well. However, I have run into some scenarios with other camera setup where it can have unexpected results.

    For my curiosity, what type of camera are you using in that Scene? Orthographic or something?
     
  5. CityWizardGames

    CityWizardGames

    Joined:
    Nov 6, 2013
    Posts:
    21
    We're actually using a custom type of stereo camera, that is similar to the perspective camera but uses it's own off-axis projection matrices that are defined by us.
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    That would explain why the Perspective Filtering was causing this behavior.
     
  7. maewionn

    maewionn

    Joined:
    Jan 18, 2016
    Posts:
    38
    For all people finding this in the future (since it popped up quite far up in my google search):
    The "Perspective Filtering" can be found in the Material (on the bottom of the TextMeshPro Gameobject), under Debug.

    Had the same issue, with a normal perpective Camera, but quite sharp angles.
     
    asafsitner likes this.