Spaces Application
Spaces is an application that comes preinstalled on the Magic Leap 2. It is used to create maps called Spaces using SLAM (simultaneous localization and mapping). Each Space contains localization data, spatial anchors, and 3D mesh that represents a snapshot of the physical world when the environment was scanned.
The Spaces app is used to:
- Manage saved Spaces
- Select which Space to localize the ML2 device into
- Create new Spaces
- View data for Spaces
- Export meshes
- Load AR Cloud Spaces.
AR Cloud Licenses
The Spaces tool can be used on any version/license of a Magic Leap 2. For more info about adding extra features with AR Cloud, see the following page about licenses:
Creating a Space
- Launch the Spaces application from the Magic Leap 2 home screen.
- Select New Local Space. First time users will see a tutorial that explains how to create a good spatial map, including the types of surfaces and textures to avoid. A voice over will provide direction while scanning.
The 3D world mesh, that is visible to the user while scanning, is not important to creating a good map unless occlusion or physics is part of the application experience.
- Once you have scanned the physical room(s) that need to be mapped, and you’ve achieved a “Good scan quality”, select the “End Scan” button found on the on-screen HUD.
- Upon ending your scan, the map is analyzed for areas that may have a low confidence for localization. If there are no areas with low confidence then you will see this save dialog:
You will be returned to the Spaces app lobby. You may select your new Space and name it by selecting the Space name and entering the new name using the virtual keyboard.
If upon ending your scan the analysis finds one or more areas with low localization confidence, you will see this dialog:
You can save the scan as-is, or refine it for better localization. If you refine your scan, follow the in-app voice over hints to improve your entire scan for localization. When done, select “End scan” again and save.
Your device will automatically localize into the new Space and you will be returned to the Spaces lobby.
The important thing to note when scanning an area is to slow down and spend time in areas where users with devices will spend time.
For more specific on-device guidance on the scanning process, click the information icon on the bottom left corner of the Spaces lobby menu screen to see a brief tutorial.
Problematic areas for mapping
The following areas and surfaces have difficulty in mapping due to the fact that the depth camera and/or world cameras cannot get quality data:
- Dark areas with inadequate lighting
- Black or dark textures
- Glass surfaces
- Mirror or reflective surfaces
- Shiny surfaces
For dark areas it is suggested that you turn on lights to brighten these areas up. If that is not possible, then ignore these areas when mapping.
Updating a Space
Unlike localization, Spaces don't update automatically. If you want to update a Space or add additional information, you will need to create a new Space inside the Spaces application. This workflow ensures that the device will be able to localize into your space efficiently.
Merging of maps is only possible when using AR Cloud. Currently, Spaces saved on-device (Local Spaces) don’t support merging or updating existing maps. Instead, you will need to delete and remap the space if you want to change the map of the environment.
Exporting a mesh
The 3D mesh created during runtime via the Spatial Mapping API works fine for most on-device experiences. However, some developers need a more detailed 3D mesh for high-precision occlusion and physics. For this need, Magic Leap has provided a 3D mesh export option.
Each Local Space has the option to export a 3D mesh to a .glb file. Note: During a scanning session, the mesh represented visually as a grid of dots. This dot representation is meant to simplify the visuals for ease of scanning. A triangle mesh is created under the hood.
To export a glb file, select the 3-dot “More” button, and then select “Export .glb mesh” from the dropdown list.
The .glb mesh file is saved to the device and can be found in the Downloads folder. You can use ML Hub to download the file from your device's Downloads folder.