oculus rift dk2 positional tracking camera view 2

Spurred by the current lack of a Linux SDK for the Oculus Rift DK2, a group of developers sought to dissect the Rift’s optical tracking system by reverse engineering the DK2. The information that was tediously corralled together is quite technical so we’ve have rounded up the critical focal points in an easier to read format to show why this community project is important.

A big hat tip to Brad Davis and Oliver Kreylos who spearheaded the reverse engineering effort. Davis got the ball rolling by discovering the LED activation codes and sharing his initial findings with others. Kreylos contributed by helping to correct the camera’s native view, among other things, and also helpfully sorted out the key information on his blog from the collaborative effort that Davis began in a thread in the Oculus sub-section of Reddit.

Davis is a software development engineer at Amazon and the maintainer of the community version of the Oculus VR SDK on GitHub. He’s also publishing a book on the Oculus Rift that offers a technical deep dive into the VR headset.

Kreylos is a PhD virtual reality researcher who works at the Institute for Data Analysis and Visualization, and the W.M. Keck Center for Active Visualization at the University of California, Davis.

See Also: VR Researcher Flips the Script, Augments Virtual Reality with Actual Reality

Here is what’s been gleaned so far:

The Tracking LEDs Can Be Triggered and Gathered with Specific Code

When figuring out how the camera interfaces with the head mounted display, several mysterious functions of the DK2 were retrieved.

SEE ALSO
'Demeter' is an Intriguing MR Platformer for Quest That Actually Reacts to Your Room

Sending a Human Interface Device (HID) feature report turns on the LEDs for ten seconds and then causes them to flicker in odd ways. At first, the community was unsure why this was the case and wildly speculated about it online. Later, it was discovered by Github user pH5 that each LED broadcasts at specific flashing frequencies with various levels of brightness. This allows the tracking camera to identify the source based on the exact blinking patterns of the lights. Knowing this, the DK2 camera can be programmed with an LED identification algorithm.

oculsu rift dk2 blob detection 2

Synchronization of the Headset and Camera is Achieved after Fixing a Few Problems

The tracking camera is a standard USB webcam with an infrared filter that is utilized to pick up the blinking frequencies of the LED lights in the DK2. Digging into the firmware of the camera showed an issue that surfaced (somewhat unexpectedly) which had to do with a software bug that was deeply embedded into the system. The device itself was advertising that it had a resolution of 376×480 pixels when in fact the camera was set at 752×480 pixels. Without correcting this problem, the camera image was stretched and distorted.

Hooking up the camera and VR headset indicated that the LEDs strobed at a similar frequency, but not identical, to the tracking camera’s frame rate. This manifested an irregular beat pattern that was most likely unintentional. This meant that the synchronization wasn’t enabled by default and had to be manually corrected.

This is where the knowledge of pH5 was used. By writing to the registers within the camera’s imaging sensor, the shutters could be opened at the exact time a synchronization pulse was received over the connecting cable. Sending commands directly to the camera gave full control over the exposure, gain, black level, and image flipping functions as well.

SEE ALSO
Varjo XR-4 Will Get a SteamVR Tracking Variant and Sell Direct to Prosumers

oculus rift dk2 beat pattern led frequency

Lens distortion for the camera was also an issue that needed to be corrected. Because of the camera’s relatively large field of view, the device suffered from a few calibrations problems. This was addressed by removing the IR filter and testing out the possible intrinsic parameters of the lens. After calculating the distortion formula, the image capture of the camera was modified producing a better view.

Extracting the LED Positions Opens Up a Whole New World of Input Possibilities

oculus rift dk2 led direcitons
A model of the Oculus Rift DK2 shows red dots as LEDs and blue lines as the direction of maximum emissions.

Unlocking the camera tracking capabilities could open the door for tracking other input devices. Custom wearable accessories with infrared lights embedded would be able to be picked up the system. Modifying ‘raver gloves‘ for VR use, for example, could provide additional inputs for the virtual reality experience and induce greater levels of presence.

See Also: The Incredible Performance of the Oculus Rift DK2′s Positional Tracking (video)

There is Still More to Understand

Thanks to the collective work of the VR community online, many of the mechanisms behind the Oculus Rift DK2’s positional tracking have been uncovered. The LEDs can be turned on and tracked with the DK2’s camera; signals and commands are able to be sent directly to both the devices allowing for full control over the system; a pose algorithm has also been developed which traces IR blobs in image space over time.

oculus rift dk2 positional tracking over time

However, there is still much more to learn. For example, when extracting the 3D positions of the LEDs in the headset, it turns out that the lights are not symmetrical. It has been proposed that this is a calibration issue that surfaces during the manufacturing process. Additional testing of other VR headsets will show whether each DK2 is truly factory-calibrated, or if all the devices contain the exact position data. The 3D pose algorithm, although initially prototyped, will need to be fine-tuned as well.

SEE ALSO
The Very Best Quest 2 and Quest 3 Games – 21 Expert Picks


A video by Brad Davis shows initial LED identification after passing the camera input through an image processor to eliminate everything from the frame except for the LEDs.

Overall though, the developers were able to come together to help each other understand how the tracking system works. These findings are giant leaps towards better documentation of the Rift which allows those interested in creating VR experiences to see how everything fits into place. This community project is sure to inspire others to dig deeper and share their findings with the world.

Newsletter graphic

This article may contain affiliate links. If you click an affiliate link and buy a product we may receive a small commission which helps support the publication. More information.


  • jherico

    Hi, ‘reddit user Jherico’ here.

    Actually, my name is Brad Davis, and I’m one of the authors of the forthcoming book Oculus Rift in Action by Manning publications.

    I appreciate that the photo of Oliver is nice and photogenic, and that he’s been instrumental both in uncovering a lot of details and providing a organized summary on his blog. But I feel like this article somewhat skips over my initial work on identifying the code required to enable the LEDs without the use of the SDK.

    If you’re going to include content from my youtube channel, I’d appreciate it if you’d actually provide attribution in the form a link to the video. I’d also much rather be credited by my real name and have a link to my book included, similar to the links to Oliver’s works / sites.

    Note from the Editor: Brad got in touch with us to set the record straight. The issue was not malicious, but rather the consequence of unassociated usernames having conversations across multiple channels of communication. The article has been updated to reflect Brad’s contributions. Brad also gave us permission to delete this comment but I’ve decided to leave it here for transparency.

    • imadethis

      Incredibly poor taste leaving the works of Brad Davis out of this article… provide attrition as requested, and why not make amends, and link to the forthcoming book?

      • Ben Lang

        We’ve been in touch with Brad and the article is updated to reflect his contributions. The above comment has also been updated with an explanation.

  • brandon9271

    I’m sure the omission wasn’t intentional or at least we have no reason to assume it was. At any rate, Oculus needs to hire these two :)

    • jherico

      If they hired us, we’d hardly be able publicize the inner workings of the hardware.

      • Knightfury

        Are the LED’s still in addition to gyro/accelo/magno or they ditched they all and gone back to purely LED tracking?