Oculus Rift DK2

From ETC Public Wiki
Jump to: navigation, search

Note: The following demo is provided by the makers of the Oculus VR DK2 headset and Unity Pro 4.5 or later. It is available to all developers through the oculus rift website. Kindly register (free) for the complete SDK. (The integration package is a modified version from the original oculus wrapper (v0.4.2 Beta).)

What is the Oculus Rift?

See what is Oculus Rift on Wikipedia.

Getting Started

  1. You do not need the SDK to run Unity and Oculus together. Just download the wrapper listed at the end of this page.
  2. Open a new unity project. Go to Assets -> Import Package -> Custom Package and choose the OculusUnityIntegration.unitypackage located in OculusUnityIntegration folder.
  3. After import, you will find two folders, OVR and Plugins, are created under Assets.
  4. In OVR, there is a Prefabs folder. Drag the OVRCameraController to your scene or OVRPlayerController based on what you want to use.

(Note: The OVRPlayerController is written over the character controller, you might want to write your own controller)

Positional Head Tracking

One of the key technical breakthroughs Oculus Rift DK2 features is that it provides precise, low-latency positional head tracking. Here are some tips for using positional head tracking feature:

  1. Check the Enable Position in OVRCameraController is on.
  2. DK2 use its position tracking camera to track user's head position. You can add OVRMainMenu(under OVR\Scripts) script component to OVRCameraController in order to add a reminder once user goes outside the camera's tracking frustum. Remember to assign a texture to the Fade In Texture variable. (You can just use the Black texture file locates at OVR\Textures.)
  3. Adjust the scale parameter in OVRCameraController's Transform component to magnify/reduce the feedback of user's physical movement in certain direction axis.
  4. Reset the cameras position to where OVRCameraController is by calling
       OVRCamera.ResetCameraPositionOrientation(Vector3.one, Vector3.zero, Vector3.one, Vector3.zero);
in your script. By doing so, you can make sure each guest will start from the same position in your virtual world, no matter what the relative position between your guest and the tracking camera is.

Important Parameters

OVRCameraController component is the main interface between Unity and the cameras. All camera control should be done through this component. Under OVRCameraController, you can find

  1. IPD: Interpupillary Distance for the cameras (in meters). IPD calibration is important for nausea-free gameplay with the Oculus Rift. The default is set to either the average IPD value, or to the value that has been set by the Oculus Configuration Utility.
  2. Follow Orientation: The camera will follow the input Transform's orientation, and the head-tracking will be an offset of this. This is useful for mounting the camera on a rigid object, such as a car.
  3. Tracker Rotates Y: When set, the actual Y rotation of the cameras will set the Y rotation value of the parent transform that it is attached to. NOTE: Setting Follow Orientation with the parent transform of this component and setting Tracker Rotates Y to True will cause a feedback loop in orientation.
  4. Mirror to Display: Turn it on to show an additional audience window on desktop if the executable runs under Oculus Direct Display mode.

Build Settings

  1. Resolution should be set as 1920*1080.
  2. In Supported Aspect Ratios, only check 16:10 and 16:9.
  3. In Quality Settings (Edit -> Project Settings -> Quality), set Anti Aliasing as 4X or higher is ideal.
  4. Instead of using "Build & Run" directly, use "Build" to build your project (<YourApp>.exe) and then run the <YourApp>_DirectToRift.exe file produced by the build.

Set up DK2 on New Computer (Windows)

In order to use Oculus Rift DK2 on your computer for demo, you should follow the following steps:

  1. Download and install official Oculus Runtime for Windows. Please use the one which matches with the version of DK2 Unity wrapper.
  2. Restart the computer and follow the instructions of official Developer Guide to connect Oculus Rift and position tracking camera to the computer.
  3. Open Oculus Configuration Utility -> Tools -> Rift Display Mode, and set Display Mode as Direct HMD Access from Apps mode.

Known Issues

  • The Rift shows nothing while running <YourApp>_DirectToRift.exe under Direct-Mode.
  1. Close your application, and then go to Oculus Configuration Utility, open Rift Display Mode window (by following Tools -> Rift Display Mode).
  2. Switch to Extend Desktop to the HMD and press Apply.
  3. After the power light of the Rift becomes blue and you can see the desktop through the Rift, go back to Rift Display Mode window and switch back to Direct HMD Access from Apps mode.
  4. Run <YourApp>_DirectToRift.exe file.
  • The Rift seems disconnected while clicking Play in Unity Editor. That is, Instead of tracking Rift's movements and orientations, cameras just freeze there in the scene. [Note: This might happen if you forgot to turn on the Rift before clicking Play.]
  1. Close Unity Editor.
  2. Go to Oculus Configuration Utility and open Rift Display Mode window (by following Tools -> Rift Display Mode).
  3. Switch to Extend Desktop to the HMD.
  4. Open your Unity project and click Play. Now, Unity Editor should track the Rift's movements correctly.
  5. Stop Play in Unity Editor. Go back Rift Display Mode window and switch back to Direct HMD Access from Apps mode.
[Note: Oculus Rift's screen won't display anything by clicking Play in Unity Editor.]
  • PS Move seems disconnected while running the <YourApp>_DirectToRift.exe file. [Note: This might happen when it's the first time you try to run <YourApp>_DirectToRift.exe directly on the computer.]
  1. Close your <YourApp>_DirectToRift.exe file.
  2. Run <YourApp>.exe and allow the access in Windows' security alert.
  3. Close <YourApp>.exe and run the <YourApp>_DirectToRift.exe file.

Integration Package

Oculus Rift DK2 Unity wrapper