Developing Vuforia Engine Apps for HoloLens

Overview

Vuforia Engine brings an important capability to HoloLens – the power to connect AR experiences to specific images and objects in the environment. You can use this capability to overlay guided step by step instructions on top of machinery or to add digital features to a physical product.

Enterprise developers – you can use VuMarks to uniquely identify each piece of machinery on a factory floor – right down to the serial number. VuMarks are scalable into the billions and can be designed to look just like a company logo. They are the ideal solution for adding AR to any product that HoloLens can see.

Existing Vuforia Engine apps that were built for phones and tablets can easily be configured in Unity to run on HoloLens. You can even use Vuforia Engine to take your new HoloLens app to Windows 10 tablets such as the Surface Pro 4 and Surface Book.

Supported Versions

  • Visual Studio 2015 Update 3 or Later
  • Unity 2017.2 with Vuforia Engine 6.5 or Later
    • To benefit from the latest improvements and bugfixes, it is recommended to use the latest version of Vuforia and Unity.

Installation and Configuration

You will need to install the above versions of Visual Studio and Unity and then configure Unity to use Visual Studio and the preferred IDE and compiler. You will also need to install Visual Studios tools for Unity, see the article below for a link to this installer.

See:
Getting Started with Visual Studio Tools for Unity - MSDN
Unity - Manual: Visual Studio C# Integration
 
When installing Unity, be sure to install the Windows Store platform, and also the IL2CPP Scripting Backend. Windows Store components can also be installed afterwards from the Build Settings dialog when the Windows Store platform is selected.

Getting Started

Vuforia introduced support for HoloLens in Vuforia Engine 6.1.
See: Developing for Windows 10 in Unity to learn how to set-up your Windows 10 build environment for Unity and Visual Studio.

The best starting point, to understand the structure and organization of a Vuforia Engine HoloLens project in Unity, is with the Unity HoloLens sample. This provides a complete HoloLens project as well as a pre-configured scene that can be deployed to a HoloLens.

The scene implements a Vuforia ARCamera, along with the Build Settings necessary to deploy a HoloLens app. It shows how to use Image Targets and other target types to recognize an image and augment it with digital content in a HoloLens experience. You can easily substitute your own content in this scene to begin experimenting with the creation of HoloLens apps that use Vuforia Engine. To deploy the sample, follow the steps in the Building and Executing the sample section.  When you build a Windows Store app, Unity generates a Visual Studio project and launches the Visual Studio IDE. You can then build a UWP executable and install that on your HoloLens.

Installing the Unity HoloLens Sample

See: Working with the HoloLens Sample in Unity

Configuring a Vuforia Engine App for HoloLens

Developing a Vuforia app for HoloLens is fundamentally the same as developing Vuforia apps for other devices. You'll need to configure the appropriate XR settings. You can then apply the build settings described in the Building and Executing a Vuforia Engine app for HoloLens section. That’s all that’s needed to enable Vuforia to work with the HoloLens spatial mapping and positional tracking systems.

The Role of Extended Tracking

Extended Tracking creates a map of the environment to maintain tracking even when a target is no longer in view. Starting with Vuforia Engine 7.2, Extended Tracking is automatically enabled for all targets when the Positional Device Tracker is enabled. For HoloLens applications, the Positional Device Tracker needs to be started for every app and is automatically started in Unity.

When you enable Extended Tracking on a target, you enable the pose of that target to be passed to the HoloLens Spatial Mapping engine. In this way, targets can exist in both the Vuforia Engine and HoloLens spatial coordinate systems, though not simultaneously.

Vuforia Engine will automatically transform the pose of a target into the HoloLens spatial coordinate system.  This allows HoloLens to take over tracking, and to integrate any content augmenting the target into the spatial map of the target’s surroundings.

This process occurs between Vuforia Engine and HoloLens APIs in Unity, and does not require any programming by the developer - it's handled automatically.

  Here is what occurs...

  1. Vuforia Engine’s target Tracker recognizes the target
  2. Target tracking is then initialized
  3. The position and rotation of the target are analyzed to provide a robust pose estimate for HoloLens to use
  4. Vuforia Engine transforms the target's pose into the HoloLens spatial mapping coordinate space
  5. HoloLens takes over tracking if the target is no longer in view. 

Targets that have been detected, but are no longer in view will be reported as EXTENDED_TRACKED. The DefaultTrackableEventHandler script that is used on all targets will continue to render augmentation content in this case. This behavior can be controlled by the developer by implementing a custom trackable event handler script.

Configuring XR Settings for HoloLens support

  1. Add an ARCamera to your scene Hierarchy (menu: GameObject>Vuforia> AR Camera)
  2. Enable "Vuforia Augmented Reality" in the "XR Settings" panel in "Player Settings"
  3. Enable "Virtual Reality Supported" and add "Windows Mixed Reality" to the list
  • When targeting a HoloLens on RS4 or later, it is recommended to select “Enable Depth buffer Sharing” in the “Windows Mixed Reality” settings.
Vuforia Image
  1. Open Vuforia Configuration (menu: Window> Vuforia Configuration)
  2. Under "Digital Eyewear" select " Digital Eyewear " for Device Type and "HoloLens" for Device Config
Vuforia Image

Building and executing a Vuforia Engine app for HoloLens

  1. Apply the recommended Unity Engine Options for Power and Performance
  2. Add the sample scenes to Scenes in Build
  3. Set your platform build target for Universal Windows Platform in File > Build Settings.
  4. Select the following platform build configuration settings
    • SDK = Latest Installed
    • Build Type = D3D
    • Target Device = HoloLens
  5. Define a unique Product Name, in Player Settings, to serve as the name of the app when installed on the HoloLens.
  6. Select Landscape Left as the in Player Settings > Resolution and Presentation
  7. Disable the Run in Background option in Player Settings > Resolution and Presentation. Otherwise Vuforia will not pause when the app is put into the background and may fail to access the camera when the app is resumed.
  8. Check the following Capabilities in Player Settings > Publish Settings
    • InternetClient
    • WebCam
    • SpatialPerception - if you intend to use the Surface Observer API
      User-added image
  9. Select Build to generate a Visual Studio project
  10. Build the executable from Visual Studio and install it on your HoloLens.

Note: You may need to install additional Unity UWP components if you had not selected to install these when you had originally installed the Unity Editor – the dialog will direct you to the necessary installer.

Vuforia Image

Selecting Build for Universal Windows Platform will generate a Visual Studio Project.  You will then need to build an executable from Visual Studio. Use the SDK and Build Type settings shown in above image.

See: https://developer.microsoft.com/en-us/windows/holographic/exporting_and_building_a_unity_visual_studio_solution

Visual Studio Build Configuration

Be sure to set your build target for x86. Note that the EAP release supports only 32 bit builds.

Vuforia Image