documentation

HoloLens Model Tracker Tutorial

Level: Basic

Tracking with the VisionLib SDK also works on Microsoft HoloLens. This tutorial will show you how to use and customize the HoloLens model tracking example scenes of the VisionLib SDK in Unity.
We recommend testing the tracking on your own model in a basic (non-HoloLens) project before moving on to HoloLens. You may want to use our ModelTrackingSetup example scene for this purpose (see Using the Model Tracking Setup Scene). This scene offers specialized troubleshooting and tracking parameter setup functionality.
For more information on how to optimize your VisionLib HoloLens Tracking, please refer to HoloLens Optimizations.

Preparation

Please ensure you have installed the required tools and adjusted the settings for HoloLens and Unity Development:

  • Windows 10, Windows 10 SDK, Developer Mode activated
  • HoloLens with activated Developer Mode
  • Visual Studio 2017 (with UWP Tools installed) or higher
  • Unity with IL2CPP Scripting Backend

Set Up the Unity Project

  1. Download the current VisionLib.SDK-Unity package from the customer area
  2. In a new Unity project, import the VisionLib.SDK-Unity.tgz as well as the VisionLib.SDK.HoloLens-Unity.tgz via the package manager.
  3. Import the VisionLib.SDK.HoloLens.Examples-Unity.unitypackage via Assets > Import Package > Custom Package.
  4. Copy your license file to Assets/StreamingAssets/VisionLib.
  5. Open the HoloLensSimpleModelTracking example scene in Unity from VisionLib HoloLens Examples/ModelTracking/Scenes

If you intend to use the VisionLib mini car model, you can skip directly to Deploying to HoloLens.

Track your Own Model on HoloLens

After you verified that tracking of your object works in general, you can try out the tracking on HoloLens. Follow the steps in this section to set up a separate scene with your specific content.

  1. Make a copy of the HoloLensSimpleModelTracking Unity scene. In this copy, reference your license file in the TrackingConfiguration component of the VLTracking GameObject.
  2. Copy your model into the Models folder of your Unity project. Drag it from the project panel into the hierarchy of your scene as a child of the GameObject SceneContent/TrackingAnchor and remove the mini car model.

    Important: The metric of the provided 3D model is very important in HoloLens scenes. The metric describes the length of one unit in model dimensions. HoloLens itself uses a world defined in meters. Your model must also be defined in meters! If the 3D model is scaled for a different unit, the interaction between the VisionLib SDK and HoloLens does not work properly. If you are unsure about the metrics of your 3D model, please see Mandatory Initial Parameters for help.

  3. Select the GameObject SceneContent/TrackingAnchor and press the button "Add TrackingMesh components to all models". This will mark the meshes of the model to be used by VisionLib tracking.
  4. Press the Center Object in Slam Camera button on the GameObject SceneContent/TrackingAnchor. This will center your object in the view of the Camera which is used to initialize the tracking.
  5. If necessary, adjust the initial pose of the tracked model by moving the SceneContent/TrackingAnchor GameObject. For more information, see Setting an Init Pose.
  6. To deploy this scene to HoloLens, please continue with Deploying to HoloLens.