Skip to main content

Device Mapping

What is Device Mapping?

Device Mapping is a system that scans and tracks real-world objects, allowing you to place content in alignment with the real world. On the surface, it is functionally similar to VPS, but the Device Mapping system does all of its processing on the device and does not require a network connection to localize. Instead, Device Mapping provides scanned maps as serializable objects that a client device can distribute to others, which can then deserialize and recreate the scanned map. Multiple devices can share a map without relying on Niantic VPS servers, which allows for immediate multiplayer experiences anywhere, even with no previous VPS-Activated location. See the DeviceMappingColocalization demo scene for sample usage of Device Mapping and sharing over Niantic Spatial Platform's Shared AR library.

For a better idea of how Device Mapping works, compare it to VPS:

VPSDevice Mapping
Where can you use it?VPS-Activated Locations OnlyAnywhere
How is the map built?Using scans from many users at different timesA single scan
Do you need to scan a local map before localizing?NoYes
Do you need to communicate with Niantic VPS Servers?YesNo
Where does the map data live?Niantic serversYour device
Localization robustness?Consistent because it generates the map from multiple scansRobustness depends on the quality of the single scan
How to access associated visual data?Download mesh from the internetExtract point cloud from device map data

High-Level API Overview

At a high level, the Device Mapping API follows these steps:

  • Mapping
    • Using ARDeviceMappingManager, scan and generate a device map.
    • Using ARDeviceMap, save the serialized device map data somewhere, such as the device's local file system.
  • Tracking
    • Using ARDeviceMap again, restore a device map from the serialized map data on the device.
    • Using ARPersistentAnchorManager, track the scanned real-world data by setting the device map via the ARDeviceMappingManager.
    • Once the device has achieved tracking, populate the virtual objects under ARPersistentAnchor to show them aligned to the real world.

Once StopMapping() is called and the final map is generated, the ARDeviceMappingManager.DeviceMapFinalized event triggers, allowing ARDeviceMap to serialize the map data. ARDeviceMap also provides the necessary API to restore this map data later on. Optionally, you can also show the user the coverage of the device map by listening to the ARDeviceMappingManager.DeviceMapUpdated event and receiving additional device map data that allows you to do so.

Limitations

Device Mapping is subject to some of the same localization limitations as VPS, such as:

  • Visual conditions (lighting, weather, time of day) changing between mapping and localization
  • Mapped areas with few distinguishing features (such as grassy fields or indoor areas with little difference in color)
  • Scans taken from a limited viewing angle

Without the robustness of generating the map from multiple scans, Device Mapping may perform worse than VPS if these limitations come into play. If your multiplayer experience depends on an area that changes regularly or lacks distinguishing features, consider using VPS instead.

Next Steps

To get started using Device Mapping, see How to Create a Device Map.