How do I make material shrink the further I walk away from it

I’m trying to make a portal from one level to another. I wanted it to look like doctor stange, so had an Hdri of the level in the middle of a portal as materie\al. However, the material doesn’t shrink when I walk away from it, making it look weird. How do I fix this and make the material shrink when I walk away.

How did you code the HDRI material?

It does not shrink because you are using scene capture.
While your camera (on your player) is moving closer/further from portal, other camera that does scene capture is not.

So you can either move other camera (if there is space for it on other side), or do some trigonometry and change field of view of that other camera to zoom in/out.

Edit:
You probably want to act view in portal like it would be mirror. So calculate relative direction vector from portal to player (look at and distance), then move scene capture camera on other side to same location relative to other side of portal.