I’m developing a Vive game with Unity using the standard settings of SteamVR, without the lab renderer. On the whole, I get good frame rates, but every now and then (10-20 seconds), there is a drop down below 60fps.
This even happens if the headset is lying still on the floor and the controllers are off. There is no indication in the profiler that anything else except graphics is to blame, as it looks like this:
Also, all the time is reported to be spent in VR.WaitForGPU (and, given the yellow color, in VSync). Am I correct in assuming that says that the CPU is waiting for the GPU to finish operations, and if the GPU doesn’t manage within its allocated time for the frame (11ms for 90fps) a drop will occur?
The spikes can be seen in the SteamVR performance frame timing view, too.
Further investigation seems to indicate that, contrary to what the Unity profiler suggests, this seems to be a CPU issue (the frame-by-frame analysis of the SteamVR performance chart shows a CPU spike before the GPU spike)
It is still unclear what is causing this, exactly.
However: For me, the issue goes away entirely when creating a standalone build and running that - i.e., not starting the game from within Unity. The game stays at ~6ms per frame then (measured by SteamVR performance frame timing).
This is still very annoying since testing the game is tedious. An interesting question now is whether this is a “pure” Unity problem or a SteamVR/OpenVR-In-Unity problem. If Unity is entirely to blame I would expect this to happen in non-VR projects as well. If any Non-VR Unity developers are listening and have this same issue, I’d appreciate a heads-up. Otherwise, this may be an issue with the VR integration.
FYI I’ve seen similar spiking behavior on GearVR - still looking for a solution. Will post if I find one although it may not cross-apply since mine is not vsync related.
We also have this issue and is a major roadblock in our development right now (using Vive). We thought it was initially our terrain shaders as this only happens when you look down at a 60 degree angle. For some reason, no matter what terrain shader or texture combo we use, we can maintain 89 fps until we look at the ground at a 60 degree angle. At this point FPS drops to a locked 44 and in profiler we get VR.WaitForGPU. My framerate will not go back up until I look away from the angle, and then at that point the VR.WaitForGPU goes away and FPS is butter smooth at 89 again. No combo of shaders or textures changes this, I can have my terrain with a blank material on it, butter smooth until I look down at that one angle, and then BOOM 44 fps.
Does it happen in the build? From the sound of things so far this goes away in the build. The source seems to be that the CPU takes too long, then has to wait for the GPU to finish the frame late. But… There really isn’t enough hard information to confirm that, it also really depends on your own profiling.
Technically you will always see the CPU and GPU waiting for each other at some point, the goal is to just make them both do their work fast enough and have the load distributed evenly so that neither is the bottleneck. Seems like VR.WaitForGPU is a little too ambiguous to apply to every project in some generic way as it could be caused by both CPU or GPU which means more contextual profiling is required to find the source of the problem.
In your case, it could be a slew of other things in your project. Do more specific profiling, then maybe restart with a blank scene and add features until it presents itself more clearly.
We have it set to Deep profile already and no additional details. It happens in the build. I’ve also been trouble shooting this for 2 1/2 weeks already (on and off of course). Its not shaders, its not scene objects. I’m down to a blank hill. Walk around and cant get under 89fps… until I look at the ground at an about 60 degree angle. Of course the area that does this is sloped… its almost like opposite converging angles. I’m looking down at 45-60 degree at a 40-60 degree opposite slope.
This is killing our development process on a daily process. I cannot get away from this blasted awful weirdness. Standing still on a terrain with nothing in the environment, not moving. I look at one hill 89fps, I turn around and look at a different one and I’m stuck at 44FPS, VR.WaitForGPU/VR.DeviceSDK and it might as well be called VR.PermanentlyStuckFucked because there is no wait about it, it will never stop doing this, its just indefinitely waiting for something that will never happen. My FPS will never go back up. The other thing that grinds my gears is the whole, I can only have 89 or 44, there is no in-between besides when I’m walking and the occasional drop to 71 or 75. However, whenever there is a problem, its always immediately locked into, 44FPS with that awful message in profiler that obviously is confusing since I keep finding threads with the same problem and rarely a solution. This one right here has it at 72.8% and 14ms :(.
I’m also having odd FPS issues. Before I added VR to my level, I was having shotty FPS despite having an Asus 1080 ROG STRIX and Intel i7-7700K… What I read somewhere is that if I added the following line of code, it would help.
QualitySettings.vSyncCount = 0;
So I created an empty script and on Start(), I added that line of code. Attached the script to my terrain. POOF! FPS went through the roof.
However, SteamVR looks to have their own way of doing things and that script does not have any impact with my Vive gear.
What I’m wondering is, does SteamVR throttle their FPS to 90? I don’t think I’ve ever gotten a FPS above that.
But, I’m here also looking to see what’s going on with WaitForGPU. I will admit, I have kind of an ambitious level for VR. Lots of vertexes. I have not really noticed the 60 degree issue. But, have not looked for it either.
Hahaha, well I’m glad someone got a good laugh. I meant to post this 2 nights ago - I sorted this out to a degree.
There is still an angle issue. I cannot tilt the headset on its side or my FPS instantly drops to 44. However, I realized that my terrain LOD system could be reduced in the distance. Come to find out, it was the hill BEHIND the hill I was looking directly at that was causing the instant lock up. Reduced my LOD for stuff in the distance and boom, back to 89. I still occasionally have the weird angle thing but its much more rare now. However, maybe this speaks again to the issue about this sort of blanket catch all message in the profiler when there is an issue. I get the same “VR.WaitForGPU” message if I have too much grass in the scene, if there are too many trees with shadows, if I have distance replace on any terrain shader and who knows what else. I know its still early in VR but man, this needs to be tightened up.
Thanks for the tip about hard coding some sort of vsync setting. I have not seen above 90 fps myself.
After having worked on multiple projects, I’m now having this issue. My scene is nothing but 8 cubes and a plane, and even with VSync disabled (through script or the editor), it takes up 90% of the CPU usage in the Profiler. Does anyone have ideas about what could be causing this??
I’m seeing the same issue I think? Mine seems to come from a sudden drop of WaitGetPoses causing the 44fps pegged value drop and then suddenly back up to 89fps. Over and over it does this. I see mine in the build which really sucks.
Unity 5.5.3, vSyncCount = 0 (essentially off in code and in editor), renderScale = 1 …
Oddly enough I don’t see the issue if I use quality setting of (Unity stock “Fastest” or “Fast”)
Here is a trace of what I’m seeing if it helps (Unity stock quality setting “Simple”)
Update:
I have been using Aquas-Lite for an ocean with islands. If I remove the Water then I never see this issue up until quality level Unity stock “Good”. Quality levels “Fastest”, “Fast”, “Simple” all show no issue. “Good” shows the issue but very infrequently.
So this is interesting and frustrating at the same time.
Was banging my head on this for a while too… for me it turned out to be steam VR settings. I had both ‘Allow asynchronous reprojection’ & ‘allow interleaved reprojection’ checked on. I unchecked interleaved and my fps doubled.
But who knows… I didn’t change anything and now my fps is dropping again 20 minutes later. Before the above post, I was getting 48fps due to mysterious vsync operations. I made the change and it went up to 90+ fps. Now it’s back down to low 60-70s at best. No changes made. Super frustrating and obviously no rhyme or reason for this shit.
GFX 1080 TI
Unity 2017.2
I’ve seen this kind of thing happen a lot in the editor, when the overhead of the editor slows things down to the point where the Vive drops frames and the WaitForGPU thing starts happening. But not I’m having the same problem with my game even when I build it. It happens even right after I start my game when I’m simply displaying a simple menu. So there are no heavy scripts, large # of objects, or physics happening, so there shouldn’t be anything in my game causing this to happen. See below how XR.WaitForGPU is pegged out taking 29ms. What I’ve found is that this problem turns on somewhat randomly (it doesn’t always happen when I start my game), and it also disappears randomly. I’ve noticed that sometimes when I move our maximize my game windows, that this can sometimes cause the problem to go away. This is a built Vive game (Unity 2017.3.1p1). I’m banging my head trying to figure out a way to prevent this from happening, but as far as I can tell this is a Unity bug. There’s at least 1 other thread where a few people are discussing this, but I don’t have the link handy to post. Super frustrating though.