HDRP Custom Pass with More Filter Options Besides Layer

There could be a solution somewhere but I’m too unfamiliar with shader stuffs, so I think it I’d rather post a new thread to ask.

I want that when an object is selected, there’s an outline around it. I found a pretty good example here: GitHub - alelievr/HDRP-Custom-Passes: A bunch of custom passes made for HDRP

The only problem is, since we use physics and layer to determine which objects could be selected already, I can’t rely on layer to determin which object to show outline.

I tried to play with the rendering layer mask of the mesh renderer but I couldn’t make it.
What I tried is to modifiy 02_Selection_Objects.shader:

  1. Add “_renderingLayer(“RenderingLayer”, int) = 0” in Properties
  2. Add “uint _renderingLayer;” in SubSahder Pass
  3. In void GetSurfaceAndBuiltinData add:
    if (builtinData.renderingLayers != _renderingLayer){
    builtinData.opacity = 0;
    }

But it’s not working as I expected, no matter what the rendering layer mask of the mesh renderer is, I’ll have to set _renderingLayer to 0 to make it have an outline.

I do have a work around, though, that is to stick with the original way the custom pass is, and whenever I need the object to have outline,I copy it, gives it an alpha clipping material, and set it to the custom pass targeted filter. But I think it’s a rather important feature so I’ll be glad to know the proper way to handle this situation.

1 Like

I am also interested in that. I feel that the layers being used for both physics and rendering in that case shows it as a bad design. I would be able to filter objects for custom passes with more ways, for example the InstanceID/ObjectID would be really awesome.

Or just sending a list of whatever objects you want, rather than relying on some sort of filter parameters.

2 Likes

this!

1 Like

I also second this.