Search Unity

Custom Blend with Cut doesn't work

Discussion in 'Cinemachine' started by batvink, Jul 8, 2020.

  1. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    61
    Hi,

    Problem Summary: If I add a Cut custom blend from Cam1 to Cam2, Cam2 moves to the last position of Cam1, when it should remain where it was placed.


    I have 2 virtual cams in a race scene:
    • Cam1 follows a Target Group
    • Cam2 is static, and Looks at the same Target Group

    As the group comes around a corner, I switch from the follow-cam to the static cam by increasing the priority. In the CineBrain I see the Live camera switch over as expected.

    With no custom blends configured, it all works as expected and the follow-cam blends into the static cam as per the default blend, and the view is from the Cam2 position.

    If I add a Cut custom blend from Cam1 to Cam2, the Inspector all looks as expected. But what actually happens is that Cam2 moves to the last position of Cam1.

    "Inherit Position" is not checked on either camera.
    Blend Hints is set to "None".

    What am I doing wrong?
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    Hi,

    That should not happen, I just tested and did not see this problem. Could you send me your project or a bunch of screenshots showing your camera settings, blend settings, and the Hierarchy panel.
     
  3. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    61
    Thanks @gaborkb for offering your help.
    While I documented the problem (project is way too big to upload and share), I noticed that the actual behaviour is even more strange.

    When the cut from Default Cam to StaticCut cam is made, both virtual cams behave correctly. What is wrong, is that the cineMachine brain live camera shows the correct StaticCut cam, but the "Real" main camera is no longer positioned at any virtual camera. It simply stops at the point where the switchover was made.

    All documented with screenshots in the attached PDF.
     

    Attached Files:

  4. batvink

    batvink

    Joined:
    Sep 26, 2019
    Posts:
    61
    @gaborkb @Gregoryl

    Found the problem :) I don't know if it is my code, or a general bug with this configuration.

    The problem was caused by a "Post-Process Layer" component on the main camera. It was throwing an error when cutting in UnityEngine.Rendering.PostProcess.PostProcessLayer, in method ResetHistory():

    Code (CSharp):
    1.         /// <summary>
    2.         /// This method should be called whenever you need to reset any temporal effect, e.g. when
    3.         /// doing camera cuts.
    4.         /// </summary>
    5.         public void ResetHistory()
    6.         {
    7.             foreach (var bundle in m_Bundles)
    8.                 bundle.Value.ResetHistory();
    9.  
    10.             temporalAntialiasing.ResetHistory();
    11.         }
    This gave an object not set error.

    When I removed the post-process layer (which was disabled), the cut blend started working.
     
    gaborkb likes this.
  5. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    CM Default Camera has the target group as its child. This might also be an issue.
     
  6. arminiuspp

    arminiuspp

    Joined:
    Jun 15, 2020
    Posts:
    54
    @batvink Having the same issue, though what do you mean by "removed the ppl" ? did you made another main camera or did you move the cinebrain?