Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Question Sudden development of intermittent lag in play-mode and builds with no change to project (Solved?)

Discussion in 'VR' started by Charlicopter, Mar 31, 2023.

  1. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    122
    I've been working on a PCVR title for a few years now (OpenXR + 2021.3.18f1 and an experimental port to 2021.3.22f1 for diagnostics on this problem) - Performance has been butter smooth on 1070's, 2060's, and 3080's, and on every processor I could get my hands on, up til a few days ago.

    The other day, I opened the project (no prior changes to settings, code, or version) and it just randomly started having lag issues which persist to this day. The lag comes in random waves every 30 - 120 seconds (ish) that halve the framerate for ~0.2 second pulses.

    The profiler doesn't indicate any cause for the lag - it just shows the spike in render performance through Semaphore.WaitForSignal (which is useless)

    I updated all my drivers to no avail.

    My fear is that it is some kind of black-box anomaly with Unity, but am also considering the possibility that it could be SteamVR or something.

    Has anyone else experienced this problem?
     
  2. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    122
  3. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    122
    Digging into this deeper, it looks like SteamVR is throttling its output unnecessarily. My testers have independently verified the problem remotely, so it's not just my machine.

    Has anyone else experienced this?

    SteamVR Throttling Bug - Detailed - Small.png SteamVR Throttling Bug - Small.png
     
  4. Charlicopter

    Charlicopter

    Joined:
    May 15, 2017
    Posts:
    122
    Likely answer for anyone running into this issue:

    After a few days of testing and research, I've more or less come to the conclusion that this is indeed a problem stemming from SteamVR. The issue is that it is unnecessarily "Throttling" frames - cutting the framerate in half and injecting synthetic frames between actual frames to keep it smooth and to create the illusion that it is still running at the intended framerate. Normally this would be triggered if the application was outstripping the GPU and dropping frames. In my case (and in the case of everyone using my application) SteamVR is doing this randomly and inappropriately, when the application is running perfectly smooth otherwise. This can be seen in the graphs I posted above. The Application load is almost totally flat, with about 200% overhead idle time available to render per-frame. But there is a spike in throttling that cuts the framerate in half for around half a second. This throttling spike occurs in random intervals during runtime and just kind of...does that sometimes.

    I was able to verify this by disabling the Throttling Behavior in the Advanced Settings of the Video settings inside SteamVR. I simply disabled throttling and the application became butter smooth.

    This issue became apparent after the 1.25.7 SteamVR update.
     
    pierre92nicot likes this.
  5. NotQuiteSmith

    NotQuiteSmith

    Joined:
    Oct 27, 2013
    Posts:
    92
    I think I'm seeing something similar. Also getting weird 5ms blocks of time allocated to "QualitySettings.set_maxQueuedFrames" (possibly something to do with the Unity SteamVR code running "QualitySettings.maxQueuedFrames = -1;" in SteamVR_Render.Update()?

    Any idea why I can't see any "throttling" setting in Advanced/Video in SteamVR? Would love to see if that makes a difference.