Today, we are witnessing the burgeoning of virtual reality (VR), which is exciting new technology and a creative medium that promises to transform how we interact with our information, friends, and the world at large in a fundamental way.
Through wearing a VR head-mounted display (HMD), you can view stereoscopic three-dimensional 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 can 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 VR development using the Unity 3D game engine. We will walk through a series of hands-on projects, step-by-step tutorials, and in-depth discussions using Unity 2019.4 LTS or Unity 2020.x, and other free or open source software. While VR technology is rapidly advancing, we'll try to capture the basic principles and techniques that 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 on devices such as Oculus Rift, Quest, HTC VIVE, and others. We'll also cover the 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 VR experiences.
About the author and this third edition
Years ago, I studied 3D computer graphics in college and user interface design in graduate school, before starting 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 start-ups. Then, in March 2014, I read about Facebook purchasing Oculus for $2 billion; 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 a final draft and publication. I was obsessed. At the time, I told my wife that I felt the book had 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 writing, Google Cardboard was a thing, but there were no consumer VR devices. The Oculus 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 consumer version of Oculus Riftwas 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 entered the 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 three-dimensional 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 project book for AR applications on iOS, Android, and HoloLens devices.
In May 2018, I published the second edition of this book, Unity Virtual Reality Projects. When the time came to begin the second edition, 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. But it wasn't 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 from the first edition) as that can really cause motion sickness! Every chapter and project was updated. New chapters and projects were added, including an audio fireball game, a storytelling and animation experience, and a discussion of optimization best practices.
In this third edition, the book has again been significantly revised and expanded. With the introduction of the Unity XR platform architecture, plugins, and XR Interaction Toolkit, I decided to focus on this new standard API and components throughout the book. All of the chapters and projects have been adapted to use Unity's own XR SDK instead of provider-specific toolkits because I see this to be a hugely significant development and contribution by Unity to the progress of our industry. I sincerely hope you find this book fun, educational, and helpful as we create great new VR content and explore this amazing new medium.