Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Fade object with Renderer feature render objects depth writing

Discussion in 'Universal Render Pipeline' started by Snowirbis, Dec 7, 2023.

  1. Snowirbis


    Jan 30, 2018
    Hello, I'm doing a fading shader like the one in unity documentation (Transparent shader with depth writes)
    The principle is quite simple I made a shader that writes depth like this :
    Code (csharp):
    2.         Pass
    3.         {
    4.             ZWrite On
    5.             ZTest LEqual
    6.             ColorMask 0 // remove the white color
    7.         }
    In urp we cannot have multipass shader graph so I use two materials on the same mesh renderer to make it work. The first material is the depth write shader and the second is a urp lit transparent material.
    I get the desired result :
    Capture d’écran 2023-12-07 155608.png
    It works great !
    But I actually need to make the same effect with renderer features because I do not have control over every mesh renderers and some of them have multiple materials (one for each submeshes).
    So I thought it should be quite simple, that is exactly what render objects in the renderer features is made for !
    Capture d’écran 2023-12-07 155736.png
    yet it does not work correctly, we can slightly see the door inside the mesh.
    I tried to set different events for the render objects but I cannot get it to work.
  2. Snowirbis


    Jan 30, 2018
    Hello it's been two months and I still need this, is there anyone who can help ?