How can I create a simple portal in AR?

I have been trying to recreate a portal in AR. So basically like a window, or a door or simply a square that renders what is inside but nothing outside. Do you know anything about it? Can you point me to the right direction? I posted long time ago about it but I only received a vague answer which link is now broken.


Sounds like you would want to use render to texture in some form

I see. So basically:

I should create a 3D scenario and a camera rendering that scenario into a plane.
The 3D assets should be in a different layer so they cannot be seen in AR.
A second camera would follow the AR camera and render the layer (where the 3D scene is) into the texture.
The camera should have the same ratio as the plane so the texture will never look squeezed or shrunk.
The AR camera should only render the plane with its texture and evidently the real world.

Correct me if I am wrong in any of the steps above or if I missed something.
Will it give the illusion that there is an scenario behind that plane when moving the camera?
I guess this trick only works if you don’t step in. What if I want to step into the portal? and step out?

Ah, you want to step in? In which case, shader with mask attribute would be a better choice. Not in my wheelhouse unfortunately.

You would effectively have a mesh that would mask out the 3D world but still render the video camera image. This would allow you to ‘step in’ the portal.

Thanks so much. Very helpful.

If I go for the non step in/out version would the steps mentioned above work?

Thanks again

Sounds about right. The tricky but would be getting the texture to look right based on the distance from the user to the portal.