Skip to main content

Shared Anchors

A shared anchor is a point in space that lets you share an AR experience with people around you, or enables persistent AR content. Each user who wishes to participate in a shared experience needs to find the same shared anchor. Once users have found a shared anchor, they can share virtual objects with other users. These shared virtual objects will appear at the same physical location.

This concept is used during the relocalization process (see Concept of Relocalization), where the SDK attempts to recognize a location. In the AR Cloud Tracking API, a shared anchor is associated with either an image or a map. Each image contains one shared anchor, and each map contains one shared anchor. In both cases, the shared anchor represents the origin of the coordinate system after the relocalization process is done.

Please note that when a shared anchor is found, due to the change in a coordinate system, any existing virtual object not attached to a local anchor will appear to “jump” to a different location.

Image-based Shared Anchors

The simplest form of a shared anchor is an image, like a poster or a picture printed on paper. In order to use an image as a shared anchor, the image needs to be preloaded in a database. A shared anchor is automatically created at the center of each image and will be used when the relocalization process is started and the image is located by the camera.

The steps to use an image as a shared anchor are as follows:

  1. During the app creation

    1. Create an image database containing one or multiple images
    2. Enable the image-based shared anchor option in the app configuration
  2. At runtime

    1. Select which images to use as a shared anchor (or set all images as shared anchors)
    2. Start the shared anchor relocalization process and look for an image

Once a user has detected the image by pointing their device at it, the system automatically uses the associated shared anchor to enable content sharing.

Please note that an image used as a shared anchor must remain static throughout the entire game session. If the image moves after users start to detect it, their coordinate systems will be desynchronized.

Additionally, any image in the database not set as a shared anchor can be used as a regular AR image to overlay virtual content. These images can be moved.

Map-based Shared Anchors

A map represents an area (for example, a room, a street, etc.) that has been mapped previously using Pretia 3D scanner app. The scanner app collects information about the area, creates a shared anchor at a specific location within the map, and stores all of this information into a server. An application created with the Pretia Tracking SDK can then request the server to start the shared anchor relocalization process using a specific map.

During this relocalization process, the user needs to point their device around them until the system has recognized the area. At this point, the shared anchor associated with the map has been found, and the user can start sharing content.

Workflow of finding a shared anchor on the server

The relocalization process would be three parts

  1. Step 1: Initialization, INITIALIZING

    1. Set the key corresponding to the map to use
    2. Start the relocalization process (find a shared anchor)
  2. Step 2: Relocalizing, FINDING SHARED ANCHOR

    1. Look around with the camera, the device will start sending data to the server regularly
    2. At some point, the server will match the device data with the map
    3. At this point, the device will update its coordinate system and you can start sharing content
  3. Step 3: Relocalized, SHARED ANCHOR FOUND

    1. After this, the device will continue sending data occasionally to the server to improve the relocalization