Oculus Rift

The Oculus Rift is a virtual reality head-mounted display developed by Oculus VR.

Basic Setup

Hardware

The Oculus Rift device connects via HDMI as a secondary display to your graphics card, as well as by USB in order to perform as a sensor. The oculus-udev package will setup proper udev rules.

You also need to be in the input and video groups to have full permission, plugdev is no longer neccesary (as the mode is set to 0666).

SDK

Package

The official Oculus Rift SDK is not part of any official arch package, however it is available from the AUR package oculus-rift-sdk-jherico-git.

This package will set up the oculusd daemon to run when you start an X session, so it should be running in the background after you've installed it and restarted X (or started it manually).

From official source

The SDK is available through the Oculus VR Developer Center after free registration.

Run a sanity check by compiling the SDK and running the WorldDemo:

$ tar zxvf ovr_sdk_linux_4.0.3.tar.gz
$ cd OculusSDK
$ make
$ ./Samples/OculusWorldDemo/Release/OculusWorldDemo_x86_64_Release

Video Mode

For the Rift to function optimally, only certain video modes work very well. In addition, if you have a cloned video mode in which your ordinary monitor runs at a lower refresh rate, then often games will lock themselves to the lower refresh rate.

The Rift itself needs to be the primary monitor, or synchronization will not work properly.

For running the rift at 75Hz

First, find which connector is your Rift, as well as the highest mode that will support 75Hz on your primary monitor using xrandr:

 xrandr --current
 Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384
 DVI-I-0 disconnected (normal left inverted right x axis y axis)
 DVI-I-1 disconnected (normal left inverted right x axis y axis)
 DVI-I-2 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 521mm x 293mm
    1920x1080     60.00*+
    1680x1050     59.95  
    1440x900      59.89  
    1280x1024     75.02    60.02  
    1280x960      60.00  
    1152x864      75.00  
    1024x768      75.03    70.07    60.00  
    800x600       75.00    72.19    60.32    56.25  
    640x480       75.00    72.81    59.94  
 HDMI-0 disconnected (normal left inverted right x axis y axis)
 DVI-I-3 connected (normal left inverted right x axis y axis)
    1080x1920     75.00 +  72.00    60.00  
    1080x948     119.99

From this we can tell DVI-I-2 is our monitor, and DVI-I-3 is the Rift, as well as the fact that 1152x864 is the highest mode that supports 75Hz. To use this:

 xrandr --output DVI-I-3 --primary --rotate left --mode 1080x1920 --rate 75 --auto --output DVI-I-2 --mode 1152x864 --rate 75 --auto --same-as DVI-I-3 --scale-from 1920x1080

Although the Rift SDK reccomends not rotating the secondary display, not doing so seems to cause issues with a number of programs. This command will set the primary monitor to have a scaled version of the entire display. If you prefer panning, change --scale-from to --panning.

For running the rift at 60Hz

Same as above, but with a specified video mode.

 xrandr --output DVI-I-3 --primary --rotate left --mode 1080x1920 --rate 60 --auto --output DVI-I-2 --mode 1920x1080 --rate 60 --auto --same-as DVI-I-3 --scale-from 1920x1080

For disabling the Rift

The above video modes can have some havoc on your display if you simply use xrandr --auto, as it'll still try to scale something. Use this to return to one monitor:

 xrandr --output DVI-I-2 --primary --auto --rotate normal --panning 1920x1080 --scale 1x1 --output DVI-I-3 --off

It's wise to set these to desktop shortcuts, bash aliases, or keybindings, for quick access.

Working applications

Currently there are a handful of apps which work well on the Rift and Linux, with several of them being in the AUR.

Dolphin VR (Gamecube Emulator)

dolphin-emu-vr-git is an emulator for Gamecube, with patches to allow it to have full headtracking stereoscopic rendering, as well as a number of customizations to make games work well out of the box in VR (for example, disabling culling functions to let you view the entire world).

Oculus-wine-wrapper

oculus-wine-wrapper-git is a utility to patch up the differences between the Linux and Windows versions of the SDK when running Wine. It creates a shared memory context for the Wine application to use, letting the app access the native Oculus SDK. No installation of the SDK to the wineprefix appears to be neccesary.