Hey guys,
I’m getting a looot of jitter on the aim module. I have a very stable frame rate well over 60fps. Changing the dampening on the soft borders doesn’t help. I also tried changing the script execution order to no avail.
I’m using the latest Cinemachine with Unity 5.5.2f1. Any ideas of what might be the culprit?
Here’s a video showing the problem. It’s just a cube being moved mathematically between two points over a completely random backdrop.
If target is a physical object, be sure to enable interpolation on the actual object itself. It looks to me the object is jittering, not the actual camera.
Hi Hippo,
The object just has a “procedural” animation generated from a script. It moves perfectly smooth (checked that by double F to follow objects in the editor). I haven’t tried it on a physics object yet, but I’ll do that asap. Also, a physics object moving that jittery would completely mess up PhysX as I guess you guys are aware of
I also tried it in Vane on our main character, getting the same jitter. It’s very pronounced for objects moving in a straight smooth line. I thought the problem with trying it in Vane was that we have a lot of logic, which is why I tried it in a completely empty project (together with the new post effect stack).
I’m definitely not ruling out any issues with the actual Unity version so I’ll try it at home on 5.6.
To me that does look like the object is jittering - the background is translating perfectly smoothly in your video. will ping the team but the camera movement looks pretty smooth…
how are you moving the camera itself? is this using the transposer settings in cinemachine or something else?
Hi @Shapefarm The jitter problem comes up quite often. We have a discussion on it going on in the CM v1.5 thread with all the information.
The short answer is that Cinemachine doesn’t jitter, your object is jittering. When you frame the camera to it or lock a camera the jitter isn’t noticeable because the camera is jittering with the object and it totally hides it.
The jitter on the object is caused by spikes in delta time and/or the interpolation method of your object.
That said, Cinemachine isn’t cool with high-frequency jittery objects, it kinds of freaks the camera out. The way we are doing our damping is really sensitive to frame rate spikes and jerky interpolation. We can do a way better job of that and we’re looking at changing the way our damping works to account for jittery objects since they’re pretty common in Unity.
As a test, make a new CM camera, no transposer or anything just have it sit somewhere in the world, target the cube and set the damping to 0,0 and set the composer to not have any dead-zone - hard lock the composition to it. I bet the jitter ‘disappears’. It didn’t actually go anywhere, it just is now hidden due to the camera being perfectly synched to the jitter.
Check out that thread for more interpolation information. Try some of those ideas on your end and we’ll see about bomb-proofing our damping on our end. This problem needs to disappear.
@Shapefarm I’m working on making Cinemachine more tolerant of jittery targets. Any chance you could drop me a stripped-down project that has the jittery movement? It looks like a good use-case.
Do you have some damping in your scripts? I had a smooth follow script as a camera target for cinemachine and I had the same kind of jitter. The jitter disappeared when I set cinemachine to directly follow the (root motion animated) player instead of following the smooth follow gameobject.
It would probably be jitter free too, if you try using fixedupdate or lateupdate instead of update or vice versa, depending on when cinemachine updates.
Yes, i did some in depth testing today and the jitter does come from the object. It doesn’t completely go away if you use interpolation on your rigid body, but it does help a lot (it’s also quite expensive so only use it for hero objects Matt said and scowled). Animation is a lost cause. Using animation causes an incredible amount of jitter.
I talked to Matt and Vic here about it and we had the same issues with our own camera system. We did however manage to solve it somehow, but i’m just a lowly tech artist/sound guy so @Gregoryl please send a mail to info@friendandfoegames.com to talk to our programmers.
There are two scenes. One with an animated object (AnimatedCubeFollow.unity) and one with a physics object (PhysicsCubeFollow.unity). To test @AdamMyhill 's hard constraint idea there are two cams (one soft and one hard constrained) in the physics scene for you to try with.
So the CinemachineBrain now has the option of updating in FixedUpdate or LateUpdate. @Shapefarm your scenes are butter-smooth with the brain on FixedUpdate, and in the AnimatedCubeFollow scene the animnation update mode set to AnimatePhysics. Thanks for providing the content!
Note: only the virtual cameras are updated in FixedUpdate. The Unity Camera is still moved in LateUpdate, regardless of the Brain’s update mode. If you have order issues because of the FixedUpdate, you can always set the CinemachineBrain’s script execution order to be at the end.
I think we’ll have to wait until Cinemachine 2.0 for the update. But as I’m currently developing my tools I’m cool with waiting a few weeks. Anyway, I also can’t wait to try the new version!
@Shapefarm@Alverik We’ve gone even better in 2.0: The brain now has a setting for SmartUpdate, which is effectively: do whatever the target does. If the target updates in FixedUpdate, then any cameras looking at it will also update in FixedUpdate. If the target updates normally, then so will the cameras that look at it. Even better, in Smart mode, you can blend between cameras updating on different clocks.
You can still set the brain to update on FixedUpdate or LateUpdate, but SmartUpdate makes this unnecessary.
Im having some interesting results with the new system, so I figure I’ll just report it here. So following an object with interpolate set on, the following happens with the different Cinemachine update methods:
Setting it to FixedUpdate, the player is slightly jittery but the stage moves smoothly
Setting it to LateUpdate, the stage is moderately jittery but the player moves smoothly
Setting it Smart Update, its highly jittery to the point that it looks like an Earthquake when I move
I find that very odd that Smart Update, which is essentially just setting it to Fixed or Late Update for you, would perform so much worse then using any of the settings manually. This is just a quick heads up post, but I can post more evidence if you need it
@Jjules We’ve done some more work on jitter in the new version CM2.1 (available later this week). I’d like to look at your scene with the new version. Any chance you could zip me up a package showing the jitter?
Huzzah, I was wondering when 2.1 was coming out! And I certainly can package it, the only problem is the game only support Xbox Controllers ATM. Would you like me to Scrape together a keyboard/mouse system before zipping?
Mind you that the project is an online multiplayer one, so the character is a prefab that you can find underneath prefabs/resources
also as a little update, I realized that the jitter in Smart Update was so extreme because the framerate was so high. When I add image effects (which lowers the framerate on my not-so-powerful computer), the jitter is much less pronounced, so that reaffirms what you said ealier