Book Image

Microsoft HoloLens Developer???s Guide

By : Dennis Vroegop
Book Image

Microsoft HoloLens Developer???s Guide

By: Dennis Vroegop

Overview of this book

HoloLens, Microsoft’s innovative augmented reality headset, overlaps holograms into a user’s vision of their environment. Your ideas are closer to becoming real when you can create and work with holograms in relation to the world around you. If you are dreaming beyond virtual worlds, beyond screens, beyond pixels, and want to take a big leap in the world of augmented reality, then this is the book you want. Starting off with brainstorming and the design process, you will take your first steps in creating your application for HoloLens. You will learn to add gestures and write an app that responds to verbal commands before gradually moving on creating sounds in the app and placing them in a 3D space. You will then communicate between devices in the boundaries of the UWP model.
Table of Contents (16 chapters)
Title Page
Credits
About the Author
Acknowledgments
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Occlusion


We have covered a lot so far. However, we have not discussed one very important thing: how to hide virtual things behind physical things.

I have shown you the virtual puppy hiding behind my living room chair. How do we do this? The answer is: using the right kind of shader.

We have mentioned shaders before, but now it is time to delve a little bit more deeply into them.

In DirectX, we have a whole set of shaders: we have seen pixelshaders, geometryshaders, and vertexshaders. There are a lot more, but we will not go into those at all.

In Unity3D we only have one, simply called the shader. The shader we use is a property of the material we apply.

Let us create a new one. In our Unity3D project, create a new shader. Call it Occlusion. You do this by right-clicking in the Assets pane and selecting the relevant menu options, as shown in the following screenshot:

Creating a shader

Double-click on the newly created file and you will get the following code:

Shader "Custom/Occlusion" { 
   Properties...