Search Unity

Bug Can't Enable FFR w/ URP - Oculus Quest 2

Discussion in 'VR' started by Zaflores, Mar 13, 2023.

  1. Zaflores

    Zaflores

    Joined:
    Sep 23, 2017
    Posts:
    10
    Hello!

    Unity Version 2021.3.4f1.
    URP version 12.1.7

    I am working on a VR game for the Oculus Quest 2 using URP and we are having trouble enabling FFR for our title as we're currently GPU bound and would like to have FFR working so we're able to accurately profile our game using all the features we can.

    I'm aware there are a number of things that can break FFR, but I don't believe we're doing any of them. No post processing, disabled depth texture/opaque texture in URP settings object, etc.

    Is there a best way to figure out what's disabling FFR in our project? I'm launching a scene that isn't currently running at 72 FPS and using the command adb shell setprop debug.oculus.foveation.level 4 to try and force FFR on but it makes no difference.

    Any advice on how I can debug this?

    Zach
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    I think you are missing some info
     
  3. Zaflores

    Zaflores

    Joined:
    Sep 23, 2017
    Posts:
    10
    Hi! Sorry The post has been updated with all the correct information, Made a typo and submitted the issue while trying to fix it.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    Make sure you use the oculus xr plugin and oculus integration and call ffr via code instead of adb commands. Are you using OVRMetrics to check FFR level?

    Also, definitely update unity to the latest LTS for a good performance bump as well :)
     
    Zaflores likes this.
  5. Zaflores

    Zaflores

    Joined:
    Sep 23, 2017
    Posts:
    10
    Yes!

    I am using the Oculus XR Plugin and not OpenXR, and I am attempting to enable FFR via code.

    My code for enabling FFR looks like this:
    Code (CSharp):
    1.  
    2. public class EnableFoveated : MonoBehaviour
    3. {
    4.     private void Awake()
    5.     {
    6.         InputFocusAquired();
    7.         OVRManager.InputFocusAcquired += InputFocusAquired;
    8.     }
    9.  
    10.     void InputFocusAquired()
    11.     {
    12.         OVRManager.foveatedRenderingLevel = OVRManager.FoveatedRenderingLevel.HighTop;
    13.         OVRManager.useDynamicFoveatedRendering = true;
    14.     }
    15. }
    I added the FFR level to my OVR graph and it looks like this script isn't correctly setting the foveation level however the ADB command does trigger the foveation level to increase to the specified amount (however I'm seeing no difference in visual quality despite trying to set FFR to the max level, and no changes in FPS graph in OVR metrics tool)
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    Does the code even run?
     
  7. Zaflores

    Zaflores

    Joined:
    Sep 23, 2017
    Posts:
    10
    Yes!

    I was actually able to fix the foveation not being set by changing the code to the following:

    Code (CSharp):
    1.         OVRManager.foveatedRenderingLevel = OVRManager.FoveatedRenderingLevel.Low;
    2.         OVRManager.foveatedRenderingLevel = OVRManager.FoveatedRenderingLevel.HighTop;
    3.         OVRManager.useDynamicFoveatedRendering = true;
    I saw somewhere it was a bug that a cached value was being used and that by changing the value twice you could set it to the appropriate level. The foveation level is now reflected in the OVRMetricsTool however I am not seeing any sort of visual difference still. I have yet to verify this with a GPU capture in RenderDoc (which will be my next step) but with the level set to HighTop there should be some pretty obvious visual difference with foveation on, I believe
     
  8. Zaflores

    Zaflores

    Joined:
    Sep 23, 2017
    Posts:
    10
    Apparently FFR only works with Vulkan!

    Switched the graphics API to auto graphics API and things are running a lot better.
    Maybe this could be added into the oculus package as a warning, because I was stuck on this for quite a while. Hope this is useful to someone!

    Zach
     
  9. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    If it's said nowhere make a bug report
     
  10. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    FFR with OpenGL stopped working since URP 10.10.1.

    I'm working on a OpenGL project using URP 12.1.8, and FFR is not visible at all regardless of the level, despite the Overlay Tool shows the correct FFR number. Changing DynamicFFR or Intermediate Texture options does not help.
     
  11. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    File a bug report, otherwise it won't be fixed
     
    Zaflores likes this.
  12. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
  13. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    Disable dynamic ffr and set it to high. If it doesn't work it's different than the bug report, as the solution there was that it was on dynamic reading the reply
     
  14. justdizzy

    justdizzy

    Joined:
    Mar 8, 2016
    Posts:
    89
    What are these? Im using Unity 2022.3.4 URP (default performant settings), Vulcan API only, I set dynamic to false to manually control switching, and when I trigger it, I can see the FOV changing in OVRMetrics but I'm not visually seeing any difference. I am using OpenXR plugin but if OculusXR was required I would expect the FOV settings to not change.
     
  15. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    FYI use "OVRPlugin" instead of "OVRManager" to set "foveatedRenderingLevel" etc then it works with GLES3.
    Code (CSharp):
    1. OVRPlugin.foveatedRenderingLevel = OVRPlugin.FoveatedRenderingLevel.HighTop;
    2. OVRPlugin.useDynamicFoveatedRendering = false;
    Oculus has major bugs going on right now. Vulkan is also slow as hell.
     
  16. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    310
    That message is months old now, but I reverted that project to Unity 2020 using URP 10.10.0 and everything worked as expected. Using Unity 2021+ was not viable back then due to massive performance issues.
     
  17. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    BTW spent the entire yesterday trying to figure out what was going on with Quest & Vulkan (tested OculusXR vs OpenXR loaders or combinations of both and settings etc). Turns out URP simply breaks Quest performance if you enable Vulkan. GLES3 it works fine. Or BuiltInRP runs smooth on Quest with Vulkan too. Tested multiple versions but settled on 2023.1.11 for now as 2022 has URP performance issues according to release notes.

    Pico 3/4 with URP and Vulkan run smooth as butter. Ever since this OpenXR junk things have gotten worse with Quest.
    Now we have a released game built on URP with these issues. I actually wonder if making a custom Quest loader wouldn't just fix the URP issues as Pico is totally fine here. Otherwise long run need to convert URP shaders to BuiltInRP as Meta clearly is not testing their stuff for URP.

    Just posting this for others.
     
    DevDunk likes this.
  18. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    It can also be that meta has different results. I just did some testing as well and had no issues with vulkan in urp whatsoever.
    Bug reports for stuff like this are always welcome
     
  19. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    Do you have TMP text to your scene?
    A basic scene with almost nothing in it might run fine.
     
  20. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    I used some random models to increase gpu usage. I also measured gpu utelization, which was similar across versions
     
  21. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    Ok so did some more tests. MSAA on is the core thing slowing down URP on Quest with Vulkan.
    With AA off I think Vulkan wins. Whatever this issue is someone at Unity3D probably need to look into this.

    I imagine this is a MSAA texture resolve bug in URP that somehow effects Quest (also notice this with Pico now too). Is URP passing Quest/Pico APIs a MSAA texture or a resolved one? PLEASE can someone on Unity3D take a look?

    Testing with: Unity 2023.1.11
     
    Last edited: Sep 7, 2023
  22. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    I tested 2022lts and 2023.3, which performed good. I also tested with vulkan and msaa.
    For the depth settings on the urp asset, did you use force prepass?

    Also if you make a bug report it can be tested by QA so it can be fixed if they can reproduce it
     
    zezba9000 likes this.
  23. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    Setting this to Forced solve the issue in part.
    * GLES3 is still faster
    * Splash Image no longer renders
    upload_2023-9-7_1-22-24.png
     
  24. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
    Put the priming mode to auto or disabled (or if forced works better that's interesting) and the depth texture mode to force prepass.
    Got them mixed up.
     
  25. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    What option are you setting for Depth PrePass in URP? (As I thought this is what "Depth Priming Mode" was?)
     
    Last edited: Sep 7, 2023
  26. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    992
    Do you mind sharing your URP settings?
    Here are mine for reference targeting GLES3.

    upload_2023-9-7_2-40-18.png upload_2023-9-7_2-40-1.png

    upload_2023-9-7_2-39-42.png
     
  27. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
  28. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,057
  29. djarcas

    djarcas

    Joined:
    Nov 15, 2012
    Posts:
    246
    I've got the same issue - I can't get FFR to work, under OGL or Vulkan. I'm running out of alternatives to call!


    Code (CSharp):
    1.       if (Time.realtimeSinceStartup % 4f < 2f)
    2.         {
    3.             Unity.XR.Oculus.Utils.foveatedRenderingLevel = 4;
    4.  
    5.             OVRPlugin.foveatedRenderingLevel = OVRPlugin.FoveatedRenderingLevel.HighTop;
    6.             OVRPlugin.useDynamicFoveatedRendering = true;
    7.  
    8.             OVRManager.foveatedRenderingLevel = OVRManager.FoveatedRenderingLevel.HighTop;
    9.             OVRManager.useDynamicFoveatedRendering = true;
    10.         }
    11.         else
    12.         {
    13.  
    14.             OVRPlugin.foveatedRenderingLevel = OVRPlugin.FoveatedRenderingLevel.Off;
    15.             OVRPlugin.useDynamicFoveatedRendering = false;
    16.  
    17.             Unity.XR.Oculus.Utils.foveatedRenderingLevel = 0;
    18.             OVRManager.foveatedRenderingLevel = OVRManager.FoveatedRenderingLevel.Off;
    19.             OVRManager.useDynamicFoveatedRendering = false;
    20.         }
     
  30. Timtaotao

    Timtaotao

    Joined:
    Sep 13, 2019
    Posts:
    12
    I am trying to use FFR since my project is FILL bound and I'm expecting FFR to boost the performance. I managed to enable FFR, or at least OVR metrics and VrApi info tell me that. However I can't notice rendering quality decline at the peripheral, furthermore, the FPS is almost the same in a somewhat intense scene around 60, no matter how I change the FFR level. My Unity version is 2022.3.8 and URP version is 14.0.8. I'm using OpenXR plugin provider with Meta Foveated and Meta Features checked, and the OVR integration is the latest v57.

    Besides, I just can not be sure whether I have successfully enabled FFR, maybe the OVR metrics just gives me false information since no Visual artifacts are noticed by me.

    Can anyone help me? Cheers.
     
  31. Timtaotao

    Timtaotao

    Joined:
    Sep 13, 2019
    Posts:
    12
    I have encoutered similar issue, have you figured it out yet? Thanks