Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TextMesh Pro Text Stencil Style Shader

Discussion in 'UGUI & TextMesh Pro' started by BinaryCats, Jun 14, 2019.

  1. BinaryCats

    BinaryCats

    Joined:
    Feb 8, 2016
    Posts:
    317
    Hello,

    I have some transparent text in my UI. This text sits across transparent Images.

    I want it so wherever the text overlaps the image, the image behind is not rendered. My first goto was creating a stencil shader, by minorly editing the TextMesh Pro's shader

    This is the result: (I have a black skybox) (text / green image / red image have 50% transparency)

    The intended result is for the text to render as white(with 50% transparency) ontop of the images (not tinted green/red by the images behind)

    However you can obviously see the whole glyph, the stencil creating a black box around each letter.


    Has anybody done anything like this before? How can I go about achieving my desired effect?

    Thanks in advance