HOW TO: Improve Performance with Vulkan and Oculus Quest (2)

I noticed that performance on Vulkan sucked on the Quest 2, even on Unity 2021.2. In the end I did fix the issue and it gave me a 30-60% performance boost and a lot better RAM usage!

The issue:

  • Oculus XR plugin defaults to 1.10.0

The fix:

  • Push to the latest 2.0 (2020.3) or 3.0 (2021.2) version

How to:

  • Go to your project’s root folder (where you stored your project)
  • Open the Packages folder
  • Open the Manifest.json file (notepad will do)
  • Change:
    “com.unity.xr.management”: “4.0.7”,
    “com.unity.xr.oculus”: “1.10.0”,

To:
“com.unity.xr.management”: “4.2.0”,
“com.unity.xr.oculus”: “3.0.0-pre.1”, (or 2.0.0-preview.1)

This way you use the latest version and also gain the ability to use Late Latching for better latency
( and in the future SpaceWarp, which you currently need a modded URP for in Unity 2020.3: GitHub - Oculus-VR/Unity-Graphics at 2020.3/oculus-app-spacewarp )

1 Like

Future is here already. You need 2020.3.21 or newer 2020.3 version, those SRP packages from oculus branch, 2.0 preview for OculusXR and Oculus v34 integration package from asset store. After you have these in the project, install Oculus version of OpenXR from oculus tools menu and use OVRManager.SetSpaceWarp(true); on your scripts to turn it on in the build.

For debugging this, latest OVR Metrics Tool for Quests already supports AppSW.

As a side note, on my brief testing with 2020.3, 2021.2 and 2022.1 for Quest 2 builds, 2020.3 alone even before App SpaceWarp feels tad faster than what we have on the newer engine versions URPs.

also: Application SpaceWarp Developer Guide: Unity | Oculus Developers

5 Likes

App SpaceWarp is coming to URP when? I understand it’s still in preview and I’d rather not use a preview. Any info?

2 Likes

I have done everything you said and added ovrmanager.setspacewarp(true) on the Start function. There seems to be no fps change with it set to true or false?

Spacewarp needs a modified URP version currently afaik, check the Oculus Dev blog

The already mentioned doc is the most detailed one, has step by step instructions:
https://developer.oculus.com/documentation/unity/unity-asw/#how-to-enable-appsw-in-app

2 Likes

I’m happy to wait for it to go in mainstream URP rather than some funky version that’s stuck in the mists of time.

Hopefully there is some kind of ETA for that.

2 Likes

I followed your instructions, installed, modded what needed to be and put OVRManager.SetSpaceWarp(true); at every scene’s awakening. It seems to be working well in a build on the Quest 2, although it is about 10/15fps slower than before. But in the editor, in play mode, the headset stays at its original position and does not follow the movements of the real one.
There is also a Debug.Log from the OVRManager that I never got:

[OVRManager] mainCamera found for MRC:
UnityEngine.Debug:LogFormat (string,object[])
OVRManager:FindMainCamera () (at Assets/Oculus/VR/Scripts/OVRManager.cs:2040)
OVRManager:SetSpaceWarp (bool) (at Assets/Oculus/VR/Scripts/OVRManager.cs:1159)
LaunchSpaceWarp:Awake () (at Assets/Scripts/LaunchSpaceWarp.cs:8)

It worked well prior to the changes to integrate SpaceWarp.
I used:
Unity 2020.3.22f1
Modded SRP 10.7.0: com.unity.render-pipelines.core; com.unity.render-pipelines.universal; com.unity.shadergraph
Oculus Integration 34
Oculus XR Plugin 2.0.0-preview.1
XR Plugin Management 4.2.0

Would this be an issue with Vulkan ? Or is it way more likely that the preview packages messed things ?

It has to use Vulkan, it doesn’t support OpenGL ES3+

2 Likes

Application SpaceWarp doesn’t work on PC, only natively on Quests meaning AppSW wont work when you play in editor.

1 Like

I am using Vulkan. So it is normal that when playing in editor with AppSW, I cannot use Oculus Link to see it in my Quest then ?

You can use oculus link, but it just wont use AppSW. It’s just like you were using a rift s with link

But that is my issue, Unity detects the headset but does not play in it, game view looks as if there is not headset connected and the camera stays on the ground. And when using an ASW build on Quest 1, after about 20s the camera gets stuck, showing always the same view and giving a wonderful motion sickness moment.
I will try to change the experimental features that come with Vulkan to see if it stops messing on the Quest 1.

I just found out that one cannot use the Subsampled Layout option with Quest 1 (as it is written in the options duh). But still, after a few seconds the camera gets stuck between 2 frames and alternates quickly between them. The only options checked under “XR Plug-in Management > Oculus” are “Target Devices: Quest” and “Experimental: Application SpaceWarp (Vulkan)”. This behaviour does not appear on the Quest 2.

Check if you’re using the quest or quest 2 before setting spacewarp or just not use it until it is properly implemented

1 Like

For me the new Oculus XR 2.0.0 break playing in editor. It only work on Quest.
I have to go back to 1.11.0 to make the editor work again.

Also the Custom URP package break shader and vfx graph view. Really don’t move to this version except if you really want to add AppSW, it’s not ready yet.

1 Like

You sure you cloned the custom SRP packages with Git LFS? and you got ALL three packages, core, universal and shadergraph from it? You need all three for this.

The shader graph previews are all errors, but the generated shader seems usable 7702939--964807--upload_2021-12-2_15-56-22.png
Steps to reproduce:

  1. create new project using Unity 2020.3.22f1 and URP pipeline template
  2. close unity, go to manifest.json, remove the com.render-pipelines.universal
  3. clone from https://github.com/Oculus-VR/Unity-Graphics.git and made sure i’m on the branch 2020.3/oculus-app-spacewarp
  4. made sure the lfs was working by inspecting some dll such as com.unity.render-pipelines.core\Editor\ShaderGenerator\ICSharpCode.NRefactory.dll (it should be >500kb and not just 1kb)
  5. copy the core, universal, and shadergraph folders into the new project’s Packages folder
  6. open the project with unity
  7. create > Shader > URP > Lit Shader Graph
  8. create some nodes

console produces errors, e.g.
Shader error in ‘hidden/preview/UV_4a2305d9640541b386be037a015d0e3d’: ‘GetPrevObjectToWorldMatrix’: function must return a value at Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl(18) (on d3d11)
Shader error in ‘hidden/preview/UV_4a2305d9640541b386be037a015d0e3d’: undeclared identifier ‘UNITY_MATRIX_PREV_M’ at Packages/com.unity.render-pipelines.core/ShaderLibrary/SpaceTransforms.hlsl(18) (on d3d11)

some additional warnings I do not understand
7702939--964804--upload_2021-12-2_15-53-18.png

some asmdef has missing references (just showing two, there are more that missing). not sure if this is relevant or important.
7702939--964810--upload_2021-12-2_15-58-54.png
7702939--964813--upload_2021-12-2_15-59-46.png

Yes. AppSW work fine on Quest. It’s just PC version that don’t work anymore

This is the first time in 10+ years that I have not been able to put any technology into operation in unity. I’m not a programmer, but so far I’ve managed to download, set up and try everything from github - but I’m completely clueless here. I hope that SpaceWarp will get to the official URP as soon as possible - which I will download in some way that I can handle …

1 Like