Preface
Today, we are witnesses to the burgeoning of virtual reality (VR), an exciting new technology and creative medium that promises to transform how we interact with our information, friends, and the world at large in a fundamental way.
Wearing a VR head-mounted display (HMD), you can view stereoscopic 3D scenes. You can look around by moving your head, walk around the space with room-scale tracking, and interact with virtual objects with positional hand controllers. With VR, you engage in fully immersive experiences. It's like you're really in some other virtual world.
This book takes a practical, project-based approach to teach you the specifics of virtual reality development using the Unity 3D game engine. We walk through a series of hands-on projects, step-by-step tutorials, and in-depth discussions using Unity 2018 and other free or open source software. While VR technology is rapidly advancing, we'll try to capture the basic principles and techniques you can use to make your own VR games and applications immersive and comfortable.
You will learn how to use Unity to develop VR applications that can be experienced with devices such as the Oculus Rift, Google Daydream, HTC VIVE, and others. We'll cover technical considerations that are especially important and possibly unique to VR. By the end of this book, you will be equipped to develop rich and interactive virtual reality experiences.
About the author and this Second Edition
Years ago, I studied 3D computer graphics in college and user interface design in graduate school and then started a small software company developing a 3D graphics engine for managing AutoCAD engineering drawings. We sold the business to Autodesk. In the ensuing years, I focused on 2D web app development, blogged about my technical adventures, and pursued several new startups. Then, in the March of 2014, I read about Facebook purchasing Oculus for $2B; that certainly piqued my interest. I immediately ordered my first VR headset, the Oculus DK2 developer kit, and began developing small VR projects in Unity.
In February 2015, I had the idea to write a book on Unity VR development. Packt accepted my proposal right away, and suddenly I realized, "Oh no! I have to do this!" Within 6 months, in August 2015, the first edition of this book was published. That's a short time to go from proposal to outline to chapter drafts to review to final draft and publication. I was obsessed. At the time, I told my wife that I feel the book has a life of its own, "it's inside of me and struggling to get out, I just have to get out of its way." She replied, "It sounds like you're pregnant."
At the time of that writing, the Google Cardboard was a thing, but there were no consumer VR devices. The DK2 had no hand controllers, just an XBox game controller. Months after the book was released, in November 2015, the HTC Vive came to market with room scale and positionally tracked hand controllers. In March 2016, the Oculus Rift consumer version was released. Not until December 2016, almost a year and a half after the book came out, did Oculus release its positionally tracked Touch hand controllers.
Since the first edition of this book, many new VR devices have come to market, hardware and software features have improved, and the Unity game engine continues to add native VR SDK integrations and new features to support them. Oculus, Google, Steam, Samsung, PlayStation, Microsoft, and many others have joined the fray as the industry continues to accelerate and blossom.
Meanwhile, in 2016, I coauthored another book with Packt, Cardboard VR Projects for Android, a non-Unity VR book using Java and Android Studio to build Google Daydream and cardboard applications. (In that book, you build and use your own home-grown 3D graphics engine for mobile devices). Then in 2017, I coauthored a third book with Packt, Augmented Reality for Developers, an exciting and timely Unity-based projects' book for AR applications on iOS, Android, and HoloLens devices.
When the time came to begin this second edition of Unity Virtual Reality Projects, I expected it to be a relatively simple task of updating to the current version of Unity, adding support for positionally tracked hand controllers, plus a few tweaks here and there. Not so simple! While much of the fundamentals and advice in the first edition did not change, as an industry, we have learned a lot in these few short years. For example, it's really not a great idea to implement a trampoline in VR (one of our projects that got scrapped in this edition), as that can really cause motion sickness!
For this second edition, the book is significantly revised and expanded. Every chapter and project has been updated. We separated some topics into their own chapters with completely new projects, such as the audio fireball game (Chapter 8, Playing with Physics and Fire), animation (Chapter 11, Animation and VR Storytelling), and optimization (Chapter 13, Optimizing for Performance and Comfort). I sincerely hope you find this book fun, educational, and helpful, as we all aim to create great new VR content and explore this amazing new medium.