Search code examples
c#unity-game-engineaugmented-realitygame-developmentvirtual-reality

Is it possible to predict frames dropping with Unity, and before this happens deactivate all but the camera updating to avoid VR sickness?


Since a decent frame rate is so important in VR apps, I was just wondering if you can predict frames dropping? If so, before this issue actually occurs, can you deactivate some scripts or other features except the camera transform's updating and rendering of the environment? So, if performance drops (i.e. frames drop) no nausea will be experienced.


Solution

  • Predicting the future is not very likely, so you're going to have to adapt on the fly when you see performance drop. Either that or you could imagine creating a test environment a user could run where you try and figure out the capabilities of the user's hardware setup and tweak settings accordingly for future actual app runs. (i.e. "the test environment ran below the desired 120fps at medium settings, so default to low from now on")

    I don't know what platform you are on exactly, but just in case you're on the Oculus ecosystem you might be able to get some help however.

    By default on Oculus devices you're supported by what they refer to as "Asynchronous TimeWarp". This in essence decouples the headset's transform update and rendering from the framerate of your application. If no up-to-date frame is available, the latest frame will be transformed based on the latest head tracking information, reducing how noticeable such hiccups are. You will still want to avoid this having to kick in as much as possible though.

    Additionally, Oculus supports "Fixed Foveated Rendering" on their mobile platforms where depending on your GPU utilization the device can render at lower resolutions at the edges of your view. In practice I've found this to be surprisingly effective, even though (as the name implies) it's fixed at the center of the view and does not include any eye tracking. But as with the previous method, not needing it is always better.

    I'm unfortunately less familiar with options on other devices, but I'm sure others will pitch in if those exist.