Developing for Hololens

TWNKLS is always pushing the envelope when it comes to Augmented Reality Development and solutions. Thus when the Microsoft Hololens was released we couldn’t sit back and watch it unfold into one of the leading AR development platforms in the market. The main question we quickly asked ourselves was “What does it take to develop a solid industry application for the Hololens?”. With this question in mind we took up the challenge, looked for a innovative industry partner and started on our first Microsoft Hololens project.

Finding the correct tools.

Microsoft provides clear and straight forward documentation about the tools needed for setting up an environment with which the developer can move forward in the Hololens development process. These tools can be found on their website. The main development environment for the Microsoft Hololens is Unity3D (version 5.4 and up ). In turn Unity3D will create a Visual Studio Project that will build the Hololens application and sends it to the glasses. More on creating a project will follow later.

Finding documentation.

Because the Hololens is such a new device, there is little to no documentation on this subject.
Microsoft provides a series of tutorials which make use of their own classbase or, in most cases, only describes the concepts of the different components needed for developing a solid Hololens application. Often a developer will only need a small portion of the provided classbase or something different in total, so this creates somewhat of a struggle. Also because Unity3D implements the new Windows Universal SDK, Unity3D developers are heavily dependent on the implementation that Unity3D provides in their software. One can state that if windows has updates their own SDK, it will take some time for Unity3D to implement it and also let’s not forget developers will need to update their software to get the latest features provided by Microsoft.

I would suggest not only looking at the tutorials provided by Microsoft, but also look at the documentation they provide and to dig into their classbase on GitHub.

Setting up a basic project.

Let’s setup a basic Unity3D project to be build on the Hololens.
Start by opening Unity3D ( v5.4.x or higher) and create an empty project.

Because the Hololens is in essence a camera we will need 1 camera within the project.
By default the camera should be placed on [ 0, 0, 0 ], this will represent the user wearing the Hololens. Microsoft states that the hololens holograms don’t really work on distances closer than 85 cm from the camera ( aka user ). So let’s set the camera nearplane to 0.85 units which translates to 85 cm.

!! When developing for hololens the developer needs to keep in mind that 1 unit in Unity3D translates to 1 meter in “real life”.

To have something to look at within your first Hololens application we will place a cube in front of the camera. This will serve as our “hologram”. Keep in mind the distance metric explained above. In this example we will place the cube at [0, 0, 3] thus 3 meters in front of the user. We will also scale the cube to [0.5, 0.5, 0.5] translating to a cube that has real world dimensions of 50cm x 50cm x 50cm.


Now open the build settings ( File -> Build Settings.. ) and switch your environment to Windows Store.
As for the SDK option, set it to Windows 10. The “UWP build Type” should be D3D and set “Build and run on” to Local Machine.
Be sure to also check “Unity C# Projects”.

We are almost there. Click “Player Settings”, which will show the settings in your inspection tab. Inside the “Other Settings” tab, check “Virtual Reality Supported”. This will show an extra option box with Virtual Reality SDKs. Make sure the “Windows Holographic” option is added in there.
We now have a basic setup of a Hololens project inside Unity3D.

Press build and select a folder in which Unity3D will place the compiled Visual Studio project.

Enabling the Hololens for development.

Before we can publish our application to the Hololens we first need to enable it for development. To do this, turn you hololens on and go to the Settings panel. Within your Settings go to Update & Security on the bottom right. Once there select For Developers on the left side and Toggle Developer Mode to ON.


Publish the project to the Hololens.

Now that we have setup our basic Hololens project it’s time to publish it to the Hololens.
This will require a couple of extra steps, but fear not.. we are almost done!
Open your newly compiled Visual Studio Project.
In the Solution Explorer select the Universal Windows project.
Set your Solution Configuration to Release, your Solution Platform to x86 and your build target to Remote Machine.


This will probably spawn a box asking which remote machine you want to connect to.

This will be the time to turn to your Hololens and connect to your local network in which your development machine should also be connected. Inside the Hololens go to the Settings window, then select Wifi / Networks and choose advanced options. This will show the ip address of your Hololens. This is the address you will have to put inside the box Visual Studio spawned and set the Authentication Mode to Universal (Unencrypted Protocol). Close the box to save.

Another way of setting the Remote Machine address is to open your Project Properties ( Project -> Properties ) and select the Debug option. Under Start options you can fill your credentials.
Be sure to save.

The last step will be to press the green play button on top. This will start the process of publishing our Hololens application to the Hololens.

During this process Visual Studio will ask you to pair with the Hololens. The pairing code can be found inside the Developer tab of the Hololens. Have no fear, you will ony have to pair once.

Give it some time to compile and upload.

!! Note: It can happen that Visual Studios fails to connect to the Hololens. To fix this, close and reopen Visual Studio and start the publishing process again.

VoilĂ ! You have made a basic Hololens application.

So what’s next ?

TWNKLS loves to enable other developers to easily development for new platforms. Because of this, we will be releasing a Hololens framework with basic functionality and support. More on that subject soon!

Comments are closed.