Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TextMesh Pro TextMesh Pro Colors highly inaccurate

Discussion in 'UGUI & TextMesh Pro' started by fyn_ng, Jun 11, 2019.

  1. fyn_ng

    fyn_ng

    Joined:
    May 11, 2018
    Posts:
    2
    I'm having an issue where if I'm changing colors via Vertex Color alone from the TMP component in inspector, the color is not accurate. I've noticed that Vertex Color takes into account the material color and does some math on top of it. In order to get the exact color to show up, I have to do either of these two steps.

    1. Only change TMP color via the material itself, which means I have to create a new material preset everytime I have a new color I want to use for text. This gets messy really fast and my project will be overflowed with materials.

    2. I have to edit both Vertex Color and Color Gradient with the same color value to get the exact color to show. Even if I uncheck Color Gradient, TMP still takes the it into account.

    Is there a more efficient way of doing this correctly via the inspector? It is a steep learning curve to try and understand this process for new users who are used to design software that lets you edit color in a simple, straightforward manner. Appreciate any advice, thank you.
     
    Last edited: Jun 11, 2019
    ertugrulerdogan likes this.
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,660
    The Material color will always affect the Vertex Color. If the Material Color is 255, 255, 255, 255, then whatever the Vertex Color is set at is what will be used.

    The Vertex Color is unique to each text object. The Material color is shared by all text object using this same material.

    Please provide more detail on how the Vertex Color is not accurate when leaving the material to the default white?
     
  3. fyn_ng

    fyn_ng

    Joined:
    May 11, 2018
    Posts:
    2
    Hi Stephan_B, thanks for the reply. I just realized that if the Player > Other Settings > Color Space is on Linear, what I described will happen. But on Gamma, what you described will happen. Is there a solution if for achieving the same result in Linear?
     
  4. Tortuap

    Tortuap

    Joined:
    Dec 4, 2013
    Posts:
    99
    Hi @Stephan_B , I have the exact issue here.
    Are texts rendered with a gamma correction while in Linear mode ?
     
    bali33 likes this.
  5. unity_FGs7Rwoa9O-xNQ

    unity_FGs7Rwoa9O-xNQ

    Joined:
    Nov 30, 2020
    Posts:
    1
    Seems like the HDR color picker is used by default for all material colors in TMP. Replacing a line in DoColor method in TMP_BaseShaderGUI.cs seems to do the trick, but you need to modify the code inside the TMP package.

    Set the hdr parameter to false.

    Code (CSharp):
    1.  
    2. Color value = EditorGUI.ColorField(EditorGUILayout.GetControlRect(), s_TempLabel, property.colorValue, false, true, false);
    3.  
     
  6. FlorianBernard

    FlorianBernard

    Joined:
    Jun 9, 2015
    Posts:
    146
    Just noticed the same issue. Same color code on my icon (URP/Unlit shader) and TMP text, different results.
    As mentioned above, setting up the color on the material itself does fix the issue but it's obviously far from ideal.
     
  7. dshook

    dshook

    Joined:
    Jul 14, 2015
    Posts:
    11
    Same issue here, had to turn it off as suggested inside the package to get it to work.

    Would be nice to turn off HDR colors entirely for the project/package
     
    SBods9A likes this.
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,660
    Please see if removing the [HDR] attribute in the SDF shader that you happen to use resolves the issue.

    Since these shaders are contained in the TMP Essential Resources which were imported in your project, this would make it easier to handle until I can figure out what is going exactly with this.

    TMP_SDF-Mobile shader

    upload_2021-4-16_0-25-35.png
     
    mishasniper likes this.
  9. AlliBee

    AlliBee

    Joined:
    Sep 9, 2020
    Posts:
    8
    Had the same issue. Changing on shader did not work for me, changing directly on package like unity_FGs7Rwoa9O-xNQ said, did work.

    Before:
    upload_2021-4-23_15-46-22.png

    After:
    upload_2021-4-23_15-46-40.png
     
  10. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,660
    Thank you for the feedback. I will have to test both these things then.
     
    SBods9A likes this.
  11. SBods9A

    SBods9A

    Joined:
    Sep 12, 2018
    Posts:
    1
    We are facing same kind of problem when creating an animation clip that set the face color of the material, when creating an animation that set the exactly same color as base, the color result appear wrong.
    We need to deactivate HDR in the shader and edit the code in the package as unity_FGs7Rwoa9O-xNQ said to have the desired color.
    It could be great if we have the choice to switch on or off the HDR support
     
  12. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,660
    I need to look into this to figure out what is going on. Most likely this is something the graphic team will need to address as having this HDR attribute should not be affecting colors.

    Could one of you please submit a bug report on this? If so, please post the case # once you have it and I will make sure to forward this to the graphic team.

    P.S. Obviously, I can add / remove these HDR attributes or make the code changes but this seems like something we should not have to do.
     
unityunity