Getting Started with the HoloLens 2 - utwente-interaction-lab/interaction-lab GitHub Wiki
Introduction
Hololens 1 and Hololens 2
The tutorial on this wiki page is about the Hololens 2. Our lab also has several older original Hololens 1 which work very similarly. However, since these have been discontinued by Microsoft you can only use versions up until Unity 2018.1.0f2 and Visual Studio 2017. The official documentation is a good starting point for developers:
In the box
How to get started
Part 1. Putting it on
- Open the box and the case inside. Here you find: the HoloLens, a charger, an information flyer and a cleaning wipe.
- Turn on the HoloLens: press the small round button on the back section of the HoloLens (just above the charging outlet)
- Put it on: rotate the nob on the back to adjust the lens so it fits over your head, place it on your head and fasten the nob. Also, tighten the strap that goes over your head. And to finish the setup: carefully tilt the glass up and down to adjust your view.
- Turn off the HoloLens: briefly press the button for sleep mode OR press and hold until you see ’goodbye’ and all LED lights turn off.
Part 2. Get used to the Mixed Reality
- When pressing the ON button, you should see a windows icon appear. This might be followed by a circling icon. This is the iris scanner.
- Okay, let’s start interacting with the holograms! You can interact with the holograms by moving your arms and hands. The HoloLens senses your movements and the gestures that you make with your hands. You press and click buttons by holding out your index finger and shortly pushing it through the hologram button.
- The first screen you see is an Iris scanning application, click the small dismiss button underneath. Then, it takes you to the Human media interaction login screen. It asks for either an iris, pin or password. For the password, contact the lab manager.
- After entering the password, a home screen will appear. Just like a normal computer or tablet, you have different options, such as opening the internet, mail, tips, etc.
- For now, open the ‘Tips’ application. This leads you to a short tutorial. It will teach you the first basic interaction gestures that you need to use the HoloLens.
- After finishing, you can also try the Guides app. After clicking on the icon in the menu, a 3D shape appears. To interact with the shape, push your hand through the shape and make a grabbing movement, like you are holding something. Now you can drag and move the shape in the space. To release, open your hands. Then, move your hand closer to the shape until a play button appears, and press the button to open the application. Here, you can try a couple of guides, which also give you a nice impression of the use cases for the HoloLens. You can either log in with an account or without.
Tip. If one of the applications does not work: try to connect to WIFI first.
Part 3. Making your first hologram move
- In the menu, click all apps. Here, chose 2D viewer.
- This opens up the 3D viewer application, and shows you a library with different 3D figures.
- To scroll down, push your finger into the screen and drag it down.
- Click a figure you like. This will let a 3D model of your choice appear in front of you. It is recommended to try one of the options with a little icon in the top right: this means that the figure has an amination.
- Hold and drag the figure down, so it sits on the floor. And remember from the earlier tutorial: you can also rotate or scale your figure.
- When you are happy with how your figure is placed, move your hand closer and press the ‘play’ button that appeared. Depending on the animation, the figure will now move in space. Try walking around, changing your perspective, and looking around if you can follow your hologram.
Tip: when you scaled your character, the animation is also scaled. This means that, for example, the skating penguin will now skate large circles in space. So don’t worry if you cannot find your hologram, just try to follow the sounds it makes and look around.
- To close the hologram, find the box that it came out off and press the X button.
Tip: take a look at the lifter hologram, this gives a nice impression of a potential use case of the HoloLens.
Developing your own Mixed Reality application
To build mixed reality applications for both VR and AR, we will use the Mixed Reality Toolkit (MRTK). The toolkit provides you with premade components that you can use to get started quickly. This tutorial is based on the Microsoft learning platform, however, multiple issues are resolved in this tutorial.
Chapter 01: Opening Unity
- Open the Unity Hub
- Click
projects
, andNew project
.
- On the left, chose
Core
. From here, chose the3D core template
. If this is not possible, update your Editor Version: in theInstals
tab and clickInstall Editor
. Next, give your new project a name and a location. ClickCreate Project
to open the Unity project. This might take a while.
Chapter 02: Configuring Unity
The standard Unity settings are not suitable for mixed reality, therefore we need to make sure the default is changed to immersive headsets.
- In the menu bar, select
File
>build settings
- Select
Universal Windows Platform
.
PROBLEM 1: If there is no platform build support module loaded, click the button to install this additional module. You might have to restart your unity project if no setting appear.
PROBLEM 2: If you don’t have Windows 10 SDK installed, please download it here Restart your unity project afterwards.
PROBLEM 3: Make sure your visual studio has the ‘Universal Windows Platform Development’ and ‘Desktop Development with C++’ workloads. You can install these by opening your visual studio installer application, and press Modify
. Select the two workloads, and press Modify
.
Change the settings as shown in the image below, then press Switch platform
.
Chapter 03: Importing and configuring the resources
- We will use the Mixed Reality Feature Tool to import the mixed reality toolkit in our project. Download the tool here
- Unzip the folder to your desktop
- Click the MixedRealityFeatureTool.exe to launch the application _PROBLEM 4: after launching, it might ask you to download NET. Follow the link in the pop-up and install the ‘Run desktop apps’ NET version. You can also find it here _
- After opening the tool, you see the start screen. Select
Start
.
- Select the three dots. Navigate to the Unity project you just created.
- Select
Discover Features
- Select the
+
sign besides Mixed Reality Toolkit, to unfold all options. Here, choseMixed Reality Toolkit Foundations
- Also click the
+
sign beside Platform Support, and selectMixed Reality OpenXR Plugin
.
- Click
Get Features
. Then first clickvalidate
, you should see a pop-up that says ‘No validation issues were detected’. ClickImport
, thenImprove
.
- Go to your Unity Editor and click somewhere in a blank area. This will start the unpacking of the packages.
- After Unity has imported all the packages, it asks to restart. Select
Yes
. - After this, the MRTK Project Configuration appears. Scale the window larger, to make sure all information is visible. If the window doesn’t open manually open it in the menu:
Mixed Reality
>Toolkit
>Utilities
>Configure Project for MRTK
- Click on
Unity OpenXR plugin (recommended)
to add it to your project.
- A welcome to MRTK screen opens. Here, select
Show XR Plug-In Management Settings
.
- The MRTK Project Configurator opens. Make sure you are on the XR Plug-in Management page and that the Universal Windows Platform settings tab is opened (check the windows logo tab). Make sure the Initialize XR on Startup is selected
- Select the OpenXR plug-in. Two items appear underneath OpenXR. Select the first one:
Mircrosoft HoloLens feature group
.
- Click the yellow warning sign besides OpenXR. This opens the OpenXR Project Validation window. There are multiple issues, select the button Fix All. After this, one issue remains.
- To fix this issue, click the
edit
button beside the issue description. This opens up the project settings tap of the OpenXR plugin. Underneath Interaction Profiles, click the+ button
. Here you can choose different types of interactions. ChoseEye gaze interaction profile
from the dropdown menu to add it. Click the button two more times to also add:Microsoft Hand Interaction Profile
, andMicrosoft Motion Controller Profile
. Then, for each interaction: if a yellow triangle appears beside them, click the triangle to open the validation window and select theFix
button.
- In the Project Settings window, make sure that the Microsoft Hololens, Hand Tracking, and Motion Controller Model are selected.
- In the same window, click the
Depth Submission Mode
dropdown to selectDepth 16 Bit
.
- Close the Project Setting window
- In the MRTK Project Configurator window, select
Apply Settings
. Then, clickNext
and thenApply
.
- Now, we will configure the project settings. Select
Edit
>Project Settings
- In the Project Settings window, select the
Player
tab from the left-side column - Click
Publishing Settings
, and give a good name for the Package name field. Here, we name it “MRTK-Tutorials-Getting-Started”. - Close the Project Settings window.
Chapter 04: Make a unity scene and configure MRTK
- In the menu bar, click
File
>New Scene
- In this window, select
Basic (Built-in)
, andCreate
.
- In the menu bar, select
Mixed Reality
>Toolkit
>Add to Scene and Configure…
- As you can see in your Hierarchy window on the left, two elements are added: MixedReatlityToolkit (this obtains the toolkit itself), and MixedRealityPlayspace (this handles the headsets or controllers)
- Select the MixedRealityToolkit in the Hierarchy. You should now see DefaultMixedRealityToolkitConfigurationProfile in your inspector on the right.
- We can edit this profile, however, the ‘default’ is already optimized for the HoloLens 2.
- Save your scene: select
File
>Save ass…
then navigate to:Assets
>Scenes
to name and save your project
Chapter 05: Interaction Models
The toolkit provides different types of interaction, think about: speech, hands, or controllers. Let's set them up!
- Let’s add hand interaction! In Unity you can create static objects. When you give them a script (think about it as a manual that tells them what to do) the user can interact with it to move, scale or rotate the object with their hands.
- In the Menu bar, select
GameObject
>3D Object
>Cube
- The default size of the cube is a meter by a meter, let’s scale it down to 20 cm for each side. Select the cube and change the Scale values to X=0.2, Y=0.2, Z = 0.2
- The cube is placed at the (0,0,0) coordinate, which is the same place as the user’s head. Change the Position to X = -0.2, Y = 0.1, Z = 0.5
- Let’s also change the rotation of the cube, so we can see all sides of it. Change the Rotation to X = 9, Y = 14, Z = 0
- Now, we will add the script to the cube so that you can grab the cube in the AR environment. Select the cube in the hierarchy (you probably still have it selected)
- Click
Add Component
, which is visible at the bottom of the Inspector tab. Search for Object Manipulator.
- Again, scroll to the bottom of the Inspector, click
Add component
, and search for the Near Interaction Grabbable script to add it to the cube.
Chapter 06: Time to play (almost)
- We are going to test our cube. Click the play button .
- Click the
three-dot button
besides the Inspector. SelectMaximize
. - Press spacebar, this makes a simulated right hand appear in the view.
- Play around with the cube: press the left mouse button to grab the cube and drag it around.
- Some additional controls:
- Change the view in the scene:
- To move the camera forward/left/back/right, press the W/A/S/D keys.
- To move the camera vertically, press the Q and E keys.
- To rotate the camera, press the right mouse button and then drag.
- Simulate hand input:
- To enable the simulated right hand, press and hold the space bar. To remove the hand, release the space bar.
- To enable the left simulated hand, press and hold the left shift key. To remove the hand, release the key.
- To move either hand around the scene, move the mouse.
- To move the hand forward or backward, rotate the mouse scroll wheel.
- To simulate the pinch gesture, click the left mouse button.
- To rotate the hand, press and hold down the space bar + CTRL key (right hand) or left shift key + CTRL key (left hand) and then move the mouse.
- Persistent hands
- To enable a hand and keep it onscreen without continuing to hold down a key, press T (left hand) or Y (right hand). To remove the hands, press those keys again.
- Change the view in the scene:
Chapter 07: From Unity to HoloLens
- Select
File
>Build settings…
- In the build setting windows: click
Add Open Scenes
, this will add our scene to the Scenes In Build list.
- Click the
Build
button. - Chose or create a new map where you want to store your build. Click
Select Folder
, to start the build process. This might take a few minutes! - Now, open the folder where your build is placed. Double-click the .sln file to open it in Visual Studio.
- Select the
Release
andARM64
settings in Visual Studios. (If you are using the HoloLens 1, pick x86)
- Now we will turn on Developer Mode on both our laptop and the Hololens
- On our laptop
- Go to Settings (Instellingen)
- Go to Update and Security (Bijwerken en beveiliging)
- Go to For developers (Voor ontwikkelaars)
- Enable Developer Mode (Ontwikkelaarsmodus)
- On the HoloLens2
- Turn the device on and put it on your head.
- Log in, and launch the main menu
- Go to Settings > For developers > and enable developermodus
- On our laptop
- Connect to the same Wifi on your device and on the HoloLens
- In Visual Studios select Remote Machine.
_PROBLEM: If this option is not visible, you might have an error message in your solution explorer on the right. Installing the needed tools might solve the problem. _
- Go to
Project
>Properties
. In the new window, go toConfiguration Properties
>Debugging
. - Under
Debugger to launch
, selectRemote Machine
. - Under Machine Name, enter the IP address of the HoloLens
- On your hololens, go to:
settings
>Network and Internet
>WIFI
. Scroll down all the way to the buttom toHardWare Properties
. Here, you will find the IP address.
- On your hololens, go to:
- Set the Authentication Mode to
Universal (Unencrypted protocol)
- In visual studio: select
Debug
>Start Without Debugging
. This might take a while! The final output should show the following:
- Check your output, if it says “Deploy: 0 succeeded” complete the remainder of this step (otherwise continue to the next step). Select
Build
>Deploy Solution
. The app will now be deployed to your Hololens. If it is the first time deploying an app to your hololens, visual studios will ask for a pin:- On your Hololens, go to
Settings
>Updates and Security
>For developers
- Select Pair. This will prompt a pin code.
- Enter the PIN in Visual Studios
- On your Hololens, go to
- Your deployment is finished is you see the following output:** Deploy: 1 succeeded, 0 failed**
- On your HoloLens open the start menu. Find the tile for our new app and select it to open your app!
Coming soon: building an interactive scenery for the HoloLens.