Text Mesh pro does not render correctly next to Alpha-supporting shader

I have recently started using Text Mesh Pro in my project, but now I am having an issue with the way TMP objects render next to other objects that use shaders that support alpha transparency.
Here is what it looks like: https://i.imgur.com/esONjvg.jpg

As you can see, in the image there are 2 sections - one using TMP next to a linerenderer with an unlit shader (top) and another using TMP next to a linerenderer using Mobile/Particles/Additive shader (bottom). The upper image renders correctly in the sense that the linerenderer “pierces” the text and the box showing correctly first under both of them and then over both of them. The lower image has the same positioning of the elements, but while the linerenderer “pierces” correctly the box, it stays under the whole text instead of being half under, half over it. This gives a very jarring effect where the right side of the linerenderer renders both over the box and under the text, which is impossible.

Is that a TMP bug, or is it a general issue of using TMP elements next to elements using Mobile/Particles/Additive shader. How can this be resolved? Is there another compatible shader that supports alpha transparency but renders correctly?

Here is the Unity project TestTMP+Particles.zip - Google Drive

I should add that the situation reverses if most of the linerenderer is positioned in front of the TMP element - then the linerenderer always renders on top of the whole text, even if some part of the line is behind the text.

This behavior is not specific to TMP but to how transparent geometry is handled in general. See the following Answer about this subject.

1 Like

Great, thanks for the tip, I think I will go with having 2 linerenderers - one with alpha (with the “blue glow”) and the other with the central white solid line. That way only the glow will get occluded and the central white section will be properly overlayed.