How do i replicate unity's stencil buffering shader in unreal

For the first one you can try parallax occlusion mapping in shader. I’m not sure about second one.