Using the Multimap Sample

This sample shows the basic setup needed to build an AR app with working localization.

Downloading Your Map

Log in to the Developer Portal and download your map data files.

There are three files for each map construction job.

  • The map data file with .bytes extension

  • A sparse point cloud representation of the map as a .ply file

  • A dense mesh representation of the map as a .ply file

Scene Setup

Download the latest version of the SDK from the Developer Portal and the samples from our GitHub. Follow the instructions in Quick Start with Unity to setup your project.

Open the MultimapSampleScene found in Assets/ImmersalSDK/Samples/Scenes. Import the map data file you downloaded into the Unity project.

The basic structure of any scene built with Immersal AR Cloud SDK must have an AR Space Game Object with as many AR Map Game Objects as needed as children.

  • The AR Space object is what gets transformed when a pose is found by our SDK. It is the root for all maps and content.

  • AR Maps are containers for the map data files and are used to preview and place the maps. The map data files are used in localization.

  • All content should be placed under the AR Space Game Object to keep things organized, but technically they can be placed under AR Maps as well.

You can move and rotate the AR Space and AR Map Game Objects when needed. Localization will take any edits you make into account.

ARSpace component does not have any options.
ARMap component options.

Map File Should have the imported map data file in it.

Color specifies the preview point cloud's point color.

Render Modes:

  • Do Not Render No preview generated.

  • Editor Only Show preview only while in the Edit Mode.

  • Editor and Runtime Show preview while in the Edit Mode, Play Mode or while on a device when the app is running.

Modifying the Scene

When you open the scene, you will see 3 AR Maps in the hierarchy and 3 point clouds in the viewport. You can copy, delete or add as many AR Maps as you need in the scene.

To build an app with just one map, delete all but one AR Maps in the scene.

  • Reset the position and rotation of the AR Space and AR Map just to keep the scene clean. You can move and rotate these objects if needed.

  • Drag your imported map data file into the AR Maps Map File slot in the inspector.

  • Set preview to Editor Only or Editor and Runtime to preview the map.

  • Create an object in the scene and place it as a child of AR Space Game Object.

When the AR Map and the created object are placed at XYZ(0.0, 0.0, 0.0), the object will appear exactly where the Anchor Image was taken while capturing the map.

Placing AR Content

The point cloud preview can be used to accurately place AR Content in the space. And this can be done in the Unity Editor, which is very handy.

The Quick Tip video below shows how to fix orientation problems with the captured map data and how to place content using the preview as a reference.

‚Äč

In addition to the map data file, we provide you both sparse and dense mesh representations of the data. The sparse cloud is basically what we offer as a preview. But if you need even more accuracy, the dense mesh can be used also.

By default, Unity does not support the importing of .ply files. You need to either create a compatible mesh in some 3D software or you could use the Pcx Unity Package from Keijiro Takahashi (a Unity Evangelist) as a workaround.

If you do go for the latter option, make sure to scale the .ply Game Object by -1.0 on the x-axis. This is done in order to switch from a right-handed to a left-handed coordinate system.

We recommend you start with the previews directly in AR Maps. They are enough most of the time.

Note that the Pcx workaround is not officially supported by Immersal.

Using the Sample

In Unity, open the Build Settings and only add or select the MultimapSampleScene to be included. Build the app for your device.

When you look at the location you had mapped with the app running, the device should be able to localize and find its pose in seconds.

If you followed the instructions in Modifying your Scene, you should see the created object where you took the Anchor Image when you mapped the space.