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

Hi. im looking to replicate this effect in unreal. Not looking for a portal type effect, and i’m not sure if i can get unreal depth buffer to work the same.

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

ahh thanks, but thats not exactly the effect im going for. im thinking its more of something to do with 3D box masking like in this video, i just need to figure out how to implement it like the second twitter link.

i came across this video last night and the hidden car he did seems like it might be what im looking for but not sure yet.