Use Cloud Anchors to create multiplayer or collaborative AR experiences that Android and iOS users can share.
What is a Cloud Anchor?
Using Cloud Anchors, your app lets users add virtual objects to an AR scene. Multiple users can then view and interact with these objects simultaneously from different positions in a shared physical space.
Cloud Anchors are similar in behavior and function to anchors, but differ in that they’re hosted on Google servers. This hosting enables users to shared experiences.
How do Cloud Anchors work?
To enable these shared experiences, the ARCore SDK uses Google servers to host and resolve anchors.
An app must have a working Internet connection to access the Google Cloud Anchor service.
How Cloud Anchors are hosted and resolved
To establish and host an anchor, ARCore needs to generate a 3D feature map of the space surrounding the anchor (the center of interest). To do this, the device camera must capture visual features of the environment in and around the center of interest from different viewing angles and positions in the ten seconds before the host call occurs. The proper creation of this feature map is critical to a good experience. Otherwise, the position and orientation data can be limited, making resolving harder.
When another user points their mobile device camera toward the same center of interest, a Cloud Anchor resolve request sends visual features from the current camera frame to the Google Cloud Anchor service. These visual features are compared against the 3D feature map that was created by the device that hosted the anchor, and used to pinpoint the user’s position and orientation relative to the Cloud Anchor -- this is why it is so important during the resolving process to to use the 10 seconds preceding the hosting request to capture as much of the environment around the center of interest as possible.
Here are the steps you would take to host and resolve an anchor in the same space.
Establishing and hosting an anchor
To host an anchor, follow these steps.
Point the device camera at the center of interest, that is, the area surrounding the point where you want to place the anchor. Try to find an area with visual features that are easily distinguishable from each other -- for example, a corner with visually distinct edges and planes.
While keeping the camera trained on the center of interest, and while roughly maintaining the physical distance between the device and the center of interest, move the device around to capture the environment from different viewing angles and positions for ten seconds. Walk around in the space while keeping the device camera trained on the center of interest.
After following the previous step for ten seconds, initiate the hosting request.
ARCore uses all of the visual data captured from different viewing angles and positions in the preceding ten seconds to create a 3D feature map of the space and upload it to Google servers and returns a unique Cloud Anchor ID.
The anchor is now hosted.
Resolving a hosted anchor
Using a different device than the hosting device, follow this step to resolve the hosted anchor.
Point the device camera at the same center of interest surrounding the hosted anchor.
You can be in any position in the space as long as:
The device camera has a clear line of sight to the hosted anchor.
The device camera isn't much farther than 10 meters from the hosted anchor.
The Cloud Anchor should resolve.
Data storage and access limitations
Cloud Anchors have the following data storage and access limitations:
Cloud Anchors can be resolved for twenty-four hours after they are hosted.
Raw visual mapping data uploaded to the cloud when hosting an anchor is discarded after seven days.
Anchors are resolved on the server side against the stored sparse point map.
- The 3D feature map can be used for Cloud Anchor resolution requests for twenty-four hours after it is generated.
- Previously uploaded mapping data is never sent to a user's device.
It is not possible to determine a user's geographic location or to reconstruct any images or the user's physical environment from the 3D feature map.
Visual feature data from a request to resolve an anchor are never stored.
General best practices
The following best practices help create a good Cloud Anchors user experience.
- Avoid hosting or resolving Cloud Anchors on shiny surfaces.
- For best results, avoid reflective surfaces or surfaces without visual features, such as a blank, smooth, white wall.
- Make sure that the lighting in the room is sufficient.
- For best results, lighting conditions should be consistent between anchor host and resolve requests.
To start using Cloud Anchors, see the Cloud Anchors Quickstart.
If you are new to working with anchors, see Working with Anchors for an introduction.