Initial VR Implementation
As you probably noticed, I've been playing around with the Oculus Rift DK2 and it's really neat! With Klepto's help I was able to get it running and integrated into the engine very quickly. Beta support will be added soon so you can play with it yourself. Why is it beta? Because it is possible some behavior may change, particularly the way head rotation is handled. Also, it only works on Windows at this point. I'm waiting for OculusVR to add direct HMD rendering for Linux, because without that it's not a very pleasant experience.
The renderer has been modified so that directional lights are only re-rendered once per frame, instead of re-rendering directional shadows once for each eye. The speed of the Leadwerks renderer also helps here. I noticed my VR apps feel noticeably smoother than most demos I have tried. Leadwerks by default uses direct HMD rendering with display mirroring turned off, so it's the fastest possible mode the rift allows. This is important because latency = nausea, and I and others can be affected pretty strongly with simulator sickness.
Enabling VR in your game could not be easier. Just use the Window::VRDisplay creation flag when you create your game's window, and you're done. Really, that's all it takes:
Window* window = Window::Create("My VR Game",0,0,1024,768,Window::Titlebar|Window::VRDisplay);
Or in Lua:
local window = Window:Create("My VR Game",0,0,1024,768,Window.Titlebar + Window.VRDisplay)
You can also call VR::GetHeadRotation() and VR::GetHeadPosition() to track the player's current orientation. Camera rotation and translation are handled for you automatically, though, so this is really only needed for adjusting your direction of movement and things like that.
This will be available soon on the beta branch on Steam.
- 8
5 Comments
Recommended Comments