HoloLens Terrain Generation Demo Part 1 – Getting Started

Getting a basic application up and running for the HoloLens is both relatively straight forward and somewhat tricky. If you already have a HoloLens1, then you can pretty much just build and deploy directly to the device. If you, like me, need to use the emulator, there are a few more steps to take before you even create your application.

Enabling Virtualization

First off, I’m pretty certain that the emulator is only available for Windows 10 Pro and above. If you’re running something else, I don’t think this is an option for you. If you’ve got that, then you should be able to continue.
This article pretty much tells you all you need to look for to enable the Hyper-V technology the HoloLens emulator relies on. The gist of it is that you need to access your computer’s BIOS and enable and disable some stuff, depending on your exact hardware. I’m running an ASUS motherboard and INTEL processor. For my computer, I had to enable XD (Execute Disable) and disable Intel VT-d (Virtualization Technology).
Until you perform this step, you can’t actually fully enable Hyper-V in Windows. I actually enabled Hyper-V according to the above link prior to changing my BIOS settings and I noticed that the Hyper-V Platform option was grayed out. The Management Tools were the only available option. It didn’t cause an error enabling it, but I could not continue with actually installing the emulator. Once I changed the BIOS settings, the Platform turned on automatically, I assume because the tools were already enabled.
Once you’ve got this stuff enabled, you should be able to install the emulator. This was pretty much automated. No gotcha moments.

Creating an Application in Visual Studio

As I mentioned in the introduction, Microsoft supplies a template for building the App. You’ll find it under the Windows templates menu when you create a new project.
The template comes with all of the framework code needed to get a UWP and HoloLens application up and running. It also provides some sample content we can follow when creating our own content. The Spinning Cube gives us something to compile and run and confirm we’ve got our environment working.
So of course the next thing I tried to do was compile and run the code. Unfortunately, while compiling seemed fine, UWP adds another step: Deployment. This step failed.
That error was pretty baffling to me. The big long random looking string can be found in your Package.appxmanifest file, under the Packaging heading. I think it must actually be randomly generated. I haven’t tried changing it.
The DEP0700 message was a red herring. It had me searching through various options to find an issue that wasn’t there.
The error itself, 0x80073CFD, apparently means that ‘a specified install prerequisite couldn’t be satisfied.’ It took me a bit to realize that the error was actually being caused by the device I was trying to deploy to.
By default, Visual Studio had been set to deploy to the Local Machine. That makes sense in most cases, of course, because you’re going to be running your code on your computer. But we’re not technically running the code on the Local Machine. We’re running it on a Virtual Machine. I didn’t even think to look at this at first, but eventually I checked the menu and found there actually is a HoloLens Emulator option. Once I switched to that, deployment went fine.
When you run the application, it will first load the emulator. This takes a minute or so on my computer. When it first loads, you’ll see the default menu pop up.
Give it another 30 seconds or so, and Visual Studio will then load the app itself into the emulator, which will switch the view.
You can then move around the scene and manipulate the emulator with the controls found here. Because I want to ensure I have a flat surface to build my terrain on, I switched the loaded room to the Great Room option. You can’t see it in the emulator, but if you right click or press space or enter, the mesh for the room becomes visible for a second.

So this gives us a starting point to build our demo on. The approach I’m thinking I’ll take will be to create a mesh and display it floating in space like the cube sample. Then I’ll implement the procedural terrain generation algorithm and render that as an animation. Once I’ve got my terrain working, I’ll look for a way to actually fit it onto a surface in the world.

For the latest version of the code, see GitHub.