How do I make a portal render shader work

I’m trying to make a seamless portal effect and finished the camera position part but after trying to follow Coding Adventure: Portals it looked broken


I don’t know if its because I’m using HDRP or something else since I have 0 shader knowledge other than basic shader graphs
I also tried changing the uv to screen position but the illusion brakes if theres an object in between the camera and the portal