Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Jittery motion on Oculus Quest

Discussion in 'AR/VR (XR) Discussion' started by Fingerbob, May 24, 2019.

  1. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    8
    Good morning! I've recently ported one of my prototypes to Oculus Quest, and I've noticed that objects moving in the scene go through phases of smooth motion for a few seconds, followed by jittery motion for around a second, then repeating.

    I've reproduced this with a super-simple project - one object in scene, bouncing left and right by modifying the transform directly, application.framerate set to match XRDevice.refreshRate, Time.fixedDeltaTime set to match XRDevice.refreshRate. I've logged a bug report for it (1157271). I've tested on 2019.1, .2b and .3a and get the same results.

    The issue seems to be related to FixedUpdate not being stepped correctly - looking in the profiler, the smooth sections will have one set of fixed*** calls per frame, and the jittery section will alternate one frame of fixed*** then one frame where fixed*** don't appear, for 40 or so frames.

    If I set physics.autoSimulate to false, and manually tick physics.Simulate, the same issue happens (although the profiler graph looks different).

    If I set physics.autoSimulate to false and don't tick physics.Simulate, the issue goes away (but obviously nothing physics-related works, e.g. collisions or RBs).

    Is anyone else seeing this behaviour on a Quest device?
     
  2. SchneiderHiQ

    SchneiderHiQ

    Joined:
    Jul 12, 2017
    Posts:
    4
    Sounds like some general desync issue rather than something related to the Quest specifically. With the variable nature of rendered frame times and the fixed rate of the physics engine what you're seeing is something where the timestepping sort of resonates with itself.
    I'd suggest not matching the fixed timestep to the framerate as closely as you are, as I think this is the primary source of your issues.
    If you feel your physics objects still behave jittery you can enable interpolation on the rigidbodies.
    Otherwise, if you're manipulating transforms use Update rather than FixedUpdate to move them around. Respectively manipulating Rigidbodies should be done with Rigibody.MovePosition/MoveRotation in FixedUpdate so interpolation can do its work.
     
  3. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    8
    I followed exactly that line of thought, Schneider - I tried syncing the fixedDeltaTime slower and faster by various amounts (e.g. FDT at 71 vs DT at 72, FDT at 60) - they gave expected results during the smooth range (e.g. one missed fixed*** every second, one missed fixed*** every 6 frames) but exhibited the same bad behaviour during the jittery time window (alternating frames show no fixed***).

    I've replicated this in a scene with a single GO (a sphere), transform being moved in Update(), no rigidbody attached. Same issue. Profiling shows (on device) it's running everything apart from the wait in well under 5ms, 70%+ in XR.waitForGPU so it doesn't look like a performance related stall.

    I've tried setting vsynccount to 0 and 1, but that doesn't seem to make any difference. The only thing that makes the issue go away seems to be not calling Simulate.
     
  4. SchneiderHiQ

    SchneiderHiQ

    Joined:
    Jul 12, 2017
    Posts:
    4
    If you're seeing the same jitters doing just the transform in Update it doesn't sound like it's related to the physics engine stuff, almost sounds more like a vsync issue, but you've tried tampering with that as well. Don't really know what it could be then, sorry.
     
  5. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    8
    I've just tried a build to SteamVR (running on Vive) on PC. I'm seeing the same issue if the game window is fullscreen and has focus! the timing on the jittery window is smaller (1/3 sec every second or so, instead of 1 sec every 3 seconds) but it's the same behaviour.

    It goes away if the game window is windowed (with or without focus) or fullscreen but backgrounded (e.g. when I've got the editor foreground with the profiler running). Very strange indeed.
     
  6. adamjweaver

    adamjweaver

    Joined:
    Dec 5, 2016
    Posts:
    6
    I've been having a very similar issue for the last couple of days - it's been driving me up the wall.

    Similarly, I did a quick Quest port of a desktop VR game I've been working on and noticed a persistent jitter when moving 'held' items (tracked to controller physically by modifying rigidbody velocity & angular velocity during fixed update). In my case the jitter is there most of the time with brief periods of clarity. (A bit like a resonance as mentioned above).

    I've encountered similar judder on desktop before but it was always resolved by matching the fixedDeltaTime to the hmd refresh rate, or related to reprojection.

    I've been messing around with interpolation, execution order, timesteps but whatever I do, the jitter remains.
     
  7. adamjweaver

    adamjweaver

    Joined:
    Dec 5, 2016
    Posts:
    6
    Just FYI, downgrading unity to 2018.3.14f1 fixed this issue for me immediately.
     
  8. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    8
    Great into Adam, I've just tested the example project I logged with the bug, and the issue goes away for me too (2018.3.14f1). That suggests it's a behaviour change in Unity, and worth pursuing to resolve.
     
  9. buribalazs

    buribalazs

    Joined:
    Jan 2, 2018
    Posts:
    2
    I can confirm that the issue is still present in 2019.1.4f1. Reverting to 2018.3.14f1 solves the issue
     
  10. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    160
    Just trying an almost empty scene on my Quest, with a standard OVRPlayerController, and I see jittery motion in general, even simply moving the head around. I'm using 2019.1.4f1 now but don't really feel going back to 2018.x.x in this moment, this was just a random experiment after all. But I hope for a fix soon, I still want to try some stuff on Quest during the next days.
     
  11. Tom-Goethals

    Tom-Goethals

    Joined:
    Mar 6, 2015
    Posts:
    80
    Anybody logged a bug report yet? Seeing the same issue in 2019.1.x on Quest
     
  12. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    Same issue here
     
  13. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    @Fingerbob, can you provide a link to this bug? We could vote for it.
     
  14. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    8
  15. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    Awesome. Thank you!
     
  16. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    8
  17. mohydineName

    mohydineName

    Joined:
    Aug 30, 2009
    Posts:
    301
    @Fingerbob, can you send me your repro project? I will send it directly to Oculus for review. Maybe it will speed things up.
    I will send you my email by PM