I don’t know any builtin equivalent in shader code to the depth feature of the SpatialMaterial. You can however inspect how it is done and reuse it by creating a material in a resource slot, setup its depth feature and converting it to a shader material (RMB > convert to shader material).
As for actually applying a geometry displacement, see this video.