Search Unity

Screen shakes/jitters when transitioning cameras

Discussion in 'Timeline' started by sledgeweb, Sep 13, 2018.

  1. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    I have a non-timeline camera that is the main game camera. The player can orbit, zoom, etc. There are also other cameras the user can toggle between (first person pov for example).

    I'm trying to set up a timeline opening animation to the scene, and then ideally at the end in smoothly and seamlessly transitions to the main 3rd person game camera.

    I have an ease at the end of my timeline camera, and it works, but when the camera is transitioning, it jitters really bad.

    Example: https://gyazo.com/e8bb089bde1158a5e4e493bc24e16a3e

    I'm new to CM/Timeline and obviously not understanding something here. Appreciate any feedback/help!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    What version of CM? (see Cinemachine/About)
    Can you post images of your main game vcam's inspector, and of the inspector of the last timeline vcam that blends to it?
    Also, can you show your game hierarchy, showing the vcams and their lookat/follow targets?
     
  3. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    Thanks for the reply!

    Version is 2.1.10

    This is the dolly track cam inspector:
    https://gyazo.com/008c91da11f470ab71aa8bf8335153f1

    Main gameplay camera:
    https://gyazo.com/9abfc87b3a5bc3b7025837e16dbb1850
    https://gyazo.com/3e3e68cc27e51babd44525c161812d9a

    Timeline object:
    https://gyazo.com/d9726ad1a8f64e065b4973a0f44c0da7

    Let me know if I've missed anything?
     
    Last edited: Sep 13, 2018
  4. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    I think the main problem is a script we have on the camera. The timelines tries to blend so it moves the camera, but the orbit camera script challenges the cinemachine trying to stabilise the camera it's way.

    So both the script and the cinemachine try to move the camera their way. But deactivating the script doesnt work because then the camera goes back to default mode, and when you re-activate it it stabilises again.

    So I'm trying to figure out how to go back and forth in and out of timeline in a way that doesn't break our camera scripts.
     
  5. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    Hey Gregoryl, I've tried a few more ideas but still haven't hit on a solution for this yet. Just checking to see if you've had time to look at anything and might have suggestions. Thanks!.
     
  6. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    Update: I may have stumbled upon a solution:

    https://gyazo.com/83fbac20e51a04605a4327c0af88a26d

    When I change the update method on the cinemachine brain script from smart update to fixed update, the jitter goes away. Does this sound right? I changed it back to smart update to verify, and the jitters returned.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    @sledgeweb Sorry for the delay, I was travelling.

    Your problem is that the CM brain and your camera script are both fighting for control of the camera's transform. I'm not 100% sure why setting the brain's update mode to Fixed helped, but if it did, it's a fluke.

    The CM brain controls its own transform (and hence the Camera's) by monitoring the active vcams in your scene and setting its transform according to the vcam with the highest priority, or according to instructions from the timeline. If you have another camera controller simultaneously trying to move the transform, there is no guarantee that they will play nicely together, unless you change your setup a little. Here is how I would do it:

    Game object 1:
    - Camera (the only one in your scene)
    - CM brain

    Game object 2:
    - Your camera controller script
    - CM vcam with Do Nothing in Aim and Body, with a higher priority

    Game object 3
    - vcam with tracked dolly, invoked from timeline

    Game object 2 will be the main game camera, by virtue of its vcam. It will drive the Camera in Game Object 1, unless a timeline activates another vcam. Because the vcam in GO 2 has Do Nothing in its Aim and Body, it will allow the transform to be driven by your custom script without interference. Bonus: if you add a Noise component to it, or some other vcam extension (e.g. post-processing), it will work.
     
  8. sledgeweb

    sledgeweb

    Joined:
    Sep 9, 2016
    Posts:
    31
    Thanks for the reply!

    I'm going to see about setting it up as you suggest. Our project started prior to having Cinemachine installed, so right now we have 3 unity cameras in the game. The main third person camera, then a POV camera, and then a free player controlled camera (for photo mode). The POV camera has it's own post processing stack to differentiate it.

    Obviously these could probably all be virtual cameras now, but I have to see how much work we'd need to do to make the adjustment. In the meantime, for some reason the "Fixed Update" solution seems to be working.

    For the POV camera, the way I set up the post processing to have a different effect on that camera was to put the POV camera on a different layer than the main camera. Is this also how you would handle it with a virtual camera?
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    With Cinemachine, you just attach a CM PostProcessing extension onto the vcam (assuming you're using PP V2; with V1 the workflow is different), then the vcam-specific profile is attached to that. The post effects will blend along with the vcams.