Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SteamVR + Oculus Rift issues

Discussion in 'AR/VR (XR) Discussion' started by AndrewCzarnietzki, Jul 26, 2016.

  1. AndrewCzarnietzki

    AndrewCzarnietzki

    Joined:
    Jul 23, 2013
    Posts:
    189
    Hey,

    I'm trying to have one build that can run on both Oculus Rift CV1 and HTC Vive. I'm using Unity 5.4.0f1, and have the 1.1.0 version of Steam VR (I think the latest?).

    If I have OpenVR as the top VR SDK, Unity just hangs on start when I try to run the build with the Oculus Rift. The output log is a giant stream of:

    StackOverflowException: The requested operation caused a stack overflow.
    at (wrapper managed-to-native) UnityEngine.Transform:set_parentInternal (UnityEngine.Transform)
    at UnityEngine.Transform.set_parent (UnityEngine.Transform value) [0x00016] in C:\buildslave\unity\build\artifacts\generated\common\runtime\UnityEngineTransformBindings.gen.cs:151
    at SteamVR_Camera.Expand () [0x0016e] in C:\AProjects\Liar\Unity\Assets\SteamVR\Scripts\SteamVR_Camera.cs:197
    at SteamVR_Camera.OnEnable () [0x0004e] in C:\AProjects\Liar\Unity\Assets\SteamVR\Scripts\SteamVR_Camera.cs:64
    at (wrapper managed-to-native) UnityEngine.Transform:set_parentInternal (UnityEngine.Transform)
    at UnityEngine.Transform.set_parent (UnityEngine.Transform value) [0x00016] in C:\buildslave\unity\build\artifacts\generated\common\runtime\UnityEngineTransformBindings.gen.cs:151

    I haven't modified Steam VR at all, and I'm using a pretty vanilla version of the Steam VR camera rig (with a few additional game objects). I'm certainly not doing any reparenting or such.

    --

    If I have the Oculus SDK as primary, then it actually runs and opens on the Oculus Rift. However the tracking is nauseatingly wrong - like the camera is 2 or so meters above the actual camera location.

    Additionally, I'm using the Steam VR camera's offset projection matrix to do a really nifty stereo correct water style reflection. I got this working with the DK2 plugged directly into the Unity editor. On the build there is simply no reflection - which leads me to think the Steam VR camera stuff is dependant on using Open VR?

    --

    My understanding was that it should be possible to have Vive and Rift working on the same build and functioning about the same - am I wrong? Has anyone managed to make this work correctly?

    Thanks!
     
  2. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,079
    I've just had a similar problem with the library order and can confirm from private correspondence that Unity knows about it and will be looking into it after I submitted a related bug report.

    http://forum.unity3d.com/threads/water-reflections-in-vr-are-wrong-in-5-4-0f1.417495/#post-2723337

    There are also issues with water reflections in OpenVR which they will be looking into as well.
    https://issuetracker.unity3d.com/issues/openvr-water-reflections-rendering-issue

    Basically, as I understand it, if you have OpenVR at the top of the list, Unity ends up using that with the Rift instead of using the Oculus library below it. It's a known issue and they'll get to it. For now all you can do is put the Oculus lib on top if you want to run the Rift in 5.4, but it's probably not safe to just assume the Vive is going to work, so unless you've got both headsets to test on, I'd recommend not pursing Vive+Oculus support in 5.4 at this time.

    As far as I know it's not really possible for 5.4 to support both Vive and Oculus through the integrated libs just yet. I've reverted to 5.3 for this reason and will be waiting for a later 5.4 version to fix these types of issues before trying to support Vive+Oculus without the SteamVR plugin. It'll come eventually but it doesn't seem ready just yet. Let's remember that 5.4 is still beta, so some hiccups like these are to be expected.
     
  3. AndrewCzarnietzki

    AndrewCzarnietzki

    Joined:
    Jul 23, 2013
    Posts:
    189
    Thanks for the reply!

    So the big breakthrough water wise was being able to use the offset projection matrix in the shader to switch between a left and a right water render - slow, but worth it. (Before I had the two eyes completely separate, but that inefficiency had me under the minimum frame rate). Problem is this required the Steam VR cameras, though at least at 5.4.b11 it worked just fine on a Dk2. I had a bit of a break due to some travel, came back and upgraded to 5.4.0f1, and now I find that my camera rig no longer works (was totally fine), OpenVr crashes, and Oculus API doesn't get the Steam Vr camera stuff my shader needs.
     
  4. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    FYI the issues with water on OpenVR vs. Oculus is related to the fact that we render with asymmetric projection matrix in OpenVR mode. (more details here) We're consider making it an opt-in or opt-out option to ease the pain of incompatible shaders. For now, you'll need to tweak the shaders manually until we gradually fix all of the built-in shaders or add the compatibility mode toggle.

    Regarding the stack overflow, valve is investigating this with regards to steam vr plugin.