PDA

View Full Version : How to port your game to Oculus Rift, according to Valve



wraggster
April 4th, 2013, 19:43
http://media.edge-online.com/wp-content/uploads/edgeonline/oldfiles/articles/news/tf2.jpg (http://media.edge-online.com/wp-content/uploads/edgeonline/oldfiles/articles/news/tf2.jpg)Though Michael Abrash has voiced his concerns about the current generation of Virtual Reality, both he and Valve in general have accepted that the Oculus Rift is a very good step in the right direction. Hence the team converting Team Fortress 2 to run on it, an update that’s available before the Rift itself is. Valve’s Joe Ludwig gave a range of tips and advice on converting to and programming for VR at GDC 2013 last week.The largest problems when converting for Virtual Reality are latency, stereo rendering, the user interface, your inputs and VR motion sickness. Ludwig didn’t cover latency, recommending you instead search for “john carmack latency” or “michael abrash latency” – but Abrash himself said that ideally a total latency of between 1 and 20 ms would be ideal, which is far quicker than anything currently available. The recommendation though, is to eliminate it as much as possible.As regards stereo rendering, the Rift’s two screens have a resolution of 800 by 640 each, working as a stereo image pair (so you’ll need a splitter). You’ll need to check out what the field of view for your display is – the Rift SDK should tell you, if you’re using that. Given the dimensions of the screens, you may end up seeing more vertically than you’re used to; Valve found that they could see the entirety of their character model’s gun arm, which sadly finishes at the elbow, so they had to decapitate every character and place the headless body beneath the camera.Fixing screen-space effects and weapon models is just the first step though. You’ll also need to correct for the Oculus’ pin-cushion distortion by applying a barrel distortion in a shader. Again, the Rift SDK has all the shared code for this, which moves the distortion work from the display to the video card.The HUD is a big deal. The way the distortion works means that it can’t be at the edge of the screen. Ludwig’s team recommends that if you can avoid having a HUD at all, do. If not, as they found, you need to project it in stereo about ten metres into the world and within 50 degrees, as otherwise the artefacts in the outer bands will distort it. Similarly, for the crosshair, it needs to be drawn directly into the world, with a raycast to the relevant aim depth and the crosshair drawn over it. It’s odd to see the crosshair jump back and forth, but it’s right.The head direction control complicates aiming and looking significantly. Indeed, get the yaw and roll of the view wrong – if you don’t make it exactly 1:1 – and people’s inner ears will get confused and they’ll get sick, fast. It’s also difficult and tiring to aim with the head, so it’s worth separating aiming and looking to some degree, and adding turning on the mouse.Indeed, VR motion sickness is the most important problem in developing or converting for 3D. You can get nausea, cold sweats and headache from an incorrectly configured game, though players do adapt to it over multiple sessions. As the TF2 team found out, first person decapitation is extremely bad. Don’t do it. Similarly, the freezecam, Soldier’s rocket-jumping and any kind of involuntary movement, save for sliding the camera forward (which means sticky-jumping is fine.) And don’t mess with the horizon, ever. The speed the Scout moves at is also problematic – 22mph that close to the ground is problematic for many people, especially when going up stairs and ramps.

http://www.edge-online.com/features/how-to-port-your-game-to-oculus-rift-according-to-valve/