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-udevAUR 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 available on the AUR as oculus-rift-sdkAUR, or a modified version with CMake build support and other features is available as oculus-rift-sdk-jherico-gitAUR.
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.
xrandrift
A package exists on the AUR called riftutilities-gitAUR[broken link: archived in aur-mirror] which contains (currently only) a script called xrandrift
. It uses xrandr
to determine suitable video modes (based on arguments passed) to run your rift, as well as trying to record your current video mode, and then switches back after the program exits.
For best latency (for applications which support it), run the programs like so:
xrandrift OculusWorldDemo
For Source games, such as Team Fortress 2 (in properties, set launch options):
xrandrift -e -p %command% -freq 75
For games which only run properly at 60Hz:
xrandrift -s -p OculusWorldDemo
Manually, using xrandr
Say our primary monitor is DVI-I-2, and DVI-I-3 is the Rift, and 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
.
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
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
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-gitAUR 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-gitAUR 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.
Unity games (in wine)
To get the best performance in Unity based games, ideally you should force them into OpenGL mode with the -force-opengl
. However this is not currently possible with an unpatched wine, as the WGL context it tries to force has some differences from a typical GLX context, as described here. Using the wine-unity3d-gitAUR package will allow you to run these games with native OpenGL, wrapped in the oculus-wine-wrapper layer, allowing you to play them with decent performance on your machine. Unfortunately they often try to change the video mode or mess with other settings, so supplying default screen settings may be neccesary. Additionally, since it's using native OpenGL, nvidia's __GL_THREADED_OPTIMIZATIONS may be Overall, your command should look something like
env __GL_THREADED_OPTIMIZATIONS=1 oculus-wine-wrapper UnityGame.exe -screen-height 1080 -screen-width 1920 -popupwindow -force-opengl
Minecrift (Minecraft VR)
Though Linux support should be in the main pipeline very soon, the project itself hasn't released an update which includes totally functioning Linux support, although it exists. A guide is available here to run an existing Minecrift version with the very latest JRift (native java rift runtime) build.
Additionally, many users have reported much better performance with JRE8, rather than JRE7.
JanusVR
"janusVR: an immersive, collaborative, multi-dimensional internet." JanusVR is an application that lets you explore 3D websites in a multiplayer experience. An AUR package is available: janus-vr-browser-binAUR[broken link: archived in aur-mirror]
The AUR package does not automatically update when JanusVR does, but the application will tell you when a new version is available. Simply re-build the package when this happens.
Troubleshooting
Kernel log spamming by DK2 camera
If you're receiving an enormous amount of messages in the kernel log that look like this:
xhci_hcd 0000:04:00.0: WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?
this is because the Oculus DK2 Camera has some issues on USB 3.0/Hybrid 2.0/3.0 ports. Try plugging it into a USB 2.0 port.
Camera misbehaving after suspend/resume
If you try to suspend/resume and then use the Rift, the camera will have issues giving positional tracking data, and any VR program you run will have issues with positional tracking. If you try to kill the `ovrd` process, it will simply lock up and become defunct until the parent process (your window manager) is killed. A temporary workaround is to simply unplug and replug the DK2 camera after resuming, which seems to resolve the issue.
Inaccurate latency readings for legacy applications
For some reason, it seems that using ovrd > 0.5.0
with applications compiled against 0.4.4 and below gives a latency reading of many millions of milliseconds (most likely a signed/unsigned change). This means timewarp is always clamped at maximum, and gives a 'swimming' view when using legacy applications. There isn't an ideal fix for this yet, although it is possible to install an old version of the SDK and use that instead.
OpenVR/SteamVR not working
SteamVR/OpenVR create a config directory ~/.openvr that can get misconfigured over the various versions. Delete that directory and completely uninstall/reinstall SteamVR.