- Docs
- Features
Portal guide
A portal is a doorway that shows another world. It stands on your floor (or in a poster), you look through it, and with world tracking you can walk through it: the world fills the screen, and turning the phone looks round it. Walk back out and the real room returns. From inside, the doorway is a hole in the world: look back through it and you see the real room.
Try it from the Experience Library: A doorway on the floor (Android with Chrome) and A window in a poster (any phone).
In a scene file
A portal is an asset, and a node shows it on an anchor. Its world is a 360 photo or a 3D room.
{
"assets": [
{ "id": "savanna", "type": "image", "src": "savanna.jpg", "projection": "equirect" },
{ "id": "door", "type": "portal", "world": "savanna", "width": 1, "height": 2,
"frame": { "color": "#c9a45c", "thickness": 0.06 } }
],
"nodes": [{ "id": "gate", "asset": "door", "anchor": "spot" }],
"behaviors": [
{ "on": "enter", "from": "gate", "do": "show", "node": "welcome" },
{ "on": "exit", "from": "gate", "do": "hide", "node": "welcome" }
]
}
| Field | What it does |
|---|---|
world | The asset behind the doorway: an image with "projection": "equirect" (a 360 photo, twice as wide as high), or a model (a room). |
width, height | The size of the opening, in the units of the tracker: meters for world tracking, picture widths for an image target. Defaults 1 and 2. |
frame | A border around the opening, color and thickness. Without it, the opening has no frame. |
worldScale | Scales the world. 1 keeps a model in its own units. For a poster, a small value such as 0.05 shrinks the world to fit. |
background | The color of the sky around a model world. A 360 photo needs none. |
The doorway stands on the anchor: the middle of its bottom edge is the node's position, it faces +Z, and the world lies behind it, along -Z. Build a room model with its door in the plane z = 0, the floor at y = 0 and the room going back into -Z. Anything that sticks out in front of the doorway is cut.
Two ways to use it
- World tracking (Android, Chrome): the portal stands on the floor or a wall. You can walk in. The
enterandexitbehaviors name the portal node withfrom. - Image target (any phone): the portal is a window in the picture. You look in, you cannot walk in: a picture target is lost from sight when the phone gets close.
enterandexitare refused on an image scene.
Without AR (iPhone, for now) a world scene with a viewer shows the world in the 3D viewer, with no doorway, so people can look round it.
Good to know
- 360 photos are kept at 4096 by 2048 pixels at most. A 1 MB JPEG is a good size.
- Light: a model world is lit by the scene lights, like any model. A 360 photo is not lit: it shows as it is.
- Phones: no stencil buffer is used, so it runs in A-Frame, Three.js and the Viewer alike. The cost is one extra draw for the doorway.
- The Test console (
?test) showsoutside,insideand the distance from the doorway.