From 91bf00d28d12d86f2c98f74c894111bcc2037f57 Mon Sep 17 00:00:00 2001 From: Mike Miller Date: Thu, 22 Apr 2021 08:08:21 +0300 Subject: [PATCH] Enable 90Hz mode for Oculus --- Assets/Scripts/VrSdk.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Assets/Scripts/VrSdk.cs b/Assets/Scripts/VrSdk.cs index 13a5d0dd7d..cb63dd2a38 100644 --- a/Assets/Scripts/VrSdk.cs +++ b/Assets/Scripts/VrSdk.cs @@ -192,6 +192,17 @@ void Awake() manager.useRecommendedMSAALevel = false; SetControllerStyle(TiltBrush.ControllerStyle.OculusTouch); + + // Set 90Hz if possible. To see the current framerate, look in the logs for prints like this one. The first number is the frame rate, the second is the display refresh rate + // VrApi : FPS=90/90,Prd=33ms,Tear=0,Early=0... + float[] freqs = OVRManager.display.displayFrequenciesAvailable; + Debug.Log($"Supported frequencies are: {freqs}"); + if (Array.Exists(freqs, element => element == 90.0f)) + { + OVRPlugin.systemDisplayFrequency = 90.0f; + } + OVRManager.DisplayRefreshRateChanged += DisplayRefreshRateChanged; + // adding components to the VR Camera needed for fading view and getting controller poses. m_VrCamera.gameObject.AddComponent(); m_VrCamera.gameObject.AddComponent(); @@ -339,6 +350,13 @@ private void OnInputFocus(params object[] args) m_HasVrFocus = (bool)args[0]; } +#if OCULUS_SUPPORTED + private void DisplayRefreshRateChanged (float fromRefreshRate, float ToRefreshRate) + { + Debug.LogWarning(string.Format("Refresh rate changed from {0} to {1}", fromRefreshRate, ToRefreshRate)); + } +#endif + private void OnNewPoses() { if (NewControllerPosesApplied != null)