How would I make this effect

No, not if you do it as a Post Effect (which is pretty much the ONLY way to do it).

Look into CustomDepth, which is a way to render a mesh in a different depth pass and exclude it from certain Post effects, or add different post effects etc.