TextMesh Pro Colors highly inaccurate

How do you use Material Property Blocks in this way?

What do you do to make it work?

Pretend I’m stupid. Secret: I am!

FYI: I did update the shaders and code in the latest preview of the TMP package to correctly handle Linear vs. Gamma color space for the normal TMP component.

3 Likes

It is no longer necessary after @Stephan_B update, but here it is:
I simply created a MPB instance in script and set _FaceColor value with my desired color and applied it to the Mesh Renderer of the text.

            softTitleTextMPB = new MaterialPropertyBlock();
            softTitleTextMPB.SetColor("_FaceColor", Color.black);
            softTitleTextMR.SetPropertyBlock(softTitleTextMPB);

You can learn more about MPBs from this nice article:
https://thomasmountainborn.com/2016/05/25/materialpropertyblocks/

1 Like

I’m running into this same issue. In the UI text components, the color seems correct. On the world space texts though the color is incorrect. I’m on TMP 3.0.6.

Please give version 3.2.0-pre.3 a try as I did make changes related to color space. Please be sure to read the upgrade notes and to re-import the TMP Essential Resources has the shaders have changes as well as some other resources.

1 Like

I’m still seeing color issues with text outlines in Unity 2022.1.5f1 even after updating TextMeshPro to 3.2.0-pre.3

I have re-imported the TMP Essential Resources.

I see the correct outline colors on the fonts if I switch the color space from linear to gamma, but my project relies on the linear color space. Anything else I can try?

Thanks Stephan, upgrading to the 3.2.0-pre.3 package and reimporting TMP Essential Resources resolved the color issue for me.

1 Like

Hey Stephan,
We tried this and are still having issues. Do you know if there’s a workaround we can use currently? We’re in unity version 2021.3.8 currently.

Are you using version 3.2.0-pre.3 and did you re-import the TMP Essential Resources which include the updated shaders?

Stephan,

Yes, I attempted with the updated version 3.2.0-pre.3 and reimported the essentials package. Please see the following screenshot of the outline color selector after making this change.

We are using the “TextMeshPro/Mobile/Distance Field” shader, maybe the fix you released in the preview version did not work for this one?

Edit: I have gone through and tested the other distance field shaders, they all still have the issue as well.

Thanks and I look forward to hearing back!
8439740--1118366--upload_2022-9-14_8-42-7.png

Hello I noticed that very often Text mesh pro colors materials are wrongly not full white (even if are 100% white) they are grey, it seems that it happens very often after going of or playmode/buildign game. Only one way to fix it is to restart unity

Hi! Is there an update to that issue?

2 Likes

+1

I’ve found that if you use the ‘Vertex Color’ field to choose the color you want, then copy and paste that color from the vertex color into the HDR color field of the Distance Field shader, then set the vertex color back to white, you end up with the correct color on the object.

+1

I reported bug and got answer:

So I wouldn’t wait for official solution of the problem.

3 Likes

Strange that fixing bug is " issue is not aligned with our current development priorities". Fixing bugs should always be a priority :slight_smile: but thanks for letting know

2 Likes

Encountered a similar problem, in my case related to canvases for which “Vertex Color always in gamma color space” field was checked.
Works fine for normal UI Elements, so I decided to compare the TMPro shaders with the default shaders.
Turns out, TMPro shaders are missing the needed conversion between linear and gamma color space. Here is my solution:
add

int _UIVertexColorAlwaysGammaSpace;

just under _UIMaskSoftnessY.
In the VertShader, add this just after the line output.color = input.color:

            if (_UIVertexColorAlwaysGammaSpace)
            {
                if(!IsGammaSpace())
                {
                    output.color.rgb = UIGammaToLinear(output.color.rgb);
                }
            }
6 Likes

This situation is far worse than many others (Legacy Animation, FMOD, Input, etc). There’s no other way to make diegetic UI of any sort without TMP for the foreseeable future. Some effort needs go into making it and the canvases that hold it as performant as possible whilst we struggle on for the next 5+ years waiting for Unity to realise UIToolkit was a good idea for the Editor UI, but not nearly sufficient for motion graphics style game menus and all the little (and big) stuff that happens in game worlds in world space.

As a workaround, I made a little tool for myself that adds a color picker to the TextMeshProUGUI component that converts the picked color to a working one. Maybe someone will find it useful too.

5 Likes