Object Mask Texture for Screen Space Effects in URP

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?

You may want to look into the render objects renderer feature.

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?