Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

TextMesh Pro Easiest way to integrate HDR color support for TMP?

Discussion in 'UGUI & TextMesh Pro' started by xVergilx, Jun 2, 2020.

  1. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,292
    Hi, I'd like to add support for the HDR colors so that Text Mesh Pro texts (both UI & world space) could be affected by the bloom effect. (Using HDRP)

    Wondering, what would be the easiest way to do so?
    Duplicate shader + add custom shader gui?

    Vertex colors are clamped, right? So modifying editor is useless and the best bet is altering _FaceColor?
     
  2. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,292
    Adding HDR to the _FaceColor shader property + cloning inspector + adding HDR to the color field did the trick for me.
    Not really update-friendly way, but hey, it works.

    If there's other easier way to do that, please let me know. Thanks.
     
    agamiof likes this.
  3. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Latest release of the TMP package which is Preview 13 does contain updated shader in the TMP Essential Resources with support for HDR colors.
     
    Lennert-S and xVergilx like this.
  4. nickostan

    nickostan

    Joined:
    Jan 23, 2016
    Posts:
    12
    What is the shader called that I should change to in order to get HDR/emissive glow?

    I'm trying to get my text to glow:

    Code (CSharp):
    1. public class TMP_Glow : MonoBehaviour
    2. {
    3.     [ColorUsageAttribute(true, true)]
    4.     public Color textColor;
    5.     private void Update()
    6.     {
    7.         TextMeshProUGUI textMeshPro = GetComponent<TextMeshProUGUI>();
    8.         textMeshPro.faceColor = textColor;
    9.     }
    10. }
    I have bloom in my URP post processing stack, but it doesn't glow. I think I need to edit a shader? Why is this so hard? lol
     
    Last edited: Aug 4, 2020
  5. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Recently updated TMP shaders (included in the TMP Essential Resources) have new shaders with HDR color support.
     
  6. nickostan

    nickostan

    Joined:
    Jan 23, 2016
    Posts:
    12
    So which of these shaders do I use? Nothing seems to have HDR support in the inspector. Is there any documentation anywhere explaining what any of these shaders do?

    https://imgur.com/a/a5KSVRE
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Make sure that you are using the latest release of the TMP package which is version 1.5.1 for Unity 2018.4, version 2.1.1 for Unity 2019.4 and version 3.0.1 for Unity 2020.x

    In addition as per my previous post, you will need to re-import the TMP Essential Resources as the updates shaders are contained in it. All shaders now allow the color to be HDR

    upload_2020-8-4_12-49-56.png
     
    nickostan likes this.
  8. nickostan

    nickostan

    Joined:
    Jan 23, 2016
    Posts:
    12
    Thank you sir. Working great now -- Had to update TMP in Package Manager, then Reimport the assets, delete my previous atlas material, remake, reassign, and then change to HDR. Works beautifully. Thanks!
     
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Updating to the latest release of TMP via the package manager was required.

    Re-importing the TMP Essential Resources which contain the update shaders was also required.

    However, that should have been it and not require any changes to any atlas materials or reassigned unless you are using something custom somewhere.
     
    sarynth likes this.
  10. nickostan

    nickostan

    Joined:
    Jan 23, 2016
    Posts:
    12
    I see. Maybe I was just doing something stupid -- but my text went completely black and would not change color if I tried -- until I deleted and remade the material. Nevertheless, its working exactly as I want it now, so thank you! I very much appreciate your help on this, I have been trying to get glowing text for ages!
     
    Stephan_B likes this.
  11. GameEver

    GameEver

    Joined:
    Apr 28, 2020
    Posts:
    9
    @Stephan_B I was setting a face and outline color for my texts and I discovered the colores in the scene were looking different from what i wanted. Then i realized these properties are using HDR color by default and you can't even change it. Why is this? I don't understand the need for this. Most people use normal colors, there should be at least an option to change it from HDR.

    For those with the same problem, we managed to change the HDR color:
    We had to edit the class TMP_BaseShaderGUI and change the last boolean in this line from true to false:

    Code (CSharp):
    1.  Color value = EditorGUI.ColorField(EditorGUILayout.GetControlRect(), s_TempLabel, property.colorValue, false, true, true);
     
    Flazone and SBods9A like this.