How do you prevent TextMeshPro to reset the canvas additional channels?

Since I have changed my canvas to camera mode, it displays text like this:

7531766--929870--upload_2021-9-29_7-22-48.png

I have traced it back to the additional channels and when disabling normal it displays correctly. However as soon as I start in play mode the normal channel is reenabled by TextMeshPro…

I know it is TMP because when disabling/reenabling the TMP component it also resets the channels.

So, is there a way to fix this other than using normal Text rather than TMP?

1 Like

I can somehow fix this by reducing Dilate under 0:

I have tried disabling the channels in code but it only works in Update() because apparently the mask is overriden every frame:

            var canvas = GetComponent<Canvas>();
            canvas.additionalShaderChannels = AdditionalCanvasShaderChannels.None;

These additional shader channels are needed for the text to render correctly. Although Normal and Tangents are not needed with plain text, having the Normal and Tangents still passed to the shader has no measurable impact even on the slowest mobile devices.

I understand but why does the text background change like that when the canvas is set to screen space camera?

It was working perfectly in overlay mode. Changing dilate is a workaround but far from ideal

7534514--930368--upload_2021-9-30_4-29-47.png

ETA: never mind it fixes itself when I hit play, it seems to be an editor mode only issue…

When you modify those Additional Shader Channels, were you disabling TexCoord1?

If so, TexCoord1 contains the SDF scale which would impact text rendering. Like I said those additional shader channels are used by the TMP shaders and have to be enabled.

I haven’t disabled any shader, I have noticed that disabling them would fix the blurry display issue but it turned out that TMP switched them back on. Actually it is an issue with the normal channel, but since it does not occur in play mode it’s not such a big deal as I first thought it would be.

Ok, I’m sorry but the problem was not solved: I forgot to remove the code in Update() that sets the masks to None. However I noticed some strange flickering and realized that. After looking around a bit longer I have figured out that setting the UI camera to Orthographic helps a lot:

In scene view:

7538117--931055--upload_2021-10-1_14-22-50.png

Game view orthographic:

7538117--931058--upload_2021-10-1_14-23-17.png

Game view with camera perspective:
7538117--931061--upload_2021-10-1_14-24-8.png

I think it’s still lesser quality than the scene view display but it’s maybe caused by scaling.

Is the icon of the chess piece contained in the same font file?

Make sure the sampling point size to padding ratio of that font asset is at least 10%.

Also check perspective filtering in the debug section of the material inspector and see if setting it to zero helps.

And for testing purposes, do not alter the Additional Shader Channels.

1 Like

The chess piece is from one of the merida chess font files. I have checked the ratio and it was 98/5 so i changed the padding to 10 and it became 85/10.

Perspective:

7539116--931220--upload_2021-10-1_19-51-39.png

Orthographic:
7539116--931229--upload_2021-10-1_19-53-11.png

Scene:

7539116--931223--upload_2021-10-1_19-52-17.png

Thanks, that helped some more.

ETA: Finally solved it by reverting the canvas to Overlay, it was my mistake here but I don’t regret it because I’ve learned a few interesting things on the way :slight_smile:

I still have this issue as my canvas is set in world space. The font is blurry at certain distance which makes it unsuable due to the fact that the scaling is pretty small (ex 1920x1080) @ .001f or maybe .002f. I can play with different settings but at the end of the day it looks like OPs perspective view when using VR. I disable it in the editor but it reenables it and the problems start again. Is there a fix for this yet? Hard to get crisp TMP text… I am using 2021.2.14f

Or maybe Unity could Create a custom bool … “BlockShaderChannelEnable”.

Is it possible for yall to create something for people using VR/XR? When using world canvases to disable the extra channels and prevent them from enabling with the Unity Subsystems? It literally fixes all the problems and makes unity worldspace canvases useable in high quality for XR/VR per my testing. The problem is that Unity somewhere kees reenabling it randomly.