Microsoft Hololens experience

Microsoft Hololens experience

holo1

Short introduction

Hololens is here! Yes! Augmented reality can be really fascinating especially when we talk about holograms and applications. Microsoft created amazing device – Hololens. With this device you will be taken to the world of holograms no matter where you are. In this article I have big pleasure to test Hololens and write few words about experience while using it. What is more I would like to present how to create first augmented UWP application.

 

Before we start

This article is special because not everyone has access to Hololens device. I would like to show how to setup device and connect it with our Windows 10 PC.

What’s inside?!

Hololens box contains:

  • Hololens
  • Clicker to set up proper calibration
  • Cable
  • Case
  • Stands for nose
  • Instructions book

holo27

Device has really quality. Speakers produce great 3D sound (called spatial sound) especially when you start holograms animations (yes holograms have also sounds) and walk near them. When you have it on your heas you should also adjust stripe otherwise you will feel wight on your nose.

holo30

holo28

holo29

Turn on developer mode and connect to the device

Before you can start developing for Hololens, developer mode should be enabled. On the device go to “Settings” then open “Updates and Security” tab and then go to “For developers” tab. Turn on developer mode.

Once you have it enabled we need to connect from Windows 10 PC via Device Portal – place where you can manage your Windows 10 devices (in this case Hololens):

1) Connect Hololens with USB cable to the PC

1) Go to http://127.0.0.1:10080 in your browser.

2) Click “Request pin”

3) On the Hololens you should see PIN. Type it in the Device Portal

4) Once you type pin, fill username and password – this will help you to connect in the future.

5) Type username and password once again.

Ready! If you typed everything correctly you should see confirmation status:

holo2

Download Hololens app from the Windows Store

It is also good to download Hololens app. This will enable you to stream from the device’s point of view, remotely start and stop apps, capture mixed reality photos and videos.

holo3_3

1) Once you launch the app you have to add your device:

holo4

2) Enter IP addess – you can find it in the Device Portal under “Networking” tab:

holo6

holo5

3) Type username and password you set earlier:

holo7

Done!

holo8

Click on the tile with name of your device. You have access now to live stream and many other great functionalities!

holo9

holo11

holo10

 

Develop your first Hololens app

Before we start there are some prerequisites:

It is more simple than you think.

1) Open Visual Studio and select new project – Universal Windows Application:

holo12

holo13

2) Make sure that your app target is set to “Windows.Universal”:

holo14

Before we move forward – below I would like to show how to install and launch Hololens emulator for those who do not have physical device:

  • Remember to select both check boxes below and click “Install”

holo15

Once it is installed we start to launch application either on device or emulator:

  •  Device:

holo16

  • Hololens emulator:

holo17

I will launch application on the real device:

holo18

Yes! That’s it! Application was launched on the Hololens. You can pin it on the one of your walls 🙂

Of course application is empty now but we will add more functionality below. Before that you have to know that there are some rules:

  • HoloLens will run all 2D apps at a fixed resolution and DPI that equates to 853×480 effective pixels
  • HoloLens does not support 2D live tiles
  • HoloLens does not support the Share contract, 2D Printing, full screen mode and casting

3D Map application

1) Open “MainPage.xaml” and replace existing code with below:

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:FirstHololensApp" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Maps="using:Windows.UI.Xaml.Controls.Maps" x:Class="FirstHololensApp.MainPage" mc:Ignorable="d">

  <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
  <Maps:MapControl x:Name="MyMap" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" MapServiceToken="<<YOUR MAP TOKEN HERE>>" Style="Aerial3DWithRoads"/>
  </Grid>
</Page>

To generate MapServiceToken you have to register (free) in Bing Maps Portal and generate new key.

2) Now open “MainPage.xaml.cs” and replace existing code with below:

public sealed partial class MainPage : Page
  {
    public MainPage()
     {
       this.InitializeComponent();
     }

    protected async override void OnNavigatedTo(NavigationEventArgs e)
     {
       base.OnNavigatedTo(e);
       await showStreetsideView();
     }

    private async Task showStreetsideView()
     {
        if (MyMap.IsStreetsideSupported)
         {
           BasicGeoposition cityPosition = new BasicGeoposition() { Latitude = 48.858, Longitude = 2.295 };
           Geopoint cityCenter = new Geopoint(cityPosition);
           StreetsidePanorama panoramaNearCity = await StreetsidePanorama.FindNearbyAsync(cityCenter);

          if (panoramaNearCity != null)
           {
             StreetsideExperience ssView = new StreetsideExperience(panoramaNearCity);
             ssView.OverviewMapVisible = true;
             MyMap.CustomExperience = ssView;
           }
        }
        else
         {
           ContentDialog viewNotSupportedDialog = new ContentDialog()
           {
             Title = "Streetside is not supported",
             Content = "\nStreetside views are not supported on this device.",
             PrimaryButtonText = "OK"
           };
            await viewNotSupportedDialog.ShowAsync();
        }
     }
 }

3) Launch application on the device and see result:

holo20

holo21

As you can see creating simple UWP app for Hololens is easy.

If you would like to create some more advanced holograms you should use Unity. It enables you to create holograms, program interaction with them and add sound. You can then deploy your app on Hololens and see result. If you are interested to read more about it you should definitely visit official Holographic Academy webiste here.

 

Let’s add some more holograms in this room

By default Hololens has built in app to select and place holograms:

holo22

holo23

I am able to place holograms in different corners and what is more – I can change their size and also start animation:

holo24

holo25

 

Sum up

holo26

As you can see Hololens is great device – not only because of holograms (which are of course amazing) but it is also quite easy to setup for creating apps and holograms. Unfortunately during writing this artice Hololens is not for sale. Only for developers from Australia, Canada, France, Germany, Ireland, New Zealand, the UK, and the US have access to it and can buy developer edition for 3000$. I hope that soon everyone will have chance to try it and create some amazing apps!

You can read more on the official website.

holo31

Advertisements