Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question 90hz for Quest 2

Discussion in 'VR' started by Gigglebooster, Nov 16, 2020.

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

    Gigglebooster

    Joined:
    Jan 24, 2019
    Posts:
    27
  2. korinVR

    korinVR

    Joined:
    Jul 7, 2012
    Posts:
    34
    You can just do this.
    Code (CSharp):
    1.  
    2. OVRManager.display.displayFrequency = 90f;
    3.  
    And if you want to check the availability of 90Hz:
    Code (CSharp):
    1.  
    2. using System.Linq;
    3. ...
    4. if (OVRManager.display.displayFrequenciesAvailable.Contains(90f))
    5. {
    6.     OVRManager.display.displayFrequency = 90f;
    7. }
    8.  
    You can watch the current refresh rate using Android Logcat or OVR Metrics Tool.
     
  3. Gigglebooster

    Gigglebooster

    Joined:
    Jan 24, 2019
    Posts:
    27
    Oh wow so much easier, thanks!
     
  4. Gigglebooster

    Gigglebooster

    Joined:
    Jan 24, 2019
    Posts:
    27

    Is there a different way I would need to do this if I'm using the XR Interaction Toolkit? I'm trying to make a script that references the OVRManager but I don't have access to it. Do I need to install the Oculus Integration Plugin, or can I set the frame rate using just the Oculus XR plugin that comes with the XR Interaction toolkit?
     
    Last edited: Nov 17, 2020
  5. Gigglebooster

    Gigglebooster

    Joined:
    Jan 24, 2019
    Posts:
    27
    If I do OVRPlugin.GetAppFramerate(); and it returns 90 does that mean the frame rate is hitting 90 without making any changes? I'm not adjusting the framerate at all but it returns 90 if I have 90hz set in the device settings Oculus app, does this mean I don't need to adjust anything in my project to get it running at 90hz?
     
  6. WobblyRampack

    WobblyRampack

    Joined:
    Nov 24, 2012
    Posts:
    7
    I'm also interested in how you target 90hz when you are using the XR Interaction Toolkit rather than Oculus Integration Plugin. Is that even possible right now?
     
    BrainSlugs83 likes this.
  7. wm-VR

    wm-VR

    Joined:
    Aug 17, 2014
    Posts:
    123
    I am also using the XR toolkit. Is there a workaround to enable 90hz?
     
    BrainSlugs83 likes this.
  8. jj-unity

    jj-unity

    Unity Technologies

    Joined:
    Jan 4, 2017
    Posts:
    74
    You can get this support by using the latest version of the Oculus integration asset from the store. We also will have support for this in the 1.7.0-preview.2 version of the Oculus XR Plugin which has no definite date, but will hopefully release soon.
     
  9. wm-VR

    wm-VR

    Joined:
    Aug 17, 2014
    Posts:
    123
    Is it possible to use both frameworks simultaneously (UnityXR for my game mechanics, Oculus integration to enable 90hz)?

    I am working on a project completely based on XR
     
  10. jj-unity

    jj-unity

    Unity Technologies

    Joined:
    Jan 4, 2017
    Posts:
    74
    Yes, that is a pretty typical configuration.
     
  11. Dondosh2

    Dondosh2

    Joined:
    Dec 21, 2013
    Posts:
    5
    Any news ? It's heavy to have the complete integration package to be able to call one line of code :(
    Thanks!
     
    BrainSlugs83 likes this.
  12. JLeybovichLFL

    JLeybovichLFL

    Joined:
    Jan 21, 2021
    Posts:
    2

    jj-unity Im using the latest 1.7.0 stable release of the Oculus XR package and have no idea how to call TrySetRefreshRate, does not seem to be exposed. Any advice?
     
  13. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,815
    Hey hey! Wanted to pass along that Oculus XR Plugin 1.7.0-preview.2 is available now.
     
  14. JLeybovichLFL

    JLeybovichLFL

    Joined:
    Jan 21, 2021
    Posts:
    2
  15. The-Real-Zap

    The-Real-Zap

    Joined:
    Jan 23, 2015
    Posts:
    7
    Those Unity guys don't seem able to answer the simplest of questions as well as fix the errors in the changelog.

    The relevant refresh rate methods are in the Unity.XR.Oculus.Performance static class.
     
  16. amaestas

    amaestas

    Unity Technologies

    Joined:
    Feb 5, 2020
    Posts:
    18
    Hey all,

    So as of 1.7.0 we expose 3 methods for dealing with refresh rate. Keep in mind that for 90hz to work you need to make sure Quest 2 is checked under the Target Devices heading in the Oculus Settings under XR Management.

    Also should you try and set the refresh rate this tells the oculus system your intent but its up to it to actually change the refresh rate. This could mean you will have to wait a few frames before the frame rate will actually change and is reflected if you call TryGetDisplayRefreshRate,


    float[] rates;
    Unity.XR.Oculus.Performance.TryGetAvailableDisplayRefreshRates(out rates);

    Unity.XR.Oculus.Performance.TrySetDisplayRefreshRate(90);

    float rate;
    Unity.XR.Oculus.Performance.TryGetDisplayRefreshRate(out rate);

    Ill get the feedback back to the team as to expanding docs and examples.
     
  17. BrainSlugs83

    BrainSlugs83

    Joined:
    Jun 18, 2015
    Posts:
    38
    OH MY GOSH. THANK YOU SO MUCH!!
    (I'm typing in caps, because I'm shouting.)

    Here's some code I threw together to set 90hz (I tested on the Quest 1 and 2 with 1.7.0 installed and both headsets checked in the settings -- obviously the Quest 1 can't be set to 90hz, but it isn't causing any problems either).
    Code (CSharp):
    1.  
    2. if (Unity.XR.Oculus.Performance.TryGetDisplayRefreshRate(out var rate))
    3. {
    4.     float newRate = 90f; // fallback to this value if the query fails.
    5.     if (Unity.XR.Oculus.Performance.TryGetAvailableDisplayRefreshRates(out var rates))
    6.     {
    7.         newRate = rates.Max();
    8.     }
    9.     if (rate < newRate)
    10.     {
    11.         if (Unity.XR.Oculus.Performance.TrySetDisplayRefreshRate(newRate))
    12.         {
    13.             Time.fixedDeltaTime = 1f / newRate;
    14.             Time.maximumDeltaTime = 1f / newRate;
    15.         }
    16.     }
    17. }
    18.  
    I'm running the above check about once a second in a co-routine -- because with android sometimes apps can lose focus (i.e. if the user steps out of them for some reason), and who knows what the state of things will be when the user gets back into the app.
     
  18. Danielsantalla

    Danielsantalla

    Joined:
    Jan 7, 2015
    Posts:
    75
    noob question here. what's that Max() doing?
     
  19. Gelsongoes

    Gelsongoes

    Joined:
    Jan 13, 2020
    Posts:
    2
    Returns the maximum value in sequnce of nullable Single values. To remove the error, you just need to include the library:
    System.Linq;
     
Thread Status:
Not open for further replies.