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

Question Hiding UIs behind a custom image shader

Discussion in 'Universal Render Pipeline' started by saifshk17, Mar 9, 2021.

  1. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    488
    Is there a way to hide UIs such as text, images etc. behind another transparent image? The problem is that I am using the latest Unity version and these custom shaders have no effect on hiding the UI shaders. The two custom shaders I have applied for testing are:

    Code (CSharp):
    1. Shader "Custom/DepthReserve"
    2. {
    3.     Properties
    4.     {
    5.     }
    6.     SubShader
    7.     {
    8.         Tags { "RenderType" = "Opaque" "Queue"="Geometry-1" }
    9.         LOD 100
    10.  
    11.         Blend Zero One
    12.  
    13.         Pass
    14.         {
    15.  
    16.         }
    17.     }
    18. }
    Code (CSharp):
    1. Shader "Custom/InvisibleMask" {
    2.   SubShader {
    3.     // draw after all opaque objects (queue = 2001):
    4.     Tags { "Queue"="Geometry+1" }
    5.     Pass {
    6.       Blend Zero One // keep the image behind it
    7.     }
    8.   }
    9. }
    So is there a way to use a transparent image to hide text, images and even gameobjects?