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

Fast blends

Discussion in 'Cinemachine' started by adslitw, Sep 6, 2017.

  1. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    Hey,

    Is there a recommended way of blending back and forth between two or more vcams quickly? In my tests the blends seem to break down if the previous blend hasn’t finished yet (which I’m guessing is this ‘recycling’ issue: https://forum.unity3d.com/threads/blending-issue-incomplete-cut.487131/).

    For example, you have two vcams, ‘ground’ and ‘air’, which are given priority based on the grounded state of the player. However the player does a small jump, so the blend is still going ground->air when air->ground is triggered again.

    In this repro project (https://drive.google.com/open?id=0B2ubTgpVuAuXQ1BqLXU2clFKR0U) you can see toggling ‘camera 2’ off and on again breaks the object tracking, despite the cameras being identical.

    So, long story short, I’m now modifying the vcam properties directly (via this thread https://forum.unity3d.com/threads/individual-blend.485247/) and just using one vcam. Is that what you would recommend? What is/was the reactor approach?

    Cheers!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    The way the priority blending system works is that if you interrupt a blend in progress with another blend, the new blend will take a snapshot of the point at which the first blend was interrupted, and blend from there. It does not maintain a (potentially very long) chain of active blends to use as the source.

    Reactor was a way to modify vcam properties dynamically in response to input from the game code. A script to do that (as you have made) is a perfectly viable solution.

    Another possible route is to make a complex camera (similar to FreeLook, which is actually 3 hidden vcams in a continuous state of blending) that consists of multiple vcams, continuously blending with weights controlled by your game logic. Cinemachine 2.1 has a new class made specifically for this purpose: CinemachineMixingCamera. It exposes itself to the Cinemachine system as a single vcam (like the FreeLook) but it in fact is managing multiple vcam children and blending their output. The advantage of using multiple vcams and blending them is that you can change any aspect of the camera in response to your game logic (lenses, composition, noise, PostProcessing effects, etc), and be assured of smooth transitions without lots of code. Makes it easy to experiment.
     
  3. adslitw

    adslitw

    Joined:
    Aug 23, 2012
    Posts:
    275
    Ah-ha - CinemachineMixingCamera is perfect, must have missed that. Just been having a play with it and it's ideal. Thank you!
     
    Gregoryl likes this.