Shader Replacement for DepthNormals with custom HLSL Clipping

I’m trying to use the Standarad Assets Edge Detection filter on a scene which includes objects that have custom clipping planes (via the HLSL clip() instruction in a surface shader.)

When rendering in deferred mode, this works fine, as the edge detection works against the gbuffer laid down by my generated surface shader, or some variant of it, and as a result the edges are only detected against the parts of the object that are visible.

When in forward rendering mode, it looks like the depth/normals are being laid down by a shader that does not include my clip() instructions, presumably because shader replacement is finding an internal depth/normals shader (presumably there in the builtin shaders download), and rendering using that.

Is there a way that I can provide my own clipping shader, and set up the tags (in a different pass of the shader?) so that forward pass depth-normals shader replacement will find my clipped shader?

Namey5’s version works for rendering depth only. For Depth+Normals, you can write your own version of depthnormals shader that handles your clipping and assigning it in GraphicsSettings.