Search Unity

Question Object Mask Texture for Screen Space Effects in URP

Discussion in 'Universal Render Pipeline' started by FernwehSmith, May 16, 2022.

  1. FernwehSmith

    FernwehSmith

    Joined:
    Jan 31, 2022
    Posts:
    36
    Hello all,
    I'm really not sure where to start with this one. All I want to do is
    1) Render a solid white matte for objects with a specific tag or layer to a render texture.
    2) Process that render texture through shader graph in some way.
    3) Apply the results over the whole screen as a simple sort of post process.

    I don't need anything too fancy like normal or depth textures. All I need is a black and white mask that sets each pixel to white if an object with a particular tag is over it, and black if not. Also the render texture needs to be the same size as the screen. Needs to work with URP.

    Where should I start with this?
     
  2. timmehhhhhhh

    timmehhhhhhh

    Joined:
    Sep 10, 2013
    Posts:
    157
  3. FernwehSmith

    FernwehSmith

    Joined:
    Jan 31, 2022
    Posts:
    36
    So I checked that out and I think it could be very useful. From the looks of things using it to render to the stencil buffer could be exactly what I want. What I'm now struggling with is how to get the stencil buffer as a texture in shader graph. Is there a way to do this?