Unity with OpenVR for Vive and Oculus via SteamVR

SteamVR-HeaderIt is straightforward to start a Virtual Reality (VR) application using Unity 5.4 for SteamVR which supports both the HTC Vive and Oculus Rift head-mounted VR displays.

Unity-OpenVR-Sample-Editor

Follow the above tutorial to get a simple application going and test the setup. This involves downloading the SteamVR Plugin.unitypackage to your project, or to a new 3D project. You can then easily add content and an avatar/third person controller into which the [CameraRig] prefab can be placed and adjusted for position to allow for movement of the user viewpoint via the controller(s).

SteamVR Application Settings Recommendations

When the SteamVR Plugin is added to a Unity project, thee are a number of recommended settings offered…

SteamVR-Plugin-Settings-Recommendations

SteamVR Example Scene

The SteamVR Plugin.unitypackage includes an example scene you can immediately open for tests.

2016-08-10-Unity-OpenVR-Example-Scene-Editor 2016-08-10-Unity-OpenVR-Example-Scene

Changing an Existing App to Use OpenVR

Unity-OpenVR-ISS-Editor

An existing Unity/Oculus application, such as my ISS VR Experience, can be modified by changing the camera within the third person controller/avatar to be the OpenVR/SteamVR Plugin [CameraRig]

Unity-OpenVR-ISS-2D

There is an alternative documented in the “quickstart.pdf” document in the SteamVR folder after you import SteamVR Plugin.unitypackage, that is to simply add the SteamVR_Camera script to your Camera object(s). Everything else gets set up at runtime. Usually you will add the “SteamVR_Camera” script to the existing main camera in your application, and “Expand” it as documented in that guide. You can adjust the “Avatar_Camera (head)” and “Avatar_Camera (eyes)” to be where you want the viewpoint to be when you enter VR. This could be just in front of the third person controller/avatar’s head.

Unity-OpenVR-ISS-Script-Add-Version-Editor

Issues

My testing can only be on an Oculus Rift at the moment, as I do not have a HTC Vive available. Feedback from others trying the development route out would be welcome.

Steam, SteamVR and Oculus Home are all launched automatically if they are not runnng when starting a VR app made in Unity which incorporates the SteamVR plugin.

Initial issues on my early tests was that the editor playback VR mode had the camera in a very different place to when a standalone executable build was done. And also that performance was choppy when there were many 3D objects (like the core of the ISS) were in view. The image stabilised when looking to one end of the ISS where fewer objects were in the field of view.

This entry was posted in Space, VR and tagged , , , , , , . Bookmark the permalink.