Oculus Rift Development Kit 2 (DK2) support for BGE

I have made a crude Oculus DK2 head tracking and rendering support for BGE
It relies on “python-ovrsdk” by Brad Davis (jherico) found here https://github.com/jherico/python-ovrsdk
I`ve modified it slightly to support newer Python versions and it is included in the archive
It should work on Windows, MacOS and Linux and is tested in recent Blender versions. No extra installations needed, just plug Oculus DK2 and run the blend file. Be sure to read the Readme included in blend file.

I`d like to know how it performs to anyone of you if you have an Oculus DK2 laying around.

get it here:
or here:
VR_DK2_v1.zip (1.36 MB)

10.04.2015 - improved distortion shader

More images and videos coming soon

Thanks, nice timing with the stereo render multiview patch.

Awesome! This made my day.
I don’t yet have the dev kit, but I dropped it in my prototype anyway - no issues so far.
Tested with NVIDIA GTX 460 and Intel HD 4000 on Linux64.
Hopefully I’ll have more feedback when it arrives. Meanwhile:

Awesome, I was meaning to do this but never got around to it. I’ll test it out this weekend.

Works with my native open-source drivers, doens’t bite the framerate! Nice job as always, martinsh!

Darbojas ar maniem atvērtā pirmkoda draiveriem, nebremzē spēli! Lielisks darbs, kā vienmēr, Mārtiņ!:slight_smile:

tested on oculus dk2, works rly good. I use 3 displays(+ oculus), when I start the blend file the second window open up on my second display (not on the oculus). I turned of the other displays so that my main display and the oculus where the only once running, then it worked! (60 fps and no lagg) headtracking is also working. it is missing positional tracking.

Bdw Rly nice work!, have been w8ing 4 something like this!

about the licensing, Can we make games whit this in the bge or are that against the licensing? read somewhere that the oculus and blender’s licenses where not compatible :S

that seems almost like a mouse not being permitted to be used as a mouse?

thanks all for your time checking it out. Positional tracking should be working fine though. Blue light on the tracking camera should be on while running Blender.

hehe, exactly. Or rather like your computer display not being permitted to be used with Blender :slight_smile:
I think licensing should be fine, but there are some terms that need to be respected. For example- your application should not cause health and safety issues…
anyway it is something to investigate further

By the way, I can’t wait for your ocean shader aswell as latest water/underwater & sky shader! They look nice, altough I would need ocean shader with refraction so I can see through water!

Starp citu, es nevaru sagaidīt tavu Okeāna šeideru tāpat kā jaunāko ūdens/zemūdens un debesu šeideru! Tie izskatās ļoti jauki, lai gan man noderētu okeāna šeiders ar gaismas laušanu, lai varu redzēt cauri ūdenim!

Ok, I tried out your demo and it works really well! No judder, and full positional tracking. I will say that the distortion feels a little off, which is probably due to the differences between my rift config and yours. Is there any way you can read in the oculus config with the python sdk? other than that point, this is definitely something I plan on using in the future.

Thanks for the feedback. You have a good point, I did not try it with different user settings.
Yes the python-ovrsdk provides all the data. Right now the values are hard-coded for my set up, but this will change in next update.

Excelent, It works perfect … !
at least some neat integration of the DK2, that’s portable too … Thanks a lot !

I almost got up and went home because of this xD I can hardly wait to test this!
Edit: Hmmm, everything works, only I can’t get it to show up on the DK2.
Edit2: Nevermind that I got it working, however the render doesn’t seem quite right, there’s a black bar on the right side, I also had this issue with Unity, damn :1
Edit3: Got that sorted aswell ^^ Now I just need to fix the stutter, and this integration is just about perfect! What steps do you guys take to get the framerate to 75? Despite my efforts it always seems stuck at 60fps :confused:


I found out that you can rent this for €10/day in Latvia privately:D Sad that I can’t afford that much - I’d like to test this thing in some Blender games:D

Hey martinsh (or anyone), now that 2.75 is out with stereo viewports, there’s nothing stopping us from rift support in the 3d viewport.
I tried out stereo with my rift, and while ideally there would be pre-distortion, the view is still quite usable.
Since Martinsh already has python bindings for the rift working in the bge, how hard would it be to port those to the viewport? I’ve never done viewport manipulation with python, but I think it is possible. I’d love to do my 3d modeling in vr!

Wow this is what I needed a long time! Thank you a lot Martin! you are one of the greatest contributers to my work! ( as with the cloud generator and a lot other things)

Awsome add-on!
But I have a problem: when I start the BGE, everything is perfect, but after some times (1min, more or less), i’m starting to get judder and v-sync issue, despite my framerate stay at 75fps… Any ideas how to solve the judder and tearing?

I have a problem when I opened the file the image in the oculus is turned of 90°, so I see it in vertical. Can you help?

You may have to set your DK2 to “landscape inverted” in the Windows screen resolution settings to get the extended mode to work properly.

It works now, thank you :slight_smile: