I made this by using stencil buffer
Stencil Op/Comparison Values
0 - Always
1 - Never
2 - Less
3 - Equal
4 - LEqual
5 - Greater
6 - NotEqual
7 - GEqual
8 - Always // (This is the default for the UI shaders so I suspect this one is technically the 'correct' Always, but any value beyond it will also count as Always)
0 - Keep
1 - Zero
2 - Replace
3 - IncrSat
4 - DecrSat
5 - Invert
6 - IncrWrap
7 - DecrWrap
References:
I explained more about UI stencil Buffer here
change your properties like this:
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Int) = 0
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Int) = 0
I explained here how to mask Textmesh Pro