Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

What is the Mid-Blend Virtual Camera and How do I Use it?

Discussion in 'Cinemachine' started by hex21189, Mar 5, 2019.

  1. hex21189

    hex21189

    Joined:
    May 28, 2013
    Posts:
    11
    TLDR:
    When creating code driven transitions between timelines I often see a blend described as "[EndTransitionCamera] x% from [Mid-Blend]" on my cinemachine brain. As far as I can tell this is some cinemachine created camera but whenever it comes active the game view seems to perform a jump cut before beginning the blend. I don't know where this Mid-Blend camera came from or how it decided to be where it is, ideally I would like it to start where the brain currently is so it can work with my transition system.

    My Situation:
    Currently I am working on a program that contains multiple cutscene sequences that the player can transition between at will. These cutscenes are created as separate game objects each with a playable director component and their own unique timeline. When switching cutscenes what I do is pause the current cutscene, place a seperate virtual camera with a very high priority at the start of the next sequence and activate it. I then wait a few frames while cinemachine generates a blend and processes it before disabling the old cutscene and transition camera before enabling/playing the next one. In older versions of unity this appeared to work (although I had to kill the current active blend, disable all virtual cameras, place a second dummy at the current brain location first), however with new version of unity there seems to be this new "Mid-Blend" camera being generated at seemingly random locations that I cannot control. Is there anyway to avoid creating this new camera or access it's location to set it to the brains current location for a jump cut free blend?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    "Mid-blend" is a shorthand that CM uses to indicate that you've interrupted a blend-in-progress to blend to some new vcam. It's not a camera. What's going on under the hood is that the old blend is continuing to play itself out as the source of the new blend, something like this: result = Blend(C, Blend(B, A)).

    Old Cinemachine did this: result = Blend(C, fixed point snapshot of old mid-blend position).

    What this means is that you have to keep the outgoing vcams active until the blend has played itself out. Your jump cuts are likely caused by you deactivating the outgoing vcams prematurely.
     
  3. hex21189

    hex21189

    Joined:
    May 28, 2013
    Posts:
    11
    Cool, that theory seems pretty solid but I'm not sure if it applies entirely to my situation with Timelines since the timeline itself seems to control blends to some extend. I've tried disabling all non-blending cameras before pausing/stopping the timeline (I've also tried in reverse order) but the jump cuts persist. One difference I did notice was that the brain jump goes to the final camera in the timeline instead of staying mid-blend. I can only assume this is some sort of timeline bug since the final camera has both it's game object and component disabled. Is it possible to kill the active blend and just use two floating virtual camera objects to simulate the older code? Also is it possible to find which cameras are being used when mid-blend is calculated? I have a feeling the jump cut I saw was because the mid-blend was between one of the current blending cameras and the final timeline camera instead of just the current blending cameras.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I'm having some trouble following all this.
    It would really help to have a picture or two, showing what's going on in your timeline.
    Even better, if you could make a lightweight scene that shows the issue and PM it to me, that would accelerate things quite a lot.

    If you're driving all this from Timeline, you shouldn't be having to enable/disable any cameras at all. Just leave them alone, timeline will take care of them. You can even leave them permanently disabled (if you're not animating any fields inside them), and timeline will artificially enable them when they're needed.
     
    Last edited: Mar 7, 2019