Search Unity

Crossfade between 2 virtual cameras. Is it possible?

Discussion in 'Cinemachine' started by ThunderMusic, Sep 11, 2018.

  1. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    43
    Hello,
    I'm using Cinemachine with Timeline. I'm trying to do a simple crossfade between 2 cameras, but I can't make it work. All the tutorials around the Web are showing blending where the first camera's position blends into the second camera's position. I actually want the camera to have their own movement and crossfade between each other... not a continuous shot as if it was one camera all the way. Each camera could each be on opposite sides of the scene, so position blending is out of the question. Is there a way to do that out of the box?

    In this presentation, the presenter does it, but it's between 2 images in storyboard mode. Is there a way to do it with 2 "live" cameras?


    Thanks
     
  2. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Not yet. That requires rendering the frame twice and combining them. We are working on supporting this feature with Timeline and multiple cameras but it is currently not available.

    HOWEVER, if you're crazy and want to do the most hacky version which we DO NOT recommend (but it does work, sorta) you can mess around with this.

    Put a Storyboard extension on an vcam
    Pipe a render target to the Show Image input - from some other camera rendering in the scene. Search 'using multiple cameras in Cinemachine' for more detail, or this: https://twitter.com/adamjcmyhill/status/950499865498288129?lang=en

    So now your Storyboard's image is another video stream which you can then mix together with the Alpha control.

    upload_2018-9-11_4-48-28.png

    Really though, this is ghetto business. More of a novelty hack way of doing now until we properly support it. Don't send us bugs :)
     
    ThunderMusic likes this.
  3. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    43
    Thanks a lot. That's really appreciated. I'll try using this... it's indeed not ideal, but I guess it will do for now. Do you have a target date (I know, target dates don't mean much with R&D, I'm a programmer too) for the "official support" of a crossfade feature?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
  5. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    43
    Thanks. I'll try that, as the other solution did not quite work in my case.
     
  6. ThunderMusic

    ThunderMusic

    Joined:
    Sep 19, 2013
    Posts:
    43
    Hello, it took a while, but I finally tried it. It works like a charm. Thanks a lot.

    I think it requires a bit more explanation though (if someone else stumbles upon this thread) :

    • Camera 1 (the initial one) is a Cinemachine Virtual Camera with nothing else attached.
    • Camera 2 (the one that is fading in) is a standard camera that renders to a render texture, we must add a Cinemachine Virtual Camera component to it so we can control the priority and a storyboard extension to assign the render texture and set the "Mute camera" attribute to true/checked.
    • If I use a Cinemachine clip in Timeline with my camera shot extended all the way to the end, the camera will never change, no matter what I set as the priority. If I use it only to activate my camera (Camera 1) as the active one, when I animate my second camera's priority (Camera 2) over/under the main one's priority (Camera 1), then the fade in/out occurs.

    I still haven't found how to control the fade in/out time. It seems to be a fixed amount of time.

    Thanks a lot.
     
    Gregoryl likes this.
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    The fade time is just the blend time. Either you overlap the clips on Timeline for the desired time, or you make a custom blend setting for vcam, and specify the time you want.