Search Unity

TextMesh Pro Possible to mask world-space TextMeshPro objects?

Discussion in 'UGUI & TextMesh Pro' started by Brody-TOG, Mar 3, 2021.

  1. Brody-TOG

    Brody-TOG

    Joined:
    May 7, 2020
    Posts:
    15
    Hey there!

    I'd like to have a moveable mask I can use to render parts of a world-space TextMeshPro object invisible. I see how to do that with a Mask component with TextMeshProUGUI objects when everything is on a Canvas, but is this possible right now with non-UI objects?

    Thanks!
     
  2. Brody-TOG

    Brody-TOG

    Joined:
    May 7, 2020
    Posts:
    15
    Sorry to bump.

    Don't know if this is just the wrong place to ask this, but it feels like it has to be something that's been done before. I just have no clue how to go about it.
     
  3. shortenda

    shortenda

    Joined:
    Sep 30, 2017
    Posts:
    5
    Did you ever figure this out? :)
     
  4. april_4_short

    april_4_short

    Joined:
    Jul 19, 2021
    Posts:
    489
    World space masking as a whole is not a thing in Unity, unless you want to learn shaders to a level I can't even begin to imagine.

    This is, to my mind, somewhat of an oversight.

    But they're busy making a new UI system that should be finished in about 3 to 5 years. By which they seem to mean - reach parity with the existing UI system.

    Shader approach I can describe, but cannot possibly code:

    1. Create geometry that's representative of the mask you want - position accordingly
    2. Load this into a _your_masking_vertex_array in the shader that's doing the rendering you actually want
    3. Somehow use the world position of the camera relative to your desired object vs your mask to occlude or blank out the rendering of fragments as necessary, by some magic in the vertex shader that informs it of where to not and where to do.

    There must have been something like this made for the asset store, that works across all sorts of things, but I don't even know what the terminology is to describe this.