How to make the Magic Leap world-inside-world effect?

oh hi - I was one of the people who worked on that;)
as you can probably extrapolate from the source, we didn’t use three, but the same effect can be accomplished in three or any other 3D framework in a few ways (esp. if like that example you’re only interested in Z-axis movement).

Without giving away the farm, two approaches I recommend looking up are (as mentioned) stencil buffers and, alternatively, render textures. Aside from these links and Don’s example, I recommend taking a look at AFrame’s Link Portals (I put a link to the source but am restricted by being a “new user” here;) - all valid ways to skin that cow, depending on the use case. Good luck!