Search Unity

TextMesh Pro and Linear/Gamma Color space rendering issue

Discussion in 'UGUI & TextMesh Pro' started by camilleviotaltran, Dec 13, 2018.

  1. camilleviotaltran

    camilleviotaltran

    Joined:
    Nov 5, 2018
    Posts:
    3
    Hi all,

    I am developing a product visualization product with Unity to run on low end computers. To save performance I didn't put any light in the scene and use a single HDRI to light it. As expected the rendering is better when using the linear color space so I ended up switching for it.

    But I noticed that the text rendered by TextMesh Pro didn't have the same appearance when using Linear vs Gamma color space. It turns out that the rendering is better in Gamma color space and the Text is more blurry in Linear color space (see attached pictures).

    Even with an atlas generated by a custom font I am not able to switch the texture from Linear to sRGB (because the TextMesh Pro shaders probably assume the texture to be sRGB encoded) since there is almost no options for it (see attached image).

    At this point I have a few questions:

    Did I miss something so I can have the same rendering of text in Linear color space?
    If no, this is probably a bug (or lack of feature) of TextMesh Pro. Then, should I open a bug for that?

    Regards
     

    Attached Files:

  2. IcyHammer

    IcyHammer

    Joined:
    Dec 2, 2013
    Posts:
    71
    There is same problem with unity UI and it seems that they can't fix it and it's been known for years.
     
  3. xLeo

    xLeo

    Joined:
    Sep 21, 2010
    Posts:
    194
    Resurrecting this post: just use the shaders attached to Shaders.zip
    Replace the ones from TextMeshPro.

    The main point here is to include the Gamma to Linear color correction, which most of Unity's UI built-in shaders already contain:
    Code (CSharp):
    1. if (_UIVertexColorAlwaysGammaSpace)
    2. {
    3.       if(!IsGammaSpace())
    4.      {
    5.            input.color.rgb = UIGammaToLinear(input.color.rgb);
    6.      }
    7. }
     

    Attached Files:

    pia120, karliss_coldwild and leobilck like this.