@Stephan_B I’m using the mobile mask shader for TMP and not having any luck. Is there documentation somewhere on how it works? Does the Mask Texture use alpha or white/black to determine cutoff? Does the Clip Rect affect how the Mask Texture is stretched across the paragraph that it is masking? What about Scale X and Scale Y?
I ask because basically any mask texture is acting as if it’s a single point. If Wipe Control is past a certain point, it’s all on. Otherwise the whole TMP is masked off.
@Stephan_B To be clear, I’m just looking for info on the TextMesh Pro UGUI Mobile Masking shader (the Debug Settings). The problem is that animating the Wipe Control is just fading in and out the entire TextMesh Pro UGUI object as if it was only sampling a single point.
I’m using a TextMesh Pro UGUI components though. Are you saying that the Clip Rect properties in the Debug Settings are overwritten by the bounds of the Rect Transform of the gameobject? It’s currently only fading the entire TMP UGUI object out as if the entire object was covered by just a few pixels of mask or something.
When using the Canvas System, the Clip Rect is controlled by the 2D RectMask.
It is fading because the region is super large and as such give the illusion of fading. Add a 2D RectMask as a parent. This results in the Clip Rect (internally) matching the RectTransform of the 2D RectMask.
By the way, I may be seeing the same issue as the poster below where the textmesh pro UI object is just fading in and out and ignoring the texture mask:
It is the property used by the Canvas system / 2d RectMask which defines the clipping region. The 2D Rect Mask uses (and overrides these values) when using the Canvas system. The Canvas system sets that up per Canvas Renderer whereas on the individual material it is for each text object that shares this material.
I’ve seen examples where it’s set to {-10, 10, -10, 10} and others where it’s in the -32k to 32k range. Does it matter what this is set to? Either way, it doesn’t seem to help my problem with the whole text fading out as if it was covered by a single pixel of the mask texture…
The fading part is simply an illusion / the result of the fact the Clip Rect is super large and as such the gradient in the texture that is used to fade / soften the edge is so spread that everything fades at once.
To reproduce this, create a new scene and add a Canvas. Create a GameObject as a child of the Canvas. Add a 2D RectMask to it.
As you can see above, the size of the circle matches the size of the parent RectTransform that contains the 2D RectMask. Here I have good control over the softness on the edge and wipe, etc.
Now if you change the size of the parent RectTransform and set to 1000 x 1000 but keep the text object size at 100 x 100, when you now move the Edge Softness and Wipe Position, you will see that the object now appears to fade. At 1000 X 1000, we can still see part of the edge / softness but at 32K X 32K using a 64 pixel x 64 pixel texture, the image simple turns on or off (almost).
Ie. The size of the 2D RectMask RectTransform defines the Clip Rect which the Canvas system sets to infinity unless the parent has a 2D RectMask on it.
Sorry for necroposting, but if you are experiencing problems with arbitrary masking, and your project is old enough, try recreating font assets from scratch. Simple reimport and “regenerating textures” won’t work.
I had a case, where arbitrary image masking did not work, because my font assets were generated at a time when TMPro just became a part of Unity official team, so stuff was being ironed out back then.