Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

72Hz Broken on Oculus Go in 2019.1.0b10 (1143835)

Discussion in '2019.1 Beta' started by CaptainScience, Apr 5, 2019.

  1. CaptainScience

    CaptainScience

    Joined:
    Jul 8, 2013
    Posts:
    31
    Oculus Go will no longer switch to 72Hz mode. What I do get is this:

    Code (csharp):
    1.  
    2. VrApi   : vrapi_SetDisplayRefreshRate: display refresh rate supported 72.000000
    3. VrApiService: refresh-rate changed to 72Hz
    4. VrApi   : Set Display(0) Refresh Rate = 72.000000
    5. TimeWarp: WarpSwap: Adjusting vsync display refresh rate 60.000000 -> 72.000000
    6.  
    But then a vsync messaged logged every frame which is new this version.

    Code (csharp):
    1.  
    2. Vsync   : Vsync 10308472:  1 x 16.72 ms (59.86 Hz, at 171807.891)
    3.  
    And the performance stats show that it is rendering at 60fps.

    I tried a few variations of setting (or not setting) the Application.targetFrameRate and QualitySettings.vSyncCount manually, but nothing seems to make a difference. I had some trouble with 2019.1 rendering at half-frame-rate but setting Application.targetFrameRate seemed to resolve it. But now it seems to always end up set to a 60Hz vSync.
     
  2. CaptainScience

    CaptainScience

    Joined:
    Jul 8, 2013
    Posts:
    31
    But, oddly, it successfully switches to 72Hz mode after the HMD goes to sleep and wakes back up. That gets it unstuck, and it starts rendering at 72fps and the "Vsync" messages disappear.
     
  3. GameDevCouple_I

    GameDevCouple_I

    Joined:
    Oct 5, 2013
    Posts:
    1,524
    Report the bug using bug reporter and then post back here with your case number. Just posting in the forums wont get anything done unfortunately
     
    LeonhardP likes this.
  4. CaptainScience

    CaptainScience

    Joined:
    Jul 8, 2013
    Posts:
    31
    I submitted a bug report (case 1143835), but I have found this bug seems to happen even with 2018.3 where I am 99% sure it was working before, so this may be a problem with the newest Oculus Go firmware update.
     
    LeonhardP likes this.
  5. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,470
    How do you enable 72hz in Unity? It's not clear is it something I do through ADB or within Unity? Been looking, I see the doc page but where the heck do I enter it in? https://developer.oculus.com/documentation/mobilesdk/latest/concepts/mobile-72hz/
     
  6. CaptainScience

    CaptainScience

    Joined:
    Jul 8, 2013
    Posts:
    31
    It's a bit tricky because you have to wait until the OVRManager is initialized before it has the list of available frequencies so you have to start a coroutine to wait for that. Here's my initialization script that will set some rendering options, automatically select the highest frequency available, and do an optional fade in.

    Code (csharp):
    1.  
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using UnityEngine;
    5. using OVR;
    6. using UnityEngine.XR;
    7.  
    8. public class InitOVR : MonoBehaviour
    9. {
    10.     public float eyeTextureResolutionScale = 1.0f;
    11.     public OVRManager.TiledMultiResLevel tiledMultiResLevel = OVRManager.TiledMultiResLevel.LMSHigh;
    12.     public bool fadeIn = true;
    13.     public float fadeTime = 3.0f;
    14.     public int gpuLevel = 0;
    15.     public int cpuLevel = 0;
    16.  
    17.     void Start ()
    18.     {      
    19.         if (OVRManager.isHmdPresent)
    20.         {          
    21.             OVRManager.gpuLevel = gpuLevel;
    22.             OVRManager.cpuLevel = cpuLevel;          
    23.             OVRManager.tiledMultiResLevel = tiledMultiResLevel;
    24.             UnityEngine.XR.XRSettings.eyeTextureResolutionScale = eyeTextureResolutionScale;
    25.  
    26.             StartCoroutine(SetMaximumFrequency());
    27.             OVRManager.SetColorScaleAndOffset(Vector4.zero, Vector4.zero, true);
    28.             StartCoroutine(OVRFade(Time.time, fadeTime, Vector4.zero, Vector4.one));
    29.  
    30.             Debug.Log("Eye texture height: " + UnityEngine.XR.XRSettings.eyeTextureHeight);
    31.             Debug.Log("Eye texture width: " + UnityEngine.XR.XRSettings.eyeTextureWidth);
    32.             Debug.Log("Eye texture resolution scale: " + UnityEngine.XR.XRSettings.eyeTextureResolutionScale);
    33.         }      
    34.     }
    35.  
    36.     IEnumerator OVRFade(float startTime, float duration, Vector4 startScale, Vector4 endScale)
    37.     {
    38.         while (Time.time < startTime + duration)
    39.         {
    40.             OVRManager.SetColorScaleAndOffset(Vector4.Lerp(startScale, endScale, (Time.time - startTime) / duration), Vector4.zero, true);
    41.             yield return null;
    42.         }
    43.  
    44.         OVRManager.SetColorScaleAndOffset(endScale, Vector4.zero, true);
    45.     }
    46.  
    47.     IEnumerator SetMaximumFrequency()
    48.     {      
    49.         yield return new WaitUntil(() => OVRManager.display.displayFrequenciesAvailable.Length > 0);
    50.  
    51.         float displayFreq = OVRManager.display.displayFrequency;
    52.  
    53.         Debug.Log("===========================> Old display frequency: " + displayFreq);
    54.  
    55.         foreach (float freq in OVRManager.display.displayFrequenciesAvailable)
    56.         {
    57.             if (freq > displayFreq)
    58.             {
    59.                 displayFreq = freq;
    60.             }
    61.         }
    62.  
    63.         Debug.Log("===========================> Setting new display frequency: " + displayFreq);
    64.         OVRManager.display.displayFrequency = displayFreq;
    65.         Application.targetFrameRate = Mathf.RoundToInt(displayFreq);
    66.     }
    67.  
    68. }
    69.  
    Edit: I think the "Application.targetFrameRate" is not strictly necessary, but it was an attempted workaround for the framerate bug. Unity seems to have addressed the issue so it can probably be removed.
     
    lmbarns likes this.
  7. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    548
    This is an issue in the Unity 2018.4 LTS branch also ...
    XR.XRDevice.refreshRate always report 60hz even after setting both OVRManager and application.targetframerate . Both values even report back the correct 72hz frequency then, only XR.XRDevice.refreshRate is stuck to 60hz, and that is what the output actually is. Until the oculus menu was toggled in or the headset went to sleep and put on again