If you’re not familiar with Immersal, they’re a company focused on technologies like spatial mapping and visual positioning systems (VPS), which help developers like us create incredible AR experiences.
Want to watch the video instead?
Prerequisites
Before we get started, there are a few prerequisites you need to meet. Don’t worry, I’ll give you an overview of each one, and if you need more detailed instructions, you can check out our previous blogs here.
-
Create a Developer Account
Start by creating a developer account with Immersal.
-
Download the Immersal Mapper App from Playstore/AppStore
Log in using your developer credentials and download the Immers Mapper app. This will be essential for mapping your environment.
-
Map Your Environment
Once you’ve downloaded the app, you’ll need to map your environment. For this tutorial, I used the manual mode to carefully map the room where we’ll be setting up our AR experience.
-
Set Up a Unity Project with Immersal SDK
Finally, you’ll need to set up your Unity project with the Immersal SDK. Here’s a quick rundown on how to do that:
- Go to Windows > Package Manager.
- Click the plus symbol (+) and select Add package from Git URL.
- Paste the following Git URL and click Add: https://github.com/immersal/imdk-unity
Once that’s done, navigate to File > Build Settings, switch the platform to Android, and use the Project Validation Tool to fix any issues.
Setting Up the Scene
With the prerequisites out of the way, let’s start setting up our scene in Unity.
-
Delete the Default Main Camera
In your Unity hierarchy, select the main camera and delete it. We’ll be using a different setup for the AR experience.
-
Add XR Session and Origin
Right-click in the hierarchy, navigate to XR, and select AR Session and XR Origin. Set the position and rotation of both to zero.
-
Add Immersal SDK Prefab
In the project folder, search for Immersal SDK and add the appropriate prefab to your scene.
-
Log in to Immersal SDK
To retrieve the developer token, log in within the Immersal SDK using your developer credentials. Once logged in, the token will be visible in the settings.
-
Create XR Space and Data Processors
Create an empty GameObject named XR Space, and add the XR Space component. Then, add two Data Processors and reference them accordingly.
-
Add Post Filter and Smoother
As children of XR Space, create two empty GameObjects named Post Filter and Post Smoother. Add their respective components.
-
Download the Spatial Map
Under XR Space, create an empty GameObject named XR Map and add the XR Map component.To download the map:
- Visit the developer portal and copy the map ID.
- Visit the developer portal and copy the map ID.
- Paste the map ID into Unity and check the boxes for Map File and Visualization. Click Download to get the point cloud of the mapped environment.