documentation

VisionLib Tracking on Magic Leap 2

Level: Basic

General Preparation

Install Dependencies

  • Install Unity with Magic Leap 2 support (version 2022.2.0b7 or higher) and Android Build Support.
  • Install Magic Leap Hub from https://developer-docs.magicleap.cloud/docs/guides/getting-started/install-the-tools
    • Inside Magic Leap Hub open Package Manager and select Unity.
    • Select to install the Unity Package.
    • Click on Open Folder to find out the location of the file com.magicleap.unitysdk.tgz that was installed with this step.

Install Required UPM Packages

Some UPM packages have to be installed in any project that will use VisionLibs model tracking. Open the package manager and install the following packages (via Add package from tarball...):

  • Add the com.magicleap.unitysdk.tgz file that was installed by Magic Leap Hub above. This step will trigger some warnings.
    • One warning will tell you, that the new input system package is used without the native backend. Select yes (this will restart Unity).
    • Another warning will tell you, that an XR Interaction Layer Mask Update is required. You can select No Thanks here.
  • Ensure MLSDK is referenced in Preferences > External Tools > Magic Leap. If it is not yet referenced, find the path in Magic Leap Hub > Package Manager > Common Packages > ML C SDK by clicking on the Open Folder button.
  • Install the VisionLib.SDK-Unity.tgz package.
  • Make sure, that the Google ARCore XR Plugin is not installed in the package manager.

Change Project Settings to Allow Deployment to Magic Leap

Deployment to Magic Leap requires some adjustments of the default project settings in Unity.

  • Change your project's target platform to Android.
  • In Player Settings > Android > Other Settings > Rendering
    • Change Color Space to Linear.
    • Disable Auto Graphics API, add the Vulkan Graphics API (if it is not already listed) and remove all others.
    • Set the Texture compression Format to DXT + RGTC(BC4, BC5).
  • In Player Settings > Android > Other Settings > Configuration
    • Set the Scripting Backend to IL2CPP.
    • Select x86-64 (Chrome OS and Magic Leap 2).
  • In Project Settings > XR Plug-in Management > Android select the Plug-in Provider Magic Leap.

Set Up Example Scene

VisionLib.SDK comes with an example scene that shows how model tracking can be achieved on Magic Leap 2 devices. This section explains how to set it up.

  • Import the examples from Extensions > VisionLib.SDK.MagicLeap.Examples-Unity.unitypackage.
  • Open the MagicLeapModelTracking scene from Assets > VisionLib MagicLeap Examples.

Enable Voice Recognition

The example scene uses voice commands to control the tracker. To use that, you have to change some settings both inside the project and also on the device.

  • Add the Permissions to your project
    • Go to Player Settings > Publishing Settings > Build and select Custom Main Manifest.
    • Go to Project Settings > Magic Leap > Permissions and select VOICE_INPUT.
  • Enable voice input on the device
    • Navigate to Settings > Magic Leap Inputs > Voice.
    • Enable Voice Commands.

Use VisionLib.SDK in Existing Magic Leap 2 Scene

Instead of starting from the example scene, you can also add VisionLib.SDK to an existing Magic Leap 2 Unity scene.

  • Start by installing the dependencies and UPM packages as described above.
  • Now, add the prefab VLXRCameraMagicLeap from Packages > VisionLib SDK > MagicLeap > Prefabs to your scene.
  • Add the TrackingConfiguration component to one of your GameObjects. Specify a license file and your tracking configuration file in the TrackingConfiguration.
  • Please use the tracking configuration file ImageInjectionModelTrackingConfiguration.vl from StreamingAssets > Examples > MagicLeap > ModelTracking that is provided in the VisionLib.SDK.MagicLeap.Examples-Unity.unitypackage.
  • After that, you can proceed as described in Using Models from the Unity Hierarchy.

License

Running VisionLib.SDK on Magic Leap 2 requires a license for the device type Android_x86_64. Our trial license includes this feature.

Please contact sales@visometry.com for questions regarding your VisionLib.SDK license.