CPMStar Ad

Naughty Who @ indiedb

Wednesday, November 11, 2015

[R&D] Oculus VR with Unity Jump Start

It's always exiting to dive into new tech and if You are waiting for it for ages nothing compares to the feeling.

So I've got some time to research and develop by own hands and got hands on Oculus Rift Development Kit (DK1) and realized that it's a bit too late. From one side everything about the tech is under beta and in prototyping state. From the other everything evolves fast about it and DK1 is completely outdated. Nearly none of demos and games launched and ran with my hardware %)
It was surprising nowadays when nearly everything works smoothly from the box. So I've started to digg what's up :)

First appeared that DK1 doesn't work in direct mode then appeared that Mobile GPUs are not supported.The newer Oculus SDKs 0.7 doesn't work properly with outdated hardware of Oculus DK1. So it looked like a dead end for me :)

I was on the managing position for too long not to make somebody to solve the task for me. My friend programmer we made games with tested the helmet on not mobile PC. He was intended to tune/build our latest game Naughty Who? for Oculus Rift during the time I was on vacations. Unfortunately or fortunately he spent one or two days with drivers and SDKs integration support and has given up.

So it's became my personal task. Naturally I thought that I should take Oculus DK2 and forget about the problem. Oculus Development Kit 2 appeared to ship to 8 countries only and mine is not surprisingly not on the list and it's sold out. In addition DK2 would be great with the new controller that's not avail yet or I don't know how to get it. 

It may look as a problem and dead lock once again and it's not at all. Virtual Reality projects and at least Oculus are still in beta and I'd say prototyping phase (not sure about Morpheus/PlayStation VR). So it's not a matter of the latest/best hardware, it's the matter of any working hardware to test Your game or/and (pre)shape it. Now I understand that Cardboard is a good idea.  

Run the demo and then write Your "Hello World" is a natural for every new tech I start to deal with. Maybe It's too old-fashioned and I don't know better way yet. I went to store that is not yet store and named Oculus Share to get Rollercoaster demo. I've already tried it in arcades. Oops, once again, it's DK2 only compatible :P I've tried tons of demos and games as I already mentioned, nearly none of them worked out properly. One of several games/demos that has been launched, not crushed and looked like Virtual Reality picture but not a random displaced one required XBOX controller to play %) I was close to give up too and Tuscany demo worked out :)

The demo runs. Let's go to "Hello World" phase. Funny and it's taken me several days of the real time and several weeks. Basicly there are two articles that helps mixed with a helper script and strong will to: Unity Tutorial Rollaball Intro it should work from the box if You have DK2 I guess and Getting  Started with Unity and Oculus Rift SDK 0.4.0 (0.4.4 actually).

The first useful tip there are old of previous software in downloads section on Oculus site. The second SDKs over 0.4 version are for the 2nd development kit and dedicated to optimization, frame rates, responses time and latency and so on but not for back compatibility. Pretty the same is about Unity, licensing model changed from 4th to 5th version and what was Pro in Unity 4.6 is free in Unity 5.2 and it's completely different %)

Integration with older Unity was implemented with the single package included with Oculus PC SDK 0.4.4 Beta. You just import it as usually. There are 2 prefabs for OVR (OculusVR) Camera Rig and OVR Player Controller and 4 scripts that manage and modify Editor Game View and build the scene. They work inside Unity Editor and don't depend on GPU hardware and Oculus output pre-compiled .dll. Thanks to Google, Reddit and Unity Answers that allowed to gather info to figure it out and a hack idea from the Getting  Started with Unity and Oculus Rift SDK article especially.

Now I just resize game window to 1280x800 and watch it on helmets screen :) I've not managed to do it like the article suggested so I've used Unity Editor customization and scaled/placed the window/viewport properly with the script form the Unity answers.

Now I've got my "Hello World" in this case Roll a Ball demo for Oculus DK1 with SDK 0.4.4 on mobile GPU with HDMI with Unity 5.2.1f1.


Sure it's a spherical horse in vacuum :) It looks like the newer versions of SDK are the same, just come as the source and can be viewed/modified/re-complied/the same way as C# editor script extensions and prefabs and I would never take look in there if everything was working from the beginning %)

It's nice to feel forgotten flavor of evolving software solutions in active development stage :)

See You soon with more impressions of Oculus Virtual Reality with Unity ;)

+ Yeah @ Gamasutra: Oculus VR with Unity Jump Start, @ LinkedIn as usual Oculus VR with Unity Jump Start, and @ Meduim experimental to be added Oculus VR with Unity Jump Start