Lately I have run into a really big problem. Stomach churning, throw the rift off my head, reach for a bucket, awful lag and it has nothing to do with the frame rate.
There is no choppyness associated with this lag, if anything head tracking goes "extra smooth". For instance, if you roll or nod your head, the camera lags behind, to the point where you can almost get the camera to stay stationary why your are rolling/nodding (and if you do it to much.. reaching for a bucket).
The two times I have noticed it was 1) I had loads of particles on screen, forward rendering. The weird part is, I had equal amounts of particles in all direction, but the horrible lag only occurred when I looked in one direction. If anything, there where less particles where the lag happens...
2) Point light, deferred lighting. Lots of calculations here, lots of shadows being thrown around, but zero drop in frame rate, just this horrible smooth lag.
Is it just me?
Any help fixing this, or at least ways to avoid it would be greatly appreciated!
Thanks
edited to make the subject line more relevant to the topic
0
Comments
Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
So this time, I intentionally got the frame rate to dip from 60 fps to 50 fps, and a tiny bit of lag on hand movements, but it is like you would expect. The bad news is that it made the head tracking lag MUCH worse, it is unbearable
I should also say that 95% of the time everything works fine, and when there is framerate dips the rift reacts like you would expect with <60 fps. Normal choppyness. But this problem seems to be pretty different
Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
Later on, I'll back everything up, and try it without 11.
In the long run, that is a bad solution for me though, because I am using tc particles (which requires dx11)
But still, Ill try it out just to see if that is the problem
I really hope there is a fix to this soon (I'm not sure if it is a Unity DX11 issue or a Rift SDK issue). I also depend on DX11 and I have to choose between unacceptable latency that will make people ill or reduced visual quality due to tearing. Not a good choice.
I have the latency tester and I found it registers 60ms with vsync on and 20ms with it off. The difference is huge in terms of head response (I can see why VR failed in the past). FPS is pegged at 60FPS with vsync on and ~110FPS with vsync off.
DX9 with vsync on doesn't have the same issue.
I have tried many things to eliminate latency with DX11 with vsync on and none seem to matter. Driver settings don't seem to make a difference (except the one that forces vsync off).
Here is another thread that talks about this:
viewtopic.php?f=37&t=5594
ccs
It appears to be a Unity bug with DX11. Essentially QualitySettings.maxQueuedFrames is not working with DX11. It doesn't matter what you set it to, the latency result is always the same. I filed a bug on Unity to see if they can fix it.
Fortunately there is a workaround (at least for Nvidia cards). I have an Nvidia GTX 760 and in the driver there is a setting that overrides application max queued frames setting.
I ran some tests with my latency tester just to verify what my eyes and brain were telling me, and it is pretty clear this setting fixes the issue and shows that QualitySettings.maxQueuedFrames is not functional in DX11 (seems to work fine in DX9).
Attached is a picture showing where the override setting is in the Nvidia driver.
ccs
I just tried my project out with Direct X11 disabled, and sure enough, that fixed the problem.
Turned dx11 back on, disabled V sync like you suggested and... WOW! What a HUGE difference in latency, not only with the trouble spots, but just in general.
One thing, I am now getting around 100 - 120 fps so I through in a
just to keep things consistent.
Thanks again, this is some excellent info!
Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV
Just a word of caution to others, you might want to be careful with turning vsync off since it can cause issues with some physics-based objects that are framerate dependent (i.e., certain actions will run at faster speeds than intended).
You should be using 'void FixedUpdate()' to do any physics-based API calls like applying forces to rigidbodies. FixedUpdate runs at a near-fixed time interval and correctly applies forces across frames. You can set FixedUpdate to run at whatever interval you think is appropriate. I find for super-accurate physics, it is best to run at 200 FixedUpdate FPS (you can set this in TimeManager settings with the Fixed Timestamp parameter), but you can also set this lower so it runs below screen refresh (say 30FPS).
Also you should generally multiply time-dependent calculations/forces by Time.deltaTime (for stuff in Update) and Time.fixedDeltaTime (for stuff in FixedUpdate) to make your code framerate independent. This also prevents glitches due to some frames taking longer than others (no game runs perfect 60fps even with vsync on).
ccs
http://forum.unity3d.com/threads/unity-patch-releases.246198/#post-1711628
(none) : Windows Player: Performance improvements including lower latency in DirectX 11 mode.
I confirmed the earlier workaround I posted (forcing max queued frames to 1 in driver) is no longer needed. DX11 still seems to have slightly higher latency than DX9, but it is now usable with vsync on as long as prediction is set around 40-50ms.
Just got my DK2 in, so I'll be moving on to 0.4.0 and see how DX11 is working with the new setup.
ccs
Yes, indeed I was... and I have since updated my code (about a month ago) but I appreciate your helpful advice on this!
That's great news! The bad news is that the new SDK isn't compatible with DX11. Hopefully that will be fixed in the next SDK update
Here is the formula I have found that works:
1. IMPORTANT! turn vsync off in Unity quality settings - direct rift mode will take of this for you - if you have it on it will cap you at 60fps, not 75fps and give you terrible results (edit: for me the project actually crashes on start if vsync was on in quality settings)
2. on the OVRCameraController, uncheck the Time Warp button - i found it sometimes causes juddering and the tracking seems way better with if off!
3. set Rift display mode to direct HMD access in the Oculus configuration tool
4. build & run your project (immediately exit your project when it starts)
5. make sure the oculus configuration tool is closed (camera light should be off)
6. go to your project folder and run the DirectToRift.exe for your project
7. if it crashes - just run it again - it should start on 2nd try
8. if you notice screen tearing or juddering, make sure to exit Unity before running your project
9. if you still notice screen tearing, in the oculus configuration tool, select Tools->Advanced->Restart Service...
10. if you still notice screen tearing, reboot your computer - don't open unity or configuration tool - just try running your project right away)
Obviously Oculus still needs to work out some kinks because you don't get tear-free experience every time, but when it does work, it is really quite amazing.
Ah, ok I got it working now, thanks for the tips! Head tracking is still pretty weird in the editor, but seems to work just fine when I build. I haven't tested it with any heavy duty scenes yet, but it seems pretty good!
spyro
Wish I'd seen this a week ago! Came to the exact same conclusion independently after a bunch of testing. No VSync. No Time Warp. I kill prediction too.
Custom VR App Development
Guided Meditation VR for Rift, Gear, and Go