OSVR / OSVR-Unity

Package for authoring OSVR experiences with Unity.
Apache License 2.0
98 stars 38 forks source link

Unity Native VR Support #237

Closed DuFF14 closed 6 years ago

DuFF14 commented 6 years ago

This PR connects Unity's native VR support to OSVR-RenderManager, allowing OSVR-Unity apps to take advantage of Unity's VR optimizations such as "single-pass" rendering.

There is a new scene (OSVR-UnityVR-Demo.unity) and prefab (OsvrUnityStereoCameraParent). The new prefab is meant to replace VRDisplayTracked prefab as the VR camera in the scene.

To add OSVR support to an existing Unity VR app, you'd just add OsvrUnityNativeVR.cs to the Camera and add the "Split Stereo Display (non-head-mounted)" option to the list of supported VR SDKs in Player Settings.

This has been tested with Unity 2017 and HDK2 with this direct mode enabled config file. This may not support overfill/oversample correctly yet.

Here is a unitypackage of this PR, for testing.

DuFF14 commented 6 years ago

Here is a profiler comparison of a test with the Palace Demo, which shows that rendering time is about cut in half. image

russell-taylor commented 6 years ago

Awesome!

demonixis commented 6 years ago

That looks awesome DuFF14, good Job! Does it work on Linux and Mac too?

DuFF14 commented 6 years ago

@demonixis no, this doesn't add Linux or Mac support,

Sp4iK commented 6 years ago

Hi DuFF14, this is great. I've tested it a bit and it works okay, you just have to be sure to be running osvr server before entering play mode or Unity crashes, even if you tick "autostart server" it will start it but make Unity crash.

DuFF14 commented 6 years ago

@Sp4iK Thanks! That should be fixed with the last commit. The previous commit added Android support. I'll add some instructions to the readme, you'd need to add a config file to the device.