Chapter 3. Going Native: Developing for Oculus Rift on the Desktop
The next several chapters cover the essentials of virtual reality development. We’ll start by creating a native application for desktop computers using the Oculus Rift. While the information in this chapter is specific to the Rift and the Oculus SDK, the same techniques will apply when developing for the HTC Vive and other headsets.
In programming our first VR application, we will explore these core concepts:
- Constructing a 3D scene
We’ll see how to create the visual, interactive, and scripted elements that represent the virtual reality environment.
- Rendering the 3D scene in stereo
We’ll look at how to render the scene from each of two cameras representing the user’s eyes. Via the lenses in the Oculus Rift headset, the two rendered images are combined into a single, coherent visual field to create a stereoscopic view of the environment.
- Head tracking to provide presence
We’ll see how to use the position and orientation of the Oculus Rift headset to change the virtual camera’s position and orientation within the environment.
To illustrate these ideas, we need to write 3D code. Programming to a 3D rendering API like OpenGL or DirectX is a lot of work, and is beyond the scope of this book. Instead, we are going to use the popular Unity3D game engine. Unity provides enough power to build games and VR quickly without too steep of a learning curve.
But before we delve into Unity, let’s make sure we understand ...