Search Unity

Official Unity support for OpenXR in preview

Discussion in 'AR/VR (XR) Discussion' started by rickmus, Dec 17, 2020.

Thread Status:
Not open for further replies.
  1. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    140
    For example, use the Oculus XR Plugin or Legacy Oculus Desktop, the controller is in the correct position and rotation without any changes. OpenVR always needs an offset, and it appears to be the same in OpenXR. Some offset is needed to be applied to the tracking so that the controller lines up with where it should be.
     
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Which runtime are you using? Have you tried both SteamVR runtime and the Oculus runtime to see if they are the same? What bindings are you using to get the device positions and how far are they off? We will look into the poses to see how they differ between the oculus Plugin and the OpenXR oculus runtime.
     
  3. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    I just tried setting a controller down on the the table in front of the device and running it both using the Oculus XR Plugin and OpenXR / Oculus Runtime and I do see a difference in the device Position and rotation. We are looking into whether this is an issue with the Oculus Runtime or with the OpenXR plugin.
     
  4. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    140
    Thanks, I've had reports from others that it's with every controller type: not just Oculus Controllers. Can you confirm that the suggested tracking component is the "Tracked Pose Driver (New Input System)" component with bindings when using OpenXR?
     
  5. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Yes the correct usage within OpenXR would be the the Tracked Pose Driver (New Input System) with action bindings. Some devices how more than one position/orientation but I believe the oculus controller only has one.
     
  6. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    The offset we are seeing seems to be very minor, is that what you are noticing too? Have you actually figured out the counter offset you need to make them the same yet? Having those numbers may help track it down.
     
  7. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    189
    I've seen some very noticeable offsets for the Oculus Touch controllers (for both the CV1 and Quest 2) when using OpenXR that weren't there in the Oculus plug-in. The offset is the most noticeable when physically tapping the left and right controllers together (using the same official Oculus controller models) -- in OculusXR the controllers don't intersect each other, while in OpenXR they tend to have a very pronounced overlap (I think it's almost 50% of the bounding box of the controller in the Oculus OpenXR runtime).

    If you try to bounce the controller from the other side the controller's models' don't touch at all when they tap in the real world.

    The positioning of the controller is -- with a mm or two -- identical in this setup (and in all attached photos). The only change made was switching the XR plugin and OpenXR runtime / my natural hand jitter holding the controllers (the 1-2 mm). I'm using the new action based input system, and have both the "Track Pose Driver (new input system)" component on the Main Camera, and the normal "Track Pose Driver" -- as I can't get the camera to follow the player's head without the latter (idk why).

    Theis first photo is using the Oculus OpenXR runtime.
    OpenXR_vs_OculusXR_ControllerOffsets.jpg

    This second photo is using the Steam OpenXR runtime. There the offset is much smaller (and just happens to be almost exactly the width of the top tracking ring on the controllers).
    OpenXR_Steam_ControllerOffsets.jpg
     
    Last edited: Mar 23, 2021
  8. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    140
    What colin posted is a about what I'm seeing as well. This is a pretty huge difference. I haven't tested other controllers myself, but I have heard reports that other controller types have the same issue. Knuckles etc.
     
  9. Hobodi

    Hobodi

    Joined:
    Dec 30, 2017
    Posts:
    101
  10. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    The OpenXR specification only supports linear color space at this time.
     
  11. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    We are looking into this right now and will post back here when we have a solution.
     
    colinleet likes this.
  12. nukadelic

    nukadelic

    Joined:
    Aug 5, 2017
    Posts:
    78
    Anyone knows when will the quest apk build support is planned for ?
     
  13. FishStickies94

    FishStickies94

    Joined:
    Jul 27, 2019
    Posts:
    70
    Anyone aware of a way to detect which OpenXR runtime is being used at runtime within Unity? Want to have different settings for Oculus vs Steam users.
     
  14. shiena

    shiena

    Joined:
    May 19, 2017
    Posts:
    44
    You can distinguish between Oculus and SteamVR by detecting each configuration file. I made a small library for that.
    https://github.com/shiena/OpenXRRuntimeSelector

    Code (CSharp):
    1. void Start()
    2. {
    3.     var openXRRuntimes = OpenXRRuntimeJsons.OpenXRRuntimeJson.GetRuntimeJsonPaths();
    4.                                                                                                                
    5.     void Initialize(string settingPath)
    6.     {
    7.         if (openXRRuntimes.TryGetValue(OpenXRRuntimeJsons.OpenXRRuntimeType.Oculus, out var oculusPath))
    8.         {
    9.             if (settingPath == oculusPath)
    10.             {
    11.                 // initialize for Oculus
    12.             }
    13.         }
    14.         else if (openXRRuntimes.TryGetValue(OpenXRRuntimeJsons.OpenXRRuntimeType.SteamVR, out var steamPath))
    15.         {
    16.             if (settingPath == steamPath)
    17.             {
    18.                 // initialize for SteamVR
    19.             }
    20.         }
    21.     }
    22.                                                                                                                
    23.     if (openXRRuntimes.TryGetValue(OpenXRRuntimeJsons.OpenXRRuntimeType.EnvironmentVariable, out var envPath))
    24.     {
    25.         Initialize(envPath);
    26.     }
    27.     else if (openXRRuntimes.TryGetValue(OpenXRRuntimeJsons.OpenXRRuntimeType.SystemDefault, out var defaultPath))
    28.     {
    29.         Initialize(defaultPath);
    30.     }
    31. }
     
    dpcactus and gtk2k like this.
  15. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467

    You could also go off of the runtime name, keeping in mind that there is no guarantee that the runtime makers wont change their runtime names or json paths.

    https://docs.unity3d.com/Packages/c.../api/UnityEngine.XR.OpenXR.OpenXRRuntime.html
     
    gtk2k and shiena like this.
  16. FishStickies94

    FishStickies94

    Joined:
    Jul 27, 2019
    Posts:
    70
    Awesome dude cheers for this!
     
  17. shiena

    shiena

    Joined:
    May 19, 2017
    Posts:
    44
    Maybe you can detect it this way as well.

    Code (CSharp):
    1. var lowerName = UnityEngine.XR.OpenXR.OpenXRRuntime.name.ToLower(CultureInfo.InvariantCulture);
    2. if (lowerName.Contains("oculus"))
    3. {
    4.     // initialize for Oculus
    5. }
    6. else if (lowerName.Contains("steamvr"))
    7. {
    8.     // initialize for SteamVR
    9. }
     
    dpcactus likes this.
  18. Rib

    Rib

    Joined:
    Nov 7, 2013
    Posts:
    39
    Regarding the origin offsets others have been reporting with Oculus controllers; I just wanted to add that I'm seeing something similar with Vive controllers.

    I was starting to experiment with the OpenXR XR plugin today and seeing a discrepancy of (I think exactly) 10cm with the Vive controllers along the Z axis between the pose position got via OpenVR XR plugin and the pose from the OpenXR plugin.
     
  19. spvn

    spvn

    Joined:
    Dec 10, 2013
    Posts:
    80
    Am I right to assume that once more platforms are supported (most notably Vive and Oculus) that the documentation front page will be updated? It's way too tiring to keep having to read this forum thread to figure out when exactly I can port my Vive/Oculus stuff to OpenXR reliably. It seems like it's currently working... but has plenty of bugs still?
     
  20. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    189
    Steam and Oculus OpenXR runtimes are both supported... Neither are perfect either, nor are at full feature parity with their per OpenXR runtimes. I think just the Quest 1/2 for native android builds are still fully unsupported.

    But to be fair a lot of the XR plug-in developer first hear about those bugs here too... And it's still in preview/pre release.

    Documentation can come after "fixing the thing" in my book (although really it take should be simultaneous and generated from inlined source code comments)... Which Unity as a whole is actually rather good at.

    Any word on when haptic feedback will be added?
     
    hookmanuk and tcmeric like this.
  21. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    OpenXR support for additional platforms will be more dependent on the runtime developers than Unity. I dont know if there are plans to report that information here on the forums or if it would be best to watch the runtime developers sites.

    If there are specific bugs you have issues with please report them so we can address them, though some of the bugs must be fixed in the runtimes.
     
  22. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Will this support OpenGL / Vulkan on desktop? It seems that right now e.g. when you want to use OpenXR on Windows Desktop, Oculus forces the Graphics API to DX11, which means we can't test on Windows against OpenGL / Vulkan.
     
    Iron-Warrior and colinleet like this.
  23. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    I dont know if the oculus runtime supports vulkan or not at this time. The OpenXR Plugin does have support for GLES but again I am not sure any desktop runtimes use it. How do you mean oculus is forcing DX11? Are you saying you have both apis in your list with vulkan as the top api but you still get dx11 ?
     
  24. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    189
    Could they be confusing HDRP only supporting DX11?
    https://docs.unity3d.com/Packages/c...es.high-definition@7.1/manual/VR-in-HDRP.html
     
  25. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    I got some further clarification. While the OpenXR plugin does support GLES it is not an option for desktop. Vulkan support on desktop is not as robust as d3d11 support and the Oculus Plugin (Non-OpenXR) does actually disable vulkan on PC and fallback to d3d11.
     
  26. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Thanks for the partial clarification. We're trying to use OpenXR on Vulkan. The Oculus plugin is not active, only OpenXR is active. Still, OpenXR with Vulkan doesn't seem to work at all and does not initialize any kind of XR, with the log about Oculus.
    Is this a Oculus bug where the package does something (prevent XR entering) even while it's not the active XR Backend?

    certainly sounds like there is some support and having set Unity to Vulkan on Windows Desktop and trying to use OpenXR should at least do something, or am I mistaken there? (right now it does nothing)
     
  27. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    What OpenXR runtime are you using? If you want to send a project or your editor logs to me I can take a look at it.
     
  28. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    When trying to reproduce in a blank project all I get is immediate crashes on entering play mode;
    reported as Case 1326119 [XR] Crash on pressing play after switching to Vulkan on Windows Desktop
     
  29. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    There is a known issue with the Oculus Runtime crashing when using vulkan, we have reported it to Oculus.
     
    fherbst likes this.
  30. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    OK, so to summarize: there is no way to use anything other than DX11 on Desktop right now when using OpenXR + Oculus.
    Is that correct?

    (reason we wanted to test that is that we get rendering differences on Desktop and Quest and wanted to reproduce/debug those by testing on Desktop with the same graphics backend. So one bug is covering more other bugs here ;))
     
  31. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Unfortunately I believe that is true because of the crash.
     
  32. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    One other thought though, you could try the Steam VR runtime.
     
  33. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    I tried, and that's also what QA replied, and it doesn't crash but is still broken (double rendering), so reported
    Case 1326186 [OpenXR][Vulkan] Oculus via SteamVR renders double in OpenXR
     
  34. MichaelJWilliams

    MichaelJWilliams

    Joined:
    Apr 19, 2020
    Posts:
    4
    New SteamVR beta update 1.17.4 is out: https://steamcommunity.com/games/250820/announcements/detail/3007816130308944470

    The change notes include:

    My Oculus Link cable is broken at the minute so I can't check myself - does that fix this issue?
     
  35. MichaelJWilliams

    MichaelJWilliams

    Joined:
    Apr 19, 2020
    Posts:
    4
    (I found another cable.) I'm still seeing a mismatch between where the Oculus OpenXR runtime says my controller is and where Steam's runtime says it is.

    I put my left hand Touch controller on the table, resting on the ring upside down like so:
    1.jpeg

    My Unity project uses a simple cuboid as a controller model; it binds to <XRController>{LeftHand}/devicePose and sets deviceRotation = pose.rotation and devicePosition = pose.position, nothing complex.

    Here's what I see with the Oculus runtime:

    Unity_vpe0bs2c4V.png

    Here's what I see with the new SteamVR beta 1.17.4 runtime - the model aligns with where the "stem" of the controller is in real life:

    Unity_1aasV8bFbQ.png

    And here's what I see in the Input Debugger (Oculus, then SteamVR):

    Unity_7o7h2gJqap.png
    Unity_UX7nFNLHXJ.png

    I didn't move the controller in between tests, but of course I did move my head and the HMD, so presumably that would affect these inputs. But note that, in SteamVR's case, the devicePose and pointer poses are the same, whereas in Oculus's case they differ. (Oculus is correct here.)

    I assume these issues are all to do with the SteamVR runtime rather than Unity, but thought I'd report them here in case it's helpful.
     
  36. Hobodi

    Hobodi

    Joined:
    Dec 30, 2017
    Posts:
    101
    The problem is that gamma with blit type never works much faster on quest and android platforms, but in the editor there is no way to enable different types of colors for different platforms.
    Perhaps you could suggest something other than switching from one color space to another every time?
     
  37. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    I have previously used the Oculus integration, but now trying out HP Reverb G2 in OpenXR package. But I am having difficulties finding a recenter command to use at runtime. Can anybody help with this?
     
  38. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Unfortunately I dont believe there is a good solution to this, as you said once you select linear it changes it for all players.
     
  39. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    140
    Got a bit of an issue, OpenXR Headtracking feels Really jittery, but it's rock-solid when using the Oculus Loader. Any idea what that might be?
     
  40. hookmanuk

    hookmanuk

    Joined:
    May 28, 2013
    Posts:
    20
    Is there any update on support for Oculus Quest yet?
     
  41. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    I am using OpenXR with HP Reverb G2 and Oculus Rift S. No tracking issues... Using 2020.3.3f1 with latest packages
     
  42. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    515
    Using Oculus Rift S with OpenXR results in a strange extremely low FOV. Anyone have input on this issue?
     
    spe3tra likes this.
  43. FishStickies94

    FishStickies94

    Joined:
    Jul 27, 2019
    Posts:
    70
    Is there any updates coming regarding haptics?
     
    colinleet likes this.
  44. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    We found a bug that was causing haptics to not work and this will be fixed in the next release. In the mean time I wrote up a quick script to work around the issue until the next OpenXR plugin release is out. Keep in mind that this script will not work as it is once the next version of the OpenXR Plugin is out, you will need to change the
    channel
    to 0 at that time. This script demonstrates issuing a haptic impulse on the same controller an action is fired on as well as specifically sending an impulse to the left and right controller. Let me know if you have any questions.
     

    Attached Files:

  45. DylanF

    DylanF

    Joined:
    Jun 25, 2013
    Posts:
    55
    Thanks for the haptics workaround!
     
  46. NemesisWarlock

    NemesisWarlock

    Joined:
    Jan 21, 2017
    Posts:
    140
    Awesome! Now all we need is android support. ;)
     
  47. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    It's coming, we're working through some final legal issues before we can release.
     
  48. MrBIoBR

    MrBIoBR

    Joined:
    Jul 2, 2017
    Posts:
    9
    First of all, thanks for trying to get a workaround this issue... but, I've tried to implement this and it didn't work...

    The Callback for the "Rumble" Function is working, but the controllers are not rumbling... (Using Oculus Quest 2 Here)

    Code (CSharp):
    1.  private void Rumble(InputDevice device)
    2.     {
    3.         Debug.Log($"HUMBLE on {device.name}");
    4.         // Setting channel to 1 will work in 1.1.1 but will be fixed in future versions such that 0 would be the correct channel.
    5.      
    6.         var command0 = UnityEngine.InputSystem.XR.Haptics.SendHapticImpulseCommand.Create(0, _amplitude, _duration);
    7.         device.ExecuteCommand(ref command0);
    8.         Debug.Log($"Execute {command0.typeStatic} on {device.name} ");
    9.  
    10.      
    11.         var command1 = UnityEngine.InputSystem.XR.Haptics.SendHapticImpulseCommand.Create(1, _amplitude, _duration);
    12.         device.ExecuteCommand(ref command1);
    13.      
    14.         Debug.Log($"Execute {command1.typeStatic} on {device.name} ");
    15.     }
    16.  

    as you can see I put some debugs to see if everything is being called and yes it is:



    Any help on how I can make this work until any official patch is out ?
     
  49. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    What is the InputDevice you are using? If you have a sample project you can send that will help too.

    Actually I just noticed the name projected out, ignore that part of the question :)
     
  50. alexmalyutindev

    alexmalyutindev

    Joined:
    Feb 4, 2017
    Posts:
    2
    Is it possible to use OpenXR eye gaze interaction with Vive Pro Eye?
     
Thread Status:
Not open for further replies.