ZTest for Draw.Text

Avatar
  • updated
  • Completed

Hi,

I am using the Immediate-Drawing Mode and realized that Text is not affected by the ZTest you set via Draw.ZTest. Since I wanted to have everything made with shapes appear on top of everything else, the ZTest helps but only for everything but Text.

So I dived a bit deeper into the code of Shapes/shader code of TextMesh Pro. I found out that the shader of the material from the font (Shapes/Textures/Consolas SDF/Consolas SDF Material) uses [unity_GUIZTestMode] as ZTest. At first, I made my own property to switch the ZTest but it also works to change the shader of the material to 'TextMeshPro/Distance Field Overlay' if ZTest needs to be 'Always'. I think the former method would be the better one but this decision is left to you. :) However, this might need to be applied to different (imported) fonts, too. Can't imagine how difficult this might be. Or maybe there is a way of switching ZTest for text already implemented in Shapes that I could not figure out. ;)

Anyway, I just wanted to let you know.

Reporting a bug? please specify Unity version:
2019.4.11f1
Reporting a bug? please specify Shapes version:
2.3.2
Reporting a bug? please specify Render Pipeline:
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Completed

fixed in 3.0.0 - ZTest of text will now be read from the static Draw.ZTest just like other shapes

Avatar
Freya Holmér creator
  • Answer
  • Completed

fixed in 3.0.0 - ZTest of text will now be read from the static Draw.ZTest just like other shapes