Book Image

Microsoft HoloLens By Example

By : Joshua Newnham
Book Image

Microsoft HoloLens By Example

By: Joshua Newnham

Overview of this book

Are you a developer who is fascinated with Microsoft HoloLens and its capabilities? Do you want to learn the intricacies of working with the HoloLens SDK and create your own apps? If so, this is the book for you. This book introduces and demystifies the HoloLens platform and introduces new ways you can interact with computers (Mixed Reality). It will teach you the important concepts, get you excited about the possibilities, and give you the tools to continue exploring and experimenting. You will go through the journey of creating four independent examples throughout the book, two using DirectX and two using Unity. You will learn to implement spatial mapping and gesture control, incorporate spatial sound, and work with different types of input and gaze. You will also learn to use the Unity 5 SDK for HoloLens and create apps with it. Collectively, the apps explore the major concepts of HoloLens, but each app is independent, giving you the flexibility to choose where to start (and end).
Table of Contents (16 chapters)
Title Page
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
6
Interacting with Holograms Using Unity

Preface

This book is about developing mixed reality applications for the HoloLens platform, specifically focusing on core topics unique to mixed reality applications and diving deep into areas such as hologram placement, modes of interaction, and sharing experiences across devices; these are delivered through a series of examples, each focusing on illustrating one or more of these core topics. This focus on core topics differentiates this book from others, along with illustrating one of these through non-trivial and, hopefully, inspiring examples.

After completing this book, you will have a good grasp of the HoloLens platform and, more importantly, be inspired and motivated to continue your journey of exploring and experimenting with envisioning new ways in which we can interact with our computers with platforms such as Microsoft HoloLens.

What this book covers

Chapter 1, Enhancing Reality, introduces readers to the concepts of mixed reality, contrasting it against augmented reality (AR) and virtual reality (VR), including a discussion about the opportunities it offers in creating more natural and immersive experiences.

Chapter 2, Tagging the World Using DirectX, begins walking through setting up the environment, and then walks the user through building an augmented reality application that leverages the Microsoft Cognitive Services Computer Vision API to tag recognized content within the users' field of view, specifically, recognizing faces.

Chapter 3, Assistant Item Finder Using DirectX, that explains how to build on top of the previous example by allowing the user to pin tagged items and have the system assist the user navigate back to them.

Chapter 4, Building Paper Trash Ball in Unity, walks the reader through the development of a popular smartphone game--Paper Toss--but unlike the traditional game, the setting will be the user’s physical environment.

Chapter 5, Building Paper Trash Ball Using HoloToolkit in Unity, is a continuation of the last chapter, but looks at reimplementing the project using HoloToolkit and a collection of scripts and components intended to accelerate development of HoloLens application development, and extends it by adding an holographic user interface.

Chapter 6 , Interacting with Holograms Using Unity, explores various ways the user can interact with holograms. We start by discussing gestures, along with allowing the user to touch holograms, then introduce the reader to Voice User Interfaces, walking the reader through extending the application to allow the user to manipulate the hologram using their voice.

Chapter 7, Collaboration with HoloLens Using Unity, outlines building a project where HoloLens is shared across multiple devices. The example is based on a collaborative design review, whereby a design (a 3D model) is streamed to multiple HoloLens devices where it is projected into the real world, allowing for richer engagement and collaboration.

Chapter 8, Developing a Multiplayer Game Using Unity, covers our final example of building a fun multiplayer game inspired by the classic Cannon Fodder, where the user will navigate their team around the environment to eliminate their opponent.

Chapter 9, Deploying Your Apps to the HoloLens Device and Emulator, showcases the process of building and deploying applications to an actual HoloLens device and/or emulator.

What you need for this book

Here is a list of software used in this book:

  • Window 10 Pro
  • Visual Studio 2015 Update 3
  • HoloLens Emulator (build 10.0.14393.0)
  • Unity 5.5.0f3
  • Holotoolkit-Unity (SHA1 cd2fd2f9569552c37ab9defba108e7b7d9999b12)
  • Vuforia 6.1
  • Blender 2.78

Who this book is for

This book is for developers who have some experience with programming in any of the major languages, such as C# and C++. You do not need any knowledge of augmented reality development.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning. Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The details of spatial reasoning are encapsulated in the HolographicFrame class, which is created at each frame within the Update method, as in the following extract." 

A block of code is set as follows:

 public HolographicFrame Update()
 {
 // ...
 HolographicFrame holographicFrame =  
 holographicSpace.CreateNextFrame();
 // ...
 }

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

public void SetHolographicSpace(HolographicSpace holographicSpace)
{
// ...
referenceFrame = locator.CreateStationaryFrameOfReferenceAtCurrentLocation();
} 

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Next, launch Visual Studio, and create a new project by selecting the File | New Project menu item."

Note

Warnings or important notes appear like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply email [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files emailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your email address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Microsoft-HoloLens-By-Example. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/MicrosoftHoloLensByExample_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the internet, please provide us with the location address or website name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.