Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Mastering Oculus Rift Development
Mastering Oculus Rift Development

Mastering Oculus Rift Development: The next frontier of gaming and simulation

Arrow left icon
Profile Icon Donovan
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (3 Ratings)
Paperback Feb 2017 306 pages 1st Edition
eBook
NZ$44.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial
Arrow left icon
Profile Icon Donovan
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (3 Ratings)
Paperback Feb 2017 306 pages 1st Edition
eBook
NZ$44.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial
eBook
NZ$44.99 NZ$64.99
Paperback
NZ$80.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Mastering Oculus Rift Development

Chapter 1. Exploring a New Reality with the Oculus Rift

What made you feel like you were truly immersed in a game world for the first time? Was it graphics that looked impressively realistic, ambient noise that perfectly captured the environment and mood, or the way the game's mechanics just started to feel like a natural reflex? Game developers constantly strive to replicate scenarios that are as real and as emotionally impactful as possible, and they've never been as close as they are now with the advent of virtual reality (VR).

VR has been a niche market since the early 1950s, often failing to evoke a meaningful sense of presence that the concept hinges on---that is, until the first Oculus Rift prototype was designed in 2010 by Oculus founder Palmer Luckey. The Oculus Rift proved that modern rendering and display technology was reaching a point that immersive VR could be achieved, and that's when the new era of VR development began.

Today, VR development is as accessible as ever, comprehensively supported in the most popular off-the-shelf game development engines such as Unreal Engine and Unity3D. In this book, you'll learn all of the essentials that go into a complete VR experience, and master the techniques that will enable you to bring any idea you have into VR.

This chapter will cover everything you need to know to get started with VR, including the following points:

  • The concept of VR
  • The importance of intent in VR design
  • Common limitations of VR games
  • Vergence-accommodation conflict
  • The anatomy of a VR headset
  • Constellation tracking
  • The importance of input
  • Meeting required frame rates
  • Asynchronous Timewarp
  • Installing the Oculus runtime
  • Configuring your Oculus Rift
  • Stepping into Oculus home

The concept of VR

VR has taken many forms and formats since its inception, but this book will be focused on modern VR experienced with a Head-Mounted Display (HMD). HMDs such as the Oculus Rift are typically treated like an extra screen attached to your computer (more on that later), but with some extra components that enable it to capture its own orientation (and position, in some cases). This essentially amounts to a screen that sits on your head and knows how it moves, so it can mirror your head movements in the VR experience and enable you to look around the virtual world, making you feel like you're actually there:

The concept of VR

Depth perception

Depth perception is another big principle of VR. Because the display of the HMD is always positioned right in front of the user's eyes, the rendered image is typically split into two images, one per eye, with each individual image rendered from the position of that eye.

You can observe the difference between normal rendering and VR rendering in the following two images. This first image is how normal 3D video games are rendered to a computer screen, created based on the position and direction of a virtual camera in the game world:

Depth perception

This next image shows how VR scenes are rendered, using a different virtual camera for each eye to create a stereoscopic depth effect:

Depth perception

Common limitations of VR games

While VR provides the ability to immerse a player's senses like never before, it also creates some new, unique problems that must be addressed by responsible VR developers.

Locomotion sickness

VR headsets are meant to make you feel like you're somewhere else, and it only makes sense that you'd want to be able to explore that somewhere. Unfortunately, common game mechanics such as traditional joystick locomotion are problematic for VR. Our inner ears are accustomed to sensing inertia while we move from place to place, so if you were to push a joystick forward to walk in VR, your body would get confused when it sensed that you're still stationary.

Typically when there's a mismatch between what we're seeing and what we're feeling, our bodies assume that a nefarious poison or illness is at work, and they prepare to rid the body of the culprit; that's the motion sickness you feel when reading in a car, standing on a boat, and yes, moving in VR. This doesn't mean that we have to prevent users from moving in VR, we just might want to be more clever about it---more on that later.

Note

The primary cause of nausea with a traditional joystick movement in VR is acceleration and smooth movement; your brain gets confused easily when picking up speed or slowing down, and even constant smooth motion can cause nausea (car sickness, for instance)---rotation is even more complicated, because rotating smoothly creates discomfort almost immediately. Some developers get around this using hard increments instead of gradual motion, such as rotating in 30 degree "snaps" once per second instead of rotating smoothly.

Lack of real-world vision

One of the potentially clumsiest aspects of VR is getting your hands where they need to be without being able to see them. Whether you're using a gamepad, keyboard, or motion controller, you'll probably need to use your hands to interact with VR, which you can't see with an HMD sitting over your eyes. It's good practice to centralize input around resting positions (that is, the buttons naturally closest to your thumbs on a gamepad or the home row of a computer keyboard), but shy away from anything that requires complex precise input, such as writing sentences on a keyboard or hitting button combos on a controller.

Some VR headsets, such as the HTC Vive, have a forward-facing camera (sometimes called a passthrough camera) that users can choose to view in VR, enabling basic interaction with the real world without taking the headset off. The Oculus Rift doesn't feature a built-in camera, but you could still display the feed from an external camera on any surface in (we'll play with that idea later in the book).

Note

Even before modern VR, developers were creating applications that overlay smart information over what a camera is seeing; that's called augmented reality (AR). Experiences that ride the line between camera output and virtual environments are called mixed reality (MR).

Unnatural head movements

You may not have thought about it before, but looking around in a traditional first-person shooter (FPS) is quite different than looking around using your head. The right analog stick is typically used to direct the camera and make adjustments as necessary, but in VR, players actually move their head instead of using their thumb to move their virtual head. Don't expect players in VR to be able to make the same snappy pivots and 180-degree turns on a dime that are simple in a regular console game.

Vergence-accommodation conflict

Another limitation to consider when designing your VR game is what's called a vergence-accommodation conflict. This is basically what happens when the distance to the point of your focus, or vergence (that is, an object in VR), is notably different than your focal distance, or where your eyes are actually focusing on the screen in front of you.

This image from a research article in the Journal of Vision demonstrates the conflicting difference:

Vergence-accommodation conflict

Forcing the user to focus on objects that are too close or too far away for extended periods of time can cause symptoms of eye fatigue, including sore eyes or headaches. Therefore, it's important to consider placement of the pieces of your game that will draw a lot of attention.

The full article, titled Vergence-accommodation conflicts hinder visual performance and cause visual fatigue by David M. Hoffman, Ahna R. Girshick, Kurt Akeley, and Martin S. Banks, is available at http://jov.arvojournals.org/article.aspx?articleid=2122611. It is a valuable resource in avoiding depth cues that may cause eye fatigue.

Constellation tracking

Earlier in this chapter, we briefly mentioned that HMDs sometimes monitor positional movement as well as rotational. There are a few different methods of tracking an HMD positionally, but so far, every solution includes an external component not connected to the headset. In the future as the hardware gets better, we can expect a solution to positional tracking as part of the headset itself (referred to as inside-out tracking).

The Oculus Rift's solution to positional tracking is called constellation tracking. It uses an infrared camera that faces the user to detect small infrared LED markers, invisible to the naked eye, and extrapolate positional movement values based on the number of pixels those markers move in a frame.

Here's what the tracking camera of the Oculus Rift looks like:

Constellation tracking

As long as the Rift is in view of this camera, the user can laterally move their head and the HMD's display will update to reflect it; this can be used for mechanics such as leaning into or understanding something or sticking your head out from behind a corner. The constellation tracker is capable of tracking the Rift in a seated or standing experience, which means you could even engage the player in limited full body movement. The Oculus Touch controllers, shipping in late 2016, will include an additional camera to improve the quality of tracking further.

This is an image of an early Oculus Rift prototype that shows the exposed IR trackers covering the outside of the device:

Constellation tracking

The consumer version of the Oculus Rift has these markers embedded in the strap on the back of the headset as well, so there are markers that can help the constellation system track you no matter which direction you're facing.

Generally, the more realistic a VR experience is, the more the user forgets about the world outside of it. Positional tracking adds a lot of realism to the feeling of looking around in VR, so it's a good idea to design your game in a way that will take full advantage of it.

Input with controllers, remotes, and more

What you choose as the primary input device for your VR experience will have a lot of bearing on how it feels. Out of the box, you have three possible solutions for controlling your game: the Xbox controller, the Oculus remote, or your keyboard and mouse. Once the Oculus Touch controllers mentioned in the last section are released at the end of 2016, you'll have a much more immersive way of interacting with VR experiences, and the implementation will be similar to the Xbox controller's implementation but with the added ability of tracking the user's hands just like the Rift headset is tracked.

The Xbox controller, included with the Oculus Rift and pictured here, is ergonomic but still has numerous unique inputs, meaning it's a decent choice for a game with complex controls:

Input with controllers, remotes, and more

For simpler games that emphasize observation and exploration over mechanical input, the Oculus remote is the perfect simple solution. It only has a few buttons, making it easy to use in tandem with the headset, and lending itself to head-based interfaces (which we'll cover in a later chapter).

This is an image of the Oculus remote, also included with the Oculus Rift:

Input with controllers, remotes, and more

If all else fails, you can use your keyboard and mouse, but because the keyboard is complicated and somewhat restrictive, you should always look to simpler input methods unless you have a strong particular reason for using the keyboard.

The importance of frame rate

Drops in frame rate are much more acceptable outside of VR than in VR; if a computer is good enough to run a game at 30 frames a second but not at 60 frames a second, some players are able to push through it and get accustomed to the lower frame rate. After all, we watch movies at a frame rate, sometimes even lower than 30 frames per second, so it's not unreasonable to think that a game at 30 frames per second would still be enjoyable.

Suboptimal frame rates are much more important when it comes to VR. Since the HMD takes over the entirety of what our eyes see, it needs to update the world virtually as quickly as our eyes could. If the world we're perceiving doesn't update as fast as we look around it, our brain starts to get confused again and cue the nausea. This is sometimes referred to as VR sickness, and not only does it decrease the feeling of immersion the player gets, but it can also leave them feeling ill even after removing the headset.

With the hardware in the Oculus Rift, we can update the display with a new frame up to 90 times in a second. While 120 times a second would be even more ideal, a steady frame rate of 90 will be adequate in mitigating the vast majority of nausea.

Complex, asset-dense games that require a large number of calculations every frame can start to have a monopolistic impact on a computer's hardware, meaning your VR experience may start to drop frames. This should be avoided at all costs, because sporadic frame choppiness, known as judder, is one of the fastest ways to induce VR sickness.

Asynchronous Timewarp

The good news regarding the high performance cost of the Oculus Rift is that you're not without help. Asynchronous Timewarp (ATW) is a rendering technique that helps fill delays in rendering with a calculated intermediary frame.

In essence, ATW warps an image based on the user's head movement, giving the appearance of multiple rendered frames but actually only modifying one while the rest are generated. All rendered images need to be warped at a baseline level so they don't appear skewed when viewed through the lenses, so adding an extra step to the warping process is relatively inexpensive for your hardware.

ATW can go a long way in making up for lost time in your VR experience, but it's important not to rely too heavily on it, because like every other rendering trick, it has its limits. For instance, with purely rotational ATW, the user can experience positional judder, which causes objects close to the user to appear blurry or doubled noticeable.

This screenshot of a submarine interior, provided by Oculus, demonstrates the perceived effect of positional judder:

Asynchronous Timewarp

ATW calculations are relatively simple because they only take rotation into account. Lateral movement is an entirely different problem; in 2016 Oculus announced work on a complementary feature called Asynchronous Spacewarp, which will perform predictions for head position as well. We'll see Asynchronous Timewarp at work in a later chapter, when we focus on performance and optimization of VR experiences.

Installing the Oculus runtime

Now that we've covered the basics of VR in theory, it's time for some practice. The first thing you'll have to do is download the Oculus runtime, which is the background process responsible for handling all of the activity in your Rift.

Open a web browser and navigate to http://www.oculus.com/setup. This page will provide a download link to the Rift setup package, which includes the runtime you need and Oculus home, the central hub for browsing and starting all of your Oculus software.

Note

Setting up the Rift requires an Internet connection and about 30-60 minutes of setup time. The setup utility will guide you through the process step by step on screen.

After all of the software required to run the Rift is installed, you'll run through a quick hardware calibration step that will set up your constellation tracker, remote, and the headset itself. It will also help you set values such as height and interpupillary distance (IPD).

IPD is the distance between the pupils of your eyes, and even though it may seem like everyone's IPDs are similar to each other, significant inaccuracies can affect the way we perceive scale. Scale is everything in VR, especially when you're trying to use size to convey a mood or purpose, so ensuring your IPD is accurate is important in experiencing content exactly as it was meant to be experienced.

Summary

In this chapter, we approached the topic of virtual reality from a fundamental level. The HMD is the crux of modern VR simulation, and it uses motion tracking components as well as peripherals such as the constellation system to create immersive experiences that transport the player into a virtual world.

Now that we've covered the hardware, development techniques, and use cases of virtual reality---particularly the Oculus Rift---you're probably beginning to think about what you'd like to create in virtual reality yourself. In the next chapter, we'll be diving into implementations using the Unity3D engine, and you'll take your first step into VR development.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Create immersive 3D games especially designed for the Oculus Rift platform
  • Build complex realistic virtual reality (VR) games with the Unity Engine
  • Create striking VR environments with advanced graphical techniques

Description

Virtual reality (VR) is changing the world of gaming and entertainment as we know it. VR headsets such as the Oculus Rift immerse players in a virtual world by tracking their head movements and simulating depth, giving them the feeling that they are actually present in the environment. We will first use the Oculus SDK in the book and will then move on to the widely popular Unity Engine, showing you how you can add that extra edge to your VR games using the power of Unity. In this book, you’ll learn how to take advantage of this new medium by designing around each of its unique features. This book will demonstrate the Unity 5 game engine, one of most widely-used engines for VR development, and will take you through a comprehensive project that covers everything necessary to create and publish a complete VR experience for the Oculus Rift. You will also be able to identify the common perils and pitfalls of VR development to ensure that your audience has the most comfortable experience possible. By the end of the book, you will be able to create an advanced VR game for the Oculus Rift, and you’ll have everything you need to bring your ideas into a new reality.

Who is this book for?

This book is for aspiring indie developers and VR enthusiasts who want to bring their ideas into virtual reality with a new platform that provides an unprecedented level of realism and immersion.

What you will learn

  • Increase immersion with 3D audio and intuitive interfaces
  • Create group VR experiences using multi-player networking
  • Design fun and engaging mechanics that utilize VR principles
  • Explore the best ways to navigate and interact using the Oculus Rift
  • Design intuitive ways to navigate and interact with scenes in VR
  • Add stunning realism to a scene with three-dimensional audio
  • Invent mechanics and features that take full advantage of VR hardware

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 06, 2017
Length: 306 pages
Edition : 1st
Language : English
ISBN-13 : 9781786461155
Vendor :
Facebook
Category :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Feb 06, 2017
Length: 306 pages
Edition : 1st
Language : English
ISBN-13 : 9781786461155
Vendor :
Facebook
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just NZ$7 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total NZ$ 233.97
Augmented Reality Game Development
NZ$71.99
Mastering Oculus Rift Development
NZ$80.99
Mastering Unity 5.x
NZ$80.99
Total NZ$ 233.97 Stars icon

Table of Contents

10 Chapters
1. Exploring a New Reality with the Oculus Rift Chevron down icon Chevron up icon
2. Stepping into Virtual Reality Chevron down icon Chevron up icon
3. Improving Performance and Avoiding Discomfort Chevron down icon Chevron up icon
4. Interacting with Virtual Worlds Chevron down icon Chevron up icon
5. Establishing Presence Chevron down icon Chevron up icon
6. Adding Depth and Intuition to a User Interface Chevron down icon Chevron up icon
7. Hearing and Believing with 3D Audio Chevron down icon Chevron up icon
8. Adding Tone and Realism with Graphics Chevron down icon Chevron up icon
9. Bringing Players Together in VR Chevron down icon Chevron up icon
10. Publishing on the Oculus Store Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(3 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
D. de Céspedes Feb 24, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As someone new to development for VR I found this book really easy to follow and helpful.
Amazon Verified review Amazon
Arikia A Millikan Mar 13, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This was the most helpful book of the many I read about the topic. Jack is a great writer!
Amazon Verified review Amazon
Isabelle G Dec 05, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Tres bon livre. Simple et efficace pour debuter programmation Oculus.Ne couvre pas oculus touch.Livraison et produit ok.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.