Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Camera jittering in some PC's

Discussion in 'Cinemachine' started by georgeq, Oct 2, 2018.

  1. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    I have a virtual camera following the player, I'm doing all my updates on FixedUpdate, and the cinemachine brain update method is set to "Smart Update". On both the editor and the PC build, the camera follows the player smoothly, no jitter at all. However I published a demo of my project and some people complained about the camera jittering, I tried to modify some parameters in order to see if I could reproduce the issue, but it seems the only way to make the camera jitter is by changing the cinemachine brain update method, if I set it to "FixedUpdate" the camera follows the target smoothly most of the time, just a tiny amount of jittering at some points, if I set it to "LateUpdate" there's a very notorious amount of jittering. The best explanation I can think so far is that for some reason the cinamachine brain is choosing to update the camera on LateUpdate on some PC's... maybe they are low end PC's with a low frame rate? ... not sure, a guy sent me the specifications of his PC and doesn't seem like low end.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    Is the vcam target a RigidBody with Interpolation on?
     
  3. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    It does have a rigidbody but it is moved by applying forces, so the position is controlled only by forces, the rotation on the Y axis is controlled by applying torque, but I'm controlling the angular velocity around axis X and Z though code, basically I'm forcing them to be zero.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    What is the interpolation setting on the RigidBody? This setting:

    upload_2018-10-2_17-12-52.png
     
  5. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    It is set to "None".
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    In your situation there should never be any jitter, ever, if you set the Brain to FixedUpdate. What version of CM are you using? Some versions had an issue here.
     
  7. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    2.2.7
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    Maybe it has something to do with the way you're controlling the angular velocities through code. Can you elaborate on that a little?
     
  9. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    My project is a racing game, and the problem I had was that the virtual camera parameters apply for the local rotation of the target gameobject, this is what anyone wants under normal conditions, but in my case when your vehicle is hit by a bullet it starts to spin around for certain amount of time, that makes the virtual camera to try to follow the spin which causes the player to get disoriented and confused. To solve this I added a child object which's rotation is controlled by code, making sure it is always aligned with the track, then I made that object the virtual camera's target, so when you get hit by a bullet, you see your ship spinning, but the camera remains focused and aligned with the track and you don't get confused and disoriented. I guess that's the source of the jittering, but like I said, I haven't been able to reproduce it on my own PC, all this started because someone sent me a video where the jitteing is very notorious.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    You would have to be very careful in your code not to introduce jitter. I agree, this is a likely source. Does the code execute in FixedUpdate?

    To solve your problem without resorting to the child object, have you tried the SimpleFollow binding mode for the transposer?
     
  11. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    Yes, everything is done on FixedUpdate.

    It doesn't work for me because it forces "World Up" and the track can bend in all directions, at some points it can be completely upside down which puts the camera beneath "the floor".
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    aaahhhh! you didn't explain that part. Do you have pitch/yaw/roll damping on the transposer?
     
  13. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    Yes, all them are set to 2.
     
  14. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    That's likely the problem. Angular damping still suffers from gimbal lock if target is going too steeply up or down. CM 2.2.8 addresses this issue. In the meantime, you can try setting the pitch damping to 0, or grab the CM 2.2.8 preview and see if it helps. You'll want this setting:

    upload_2018-10-9_17-27-28.png
     
  15. georgeq

    georgeq

    Joined:
    Mar 5, 2014
    Posts:
    386
    Ok Gregory, thank you very much, I'll try cm 2.2.8
     
  16. OneAboveOneBelow

    OneAboveOneBelow

    Joined:
    Oct 13, 2018
    Posts:
    4
    Thanks for this thread - I had the same issue and after setting the brain to fixed update with rigidbody interpolation turned off, the jitter was removed. However if I add any kind of noise the jitter is back, quite strongly, and I need to set the Brain to smart or late update, which almost eliminates the jitter but not completely removes it. Is there a different setup recommended there?
     
  17. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    What do you mean when you say "add any kind of noise"? And are you talking about gimbal lock, or about judder caused by inconsistencies between FixedUpdate/LateUpdate?
     
    Last edited: Oct 18, 2018 at 3:22 PM
  18. OneAboveOneBelow

    OneAboveOneBelow

    Joined:
    Oct 13, 2018
    Posts:
    4
    My bad didn't explain it fully. I'm following the rigidbody object with CinemachineFreeLook. The brain uses FixedUpdate, and when I use noise in CinemachineFreeLook (Basic Multichannel Perlin), that's when the jitter reappears. It is largely reduced (but not completely) if the Brain is switcher to Smart or LateUpdate. So I'm wondering why that is, or if I'm doing something wrong there, or if another setup is better for the camera if I'm using noise on the CinemachineFreeLook component
     
  19. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    CM noise should introduce no jitter. Does your RigidBody target have Interpolation on?
     
  20. OneAboveOneBelow

    OneAboveOneBelow

    Joined:
    Oct 13, 2018
    Posts:
    4
    No I turned it off so so I wouldn't have the jitter when using FreeLook without Noise