Search Unity

Resolved OpenXR, Oculus Quest 2 In Editor Play Mode, Only Works With Direct3d11 API, Vulkan Crashes

Discussion in 'VR' started by astracat111, Jul 19, 2021.

  1. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Hey there,

    I've gotten the Oculus Quest 2 working with Unity 2021.1.15f1 by these steps:

    1) Windows - > Package Manager - > OpenXR Plugin
    2) Windows - > Package Manager - > OculusXR Plugin
    3) Edit - > Project Settings -> XR Plugin Management - > Install XR Plugin Management
    4) XR Plug-in Management - > select 'OpenXR' in windows and android tabs.
    5) Under XR Plug-in Management 'OpenXR' Project Settings entry appears.
    Interaction Profiles - > Select 'Oculus Touch Controller Profile'
    Play Mode OpenXR Runtime - > Select 'Oculus' (this gets it working in play mode in the editor, and you have to keep selecting this every time you re-open your project)
    6. You also have to do Project Settings - > Package Manager - > Enable Pre-release Packages.
    7) Package Manager - > XR Interaction Toolkit, install this.
    8) Right click and add an XRRig (device based) game object to the scene.
    9) Make sure Oculus Quest 2 is set to Developer Mode.
    10) You also need to do: Window - > Analysis - > Input Debugger. In the Input Debugger window you need to select 'Lock Input To Game View' in order for headsets to work in editor play mode as well.

    Now here's where things get tricky.

    Under Project Settings - > Player....You have to have both 'Direct3D11' and 'Linear' color spaces to use the Oculus/OpenXR in edit mode.

    However, the Oculus Quest 2 when building to Android needs 'Gamma' and 'OpenGLES 3.0'.

    This is creating a real problem, because now I need to build the game in Android, Gamma, and OpenGLES 3.0. Switching to Gamma and switching to OpenGLES 3.0 requires a huuuge re-import.

    Is there a way I can just get the testing in editor play mode working using Gamma and OpenGLES instead? It just won't work unless I select specifically Linear color space and Direct3D11 under API.
     
    Last edited: Jul 19, 2021
  2. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Editor with OpenXR should not require linear color space. If you have OpenXR enabled for stand alone and d3d11 set for the windows player then you should be able to have opengles / OculusXR for android. If for some reason you cant run with d3d11 / gamma please submit a bug report at `Help -> Report a bug` with a sample project that demonstrates this setup. Thank you
     
  3. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Alright, I'll have to submit a bug report.

    Vulkan also freezes as well. Still running a handful of tests.
     
  4. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    If you do post the issue # here so we can grab the project and take a look to see if it is anything obvious.
     
  5. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Alright, it's a new project.

    I'll maybe create an unlisted youtube video as well to post here.

    Is there a way I can get the crash report myself to check the code? Is it the code in the 'OpenXR Plugin' or the 'XR Plugin Management' folders under Packages?

    EDIT: Sorry for this, but I don't know how to properly report an issue, does that pop up when it crashes?
     
  6. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Okay, upon further testing, Gamma color space is working, but the Vulkan API is not working with Oculus Quest 2. Right now the Unity Bug Reporter is packing the report.

    I'm going to test other graphics APIs and get back to you on which ones work and which don't. I know that Direct3D11 does work with the Oculus Quest 2, but again this isn't supported by Android.
     
  7. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Here's the video and I've reported the bug as well but don't know how to give you the number.

    The problem is that Vulkan crashes when PlayMode OpenXR Runtime is set to - > Oculus and using the Oculus Quest 2 with the Oculus Link.

    OpenGLES 3.0 won't work also with Gamma, so that means the only Graphics API that working with the Oculus Quest 2 right now is Direct3D11 which won't work with Android builds.

    Here's a Youtube showing as clearly as possible what's happening:

    (This is a 2 minute video explaining the problem as clearly as I can)

    Here is the project:
    https://drive.google.com/file/d/1VVpvB779G9lG8tIX0r6ml0-rmUgQpSdf/view?usp=sharing


    Here are my basic system specs:
    Windows 64-bit, Windows 10 Home
    Intel Core i5-9400 at 2.9Ghz
    16GB of Ram
    Using NVIDIA GeForce GTX 1660

    I've titled this 'only working with linear color space' but the title should be renamed to 'only working with Direct3D11 API.
     
    Last edited: Jul 19, 2021
  8. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    OKAY HUGE UPDATES!

    I've learned a TON of things in the last 5 days of trying to port to the Oculus Quest 2 natively.

    Using the following settings I was able to solve the problem, and test in editor with the Oculus Quest 2 headset AND build to the platform.

    The trick was to not select 'OpenXR' under XR Plug-in management, and to switch to Android build platform in the Unity Editor.

    Enabling the incremental garbage collector for some reason was required for me to stop it from locking up when I tested in editor play mode.

    I'm not entirely sure how SteamVR will work now since I can't build an EXE, have XR Plug-in Management with 'OpenXR' selected, it NEEDS to be Oculus for PC builds too....but, my thought is that Steam Works just has branches or some way you upload different separate EXE files per the headset you're targeting.

    P.S - I haven't tried Vulkan, but OpenGLES 3.0 is working.




     
    Last edited: Jul 20, 2021
  9. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    You can have OpenXR selected for Standalone (Desktop) and Oculus for Android. The graphics drivers are also platform specific.
     
    vr365gaming likes this.
  10. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    For some reason it works when you hit 'build and run' for pc, but even if I try to boot up the runtime manually, when you select OpenXR and build to a windows executable and run it, it won't launch the game even if you're using Steam VR.

    Steam VR only works for Oculus Quest 2 at my end if you selected Oculus as your PC runtime.
     
  11. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    Are you changing the runtime on your machine to steam vr when you run the standalone build? You can do this via the steam menus.
     
  12. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    I need to do more testing. So far SteamVR recognizes the headset standalone only when I build it for PC - > Oculus.

    For anyone else reading this, when you've got your Oculus Quest 2 hooked up, you need to switch to PC - > OpenXR and select Oculus Headset for playtesting with with the Oculus controllers profile....But THEN you can switch to Android or whatever you'd like and it'll work properly. It's very strange.
     
  13. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    I am not sure I follow completely. When you say go to PC -> OpenXR and select oculus what does that mean? Do you mean the `play mode runtime` in the openxr settings?
     
  14. astracat111

    astracat111

    Joined:
    Sep 21, 2016
    Posts:
    725
    Not the play mode runtime, but the Plug-in Providers.
     
  15. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    If you select oculus in the plugin providers then you arent using OpenXR anymore. You can select OpenXR for standalone and Oculus for android though.
     
  16. Immersive-Matthew

    Immersive-Matthew

    Joined:
    Mar 24, 2020
    Posts:
    137
    OpenXR is a utter mess...does anyone have any insights as to when we will be able to use and not spend weeks messing about with it like @astracat111? I am really disappointed in Unity and Oculus for this rather poor rollout of OpenXR. What a sh@t show.
     
  17. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    What issues are you having? The experience of astracat11 has not been found to be the common experience of our users. There are already products released using Unity/OpenXR. If you have specific issues you have please let us know and we can try to help you through it.
     
  18. Immersive-Matthew

    Immersive-Matthew

    Joined:
    Mar 24, 2020
    Posts:
    137
    @the_real_apoxol It states I need Unity 2019 or new to use OpenXR with Unity yet I am on 2021.1.15f1. Plus it does not support FFR yet which is pretty key feature for most titles. I already submitted a bug a few days ago and am waiting to hear back.
     
  19. the_real_apoxol

    the_real_apoxol

    Unity Technologies

    Joined:
    Dec 18, 2020
    Posts:
    467
    2021.1.15f1 supports OpenXR, are you having a problem getting it to work?

    Yes FFR is not supported in OpenXR as it is not part of the OpenXR Specification. Oculus has just recently announced their plans to move forward with OpenXR but they do not have an extension yet for FFR. We will be working with Oculus as they develop their OpenXR extensions and I would image they will eventually have a FFR extension available. Please understand that OpenXR is an open standard and at unity we can only support what is in that standard. As the standard improves we will continue to support the newer features and in the mean time runtimes will continue to add their own functionality via extensions.

    https://developer.oculus.com/blog/oculus-all-in-on-openxr-deprecates-proprietary-apis/
     
  20. n_saikiran

    n_saikiran

    Joined:
    Sep 1, 2016
    Posts:
    20
    @the_real_apoxol Any update on this ?
    Is FFR now supported in OpenXR ?
     
  21. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    late but just to let you know, activating spacewarp + vulkan makes oculus XR to not work on editor while OpenXR works
     
    Last edited: Dec 6, 2022
    Eclectus, EternalCry and glenneroo like this.
  22. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
    Thanks! I just wasted a whole day to realize this was my issue (using Legacy XR + 2021.3.x).

    I need to start doing a full test every time I toggle any single check-boxes in Unity when working in VR.
     
    manurocker95 likes this.
  23. EternalCry

    EternalCry

    Joined:
    May 7, 2018
    Posts:
    5
    Thank you so much. The spacewarp setting checked is what caused my playmode to get stuck on unity loading in the headset.
     
    Eclectus likes this.
  24. manurocker95

    manurocker95

    Joined:
    Jun 14, 2016
    Posts:
    210
    yeah, happened to me. Unity hasn't released the fix yet...
     
    Eclectus likes this.
  25. talha-safdar

    talha-safdar

    Joined:
    May 28, 2022
    Posts:
    7
    Thank you, the developer mode was switched off and I was working on Pass-through feature which requires developer mode on. Thanks again!