mixed-reality

Updating 2D UWP apps for Windows Mixed Reality

Windows Mixed Reality lets your users see holograms as if they’re right around them in the physical and digital world. At its core, both HoloLens and the Desktop PCs you attach immersive headset accessories to are Windows 10 devices. You’re able to run almost all Universal Windows Platform (UWP) apps in the Store as 2D apps.

Creating a 2D UWP app for mixed reality

The first step to bringing a 2D app to mixed reality headsets is to get your app running as a standard 2D app on your desktop monitor.

Building a new 2D UWP app

To build a new 2D app for mixed reality, you build a standard 2D Universal Windows Platform (UWP) app. No other app changes are required for that app to then run as a slate in mixed reality.

To get started building a 2D UWP app, check out the Create your first app article.

Bringing an existing 2D Store app to UWP

If you already have a 2D Windows app in the Store, make sure it’s targeting the Windows 10 Universal Windows Platform (UWP). Here are all the potential starting points you may have with your Store app today:

Starting Point AppX Manifest Platform Target How to make this Universal?
Windows Phone (Silverlight) Silverlight App Manifest Migrate to WinRT
Windows Phone 8.1 Universal 8.1 AppX Manifest that Doesn’t Include Platform Target Migrate your app to the Universal Windows Platform
Windows Store 8 8 AppX Manifest that Doesn’t Include Platform Target Migrate your app to the Universal Windows Platform
Windows Store 8.1 Universal 8.1 AppX Manifest that Doesn’t Include Platform Target Migrate your app to the Universal Windows Platform

If you have a 2D Unity app today built as a Win32 app on the PC, Mac & Linux Standalone build target, switch to the Universal Windows Platform build target for mixed reality.

We’ll talk about ways that you can restrict your app specifically to HoloLens using the Windows.Holographic device family below.

Run your 2D app in a Windows Mixed Reality immersive headset

If you’ve deployed your 2D app to a desktop machine and tried it out on your monitor, you’re ready to try it out on an immersive desktop headset!

Just go to the Start menu within the mixed reality headset and launch the app from there. The desktop shell and the holographic shell both share the same set of UWP apps, and so the app should already be present once you’ve deployed from Visual Studio.

Targeting both immersive headsets and HoloLens

Congratulations! Your app is now using the Windows 10 Universal Windows Platform (UWP).

Your app is now capable of running on today’s Windows devices like Desktop, Mobile, Xbox, Windows Mixed Reality immersive headsets, HoloLens, and future Windows devices. However, to actually target all of those devices, you will need to ensure your app is targeting the Windows. Universal device family.

Change your device family to Windows.Universal

Now let’s jump into your AppX manifest to ensure your Windows 10 UWP app can run on HoloLens:

If you don’t use Visual Studio for your development environment, you can open AppXManifest.xml in the text editor of your choice to ensure you’re targeting the Windows.Universal TargetDeviceFamily.

Run in the HoloLens Emulator

Now that your UWP app targets “Windows.Universal”, let’s build your app and run it in the HoloLens Emulator.

Next steps

At this point, one of two things can happen:

  1. Your app will show its splash and start running after it’s placed in the Emulator! Awesome!
  2. Or after you see a loading animation for a 2D hologram, loading will stop and you’ll just see your app at its splash screen. This means that something went wrong and it will take more investigation to understand how to bring your app to life in Mixed Reality.

You’ll need to debug to get to the root of possible issues that are stopping your UWP app from starting on HoloLens.

Running your UWP app in the debugger

These steps will walk you through debugging your UWP app using the Visual Studio debugger.

HoloLens Emulator loaded with a UWP sample showing a system exception

Update your UI

Now that your UWP app is running on immersive headsets and HoloLens as a 2D hologram, next we’ll make sure it looks beautiful. Here are some things to consider:

2D app view resolution and scale factor

From responsive design

Windows 10 moves all visual design from real screen pixels to effective pixels. That means, developers design their UI following the Windows 10 Human Interface Guidelines for effective pixels, and Windows scaling ensures those effective pixels are the right size for usability across devices, resolutions, DPI, and so on. See this great read on MSDN and this BUILD presentation for more information.

Even with the unique ability to place apps in your world at a range of distances, TV-like viewing distances are recommended to produce the best readability and interaction with gaze/gesture. Because of that, a virtual slate in the Mixed Reality Home will display your flat UWP view at:

1280x720, 150%DPI (853x480 effective pixels)

This resolution has several advantages:

2D app view interface design best practices

Do:

Don’t:

Understand the app model

The app model for mixed reality is designed to use the Mixed Reality Home, where many apps live together. Think of this as the mixed reality equivalent of the desktop, where you run many 2D apps at once. This has implications on app life cycle, Tiles, and other key features of your app.

App bar and back button

2D views are decorated with an app bar above their content. The app bar has two points of app-specific personalization:

Title: displays the displayname of the Tile associated with the app instance

Back Button: raises the BackRequested event when pressed. Back Button visibility is controlled by SystemNavigationManager.AppViewBackButtonVisibility.

App bar UI in 2D app view
App bar UI in 2D app view

Test your 2D app’s design

It’s important to test your app to make sure the text is readable, the buttons are targetable, and the overall app looks correct. You can test on a desktop headset, a HoloLens, an emulator, or a touch device with resolution set to 1280x720 @150%.

New input possibilities

HoloLens uses advanced depth sensors to see the world and see users. This enables advanced hand gestures like bloom and air-tap. Powerful microphones also enable voice experiences.

With Desktop headsets, users can use motion controllers to point at apps and take action. They can also use a gamepad, targeting objects with their gaze.

Windows takes care of all of this complexity for UWP apps, translating your gaze, gestures, voice, and motion controller input to pointer events that abstract away the input mechanism. For example, a user may have done an air-tap with their hand or pulled the Select trigger on a motion controller, but 2D applications don’t need to know where the input came from - they just see a 2D touch press, as if on a touchscreen.

Here are the high-level concepts/scenarios you should understand for input when bringing your UWP app to HoloLens:

Voice input is a critical part of the mixed reality experience. We’ve enabled all of the speech APIs that are in Windows 10 powering Cortana when using a headset.

Publish and Maintain your Universal app

Once your app is up and running, package your app to submit it to the Microsoft Store.

See also