Search Unity

Question Seeking Insight on Unexpected Frame Rate Impact with Oculus Integration's AndroidOpenXR Folder

Discussion in 'VR' started by rahulchawla2801, Jan 17, 2024.

  1. rahulchawla2801

    rahulchawla2801

    Joined:
    Oct 5, 2021
    Posts:
    34
    Greetings Unity Community,

    I'm facing an intriguing issue while developing for Meta Quest 3 using the Oculus XR Plugin and XR Plugin Management. My project incorporates the XR Interaction Toolkit, and while I've never actively used the Oculus Integration package, I installed it at some point.

    Currently, my application runs at approximately 72fps, but I'm aiming to boost it to 90 or even 120fps, taking advantage of the Meta Quest 3's 120Hz display refresh rate. To achieve this, I began exploring performance improvements without relying on Oculus Integration or the Meta XR All-in-One SDK.

    Oddly enough, when I removed the Oculus folder, expecting no impact since I wasn't using the Oculus Integration package, my frame rate dropped from 72fps to 62fps. After some investigation, I identified the culprit as the Assets/Oculus/VR/Plugins/1.85.0/AndroidOpenXR/OVRPlugin.aar file. Strangely, deleting this folder decreases my app's frame rate, despite not actively utilizing OpenXR in XR Plugin Management.

    While I can maintain this folder for the time being, I anticipate migrating to the Meta XR All-in-One SDK eventually.

    1. Can anyone shed light on this unexpected behaviour?
    2. Additionally, is there a recommended approach to enhance the frame rate beyond 72fps using the XR Interaction Toolkit? I've already enabled 120Hz in the Oculus app.

    Your insights and suggestions are greatly appreciated. Thank you!

    Versions
    Unity 2022.3.17f1
    XR Plugin Managment 4.4.1
    Oculus XR Plugin 4.1.2
    XR Interaction toolkit 2.5.2
     
    Last edited: Jan 17, 2024
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,042
    I don't know why performance decreased. Maybe it stored some optimizations?

    To start set the fps to 90 (120 often is not realistic)
    If you want to boost performance run the profiler in builds and see where performance goes
     
    rahulchawla2801 likes this.
  3. rahulchawla2801

    rahulchawla2801

    Joined:
    Oct 5, 2021
    Posts:
    34
    Part 1: OVR Plugin Issue

    I tried updating OVRPlugin from 1.85.0 to 1.89.0 and also Meta XR Core SDK; both resulted in a performance drop from initial 72fps to ~63fps.

    Upon analyzing the profiler in all three cases (1.85.0, 1.89.0, Meta XR Core SDK), EarlyUpdate.XRUpdate and PostLateUpdate.FinishFrameRendering in the player loop was consuming the maximum compute in all cases, with EarlyUpdate.XRUpdate accounts for approximately 60%.

    Some observations
    1. In all scenarios, deactivating game objects with heavy textures caused the fps to stabilize at 72.
    2. Attempting texture optimization through ETC2 8-bit compression yielded no noticeable difference.
    3. Reducing MSAA from 8x to disabled significantly improved performance, bringing fps closer to 72.


    Part 2: Increasing/Setting fps

    I know it is a separate question but how exactly to set increased fps?

    I tried manipulating values of Application.targetFrameRate and OVRPlugin.systemDisplayFrequency, it seems Application.targetFrameRate doesn’t seem to affect anything.

    Some observations and pointers with OVRPlugin.systemDisplayFrequency manipulations
    1. If the OVRPlugin.systemDisplayFrequency is set to 72, fps does not exceed 72
    2. If the OVRPlugin.systemDisplayFrequency is set to 90, fps goes beyond 72, either by deactivating gameobjects with heavy textures or disabling MSAA.
    3. OVRPlugin.systemDisplayFrequency seems to dictate the maximum fps.
    4. Increasing OVRPlugin.systemDisplayFrequency exhibits diminishing returns on the game feel. A scenario where FPS is around 72, matching the display at 72Hz, feels superior to achieving FPS around 80 with a display set at 90Hz

    Optimising textures will help with fps, but I don’t how I can do that without affecting quality too much.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,042
    Yes a stable fps is more desirable than an unstable higher fps.
    You can check in OVRMetrics if you are cpu or gpu bound, but 90% sure it will be GPU.
    You can use FFR and some oculus optimisations to increase performance.

    If you are new to Unity, here are some videos to get started



    There are many more optimisations, like using simple lit/mobile shaders, texture atlassing, LODs, batching, and more
     
    rahulchawla2801 likes this.
  5. rahulchawla2801

    rahulchawla2801

    Joined:
    Oct 5, 2021
    Posts:
    34
    Thank you.

    I've managed to improve fps to ~88 on a 90Hz display by implementing two key changes:
    1. Switching from Vulkan to OpenGL.
    2. Adjusting the processor settings to favor the GPU in the OculusProjectConfig.

    I still can’t figure out why display frequency is dictating the ceiling limit for frame rate. I want to limit the display at 72hz and let my fps go ~90. That experience will be really smooth.

    Any approach for this?
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,042
    VR headsets force VSync. It does not work like normal platforms. If you have a steady 72, that is good. If you would generate 90 frames on 72hz, there would be screen tearing or some frametime inconsistencies.
    Also, did you enable the vulkan performance improvements in the Oculus XR plugin?
    If so, could you file a bug report about opengl performing better than vulkan?
     
    rahulchawla2801 likes this.
  7. rahulchawla2801

    rahulchawla2801

    Joined:
    Oct 5, 2021
    Posts:
    34
    Thank you for your help.

    I have enabled necessary Vulkan configurations in Oculus XR Plugin, such as Optimize buffer Discards, Symmetric Projection, Subsampled Layout, etc.

    Not being lazy, I just think there is something on my end that I am doing wrong, causing Vulkan not to perform as well as OpenGL. I need to find that.

    If it continues to be the case, I will file a bug report.
     
    DevDunk likes this.
  8. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,042
    You can check my application spacewarp project for some baseline settings maybe: https://github.com/smitdylan2001/ApplicationSpaceWarp/tree/2021.3
    It's pretty optimized. In up to date unity versions you can also enable graphics jobs for a small boost on vulkan

    But if the only difference between the performance is vulkan on or off that sounds like a bug. The unity team does not have many reproduction projects for performance issues, so everything is welcome