Search Unity

Cinemachine and motion blur pops with cuts

Discussion in 'Cinemachine' started by mradfo21, Jul 30, 2018.

  1. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    194
    hey so I'm wondering if anyone has a solution for cutting without motion blur artifacts?

    Cinemachine causes a frame (or a few?) of blurring between camera cuts. Its quite jarring and pulls you right out of any cutscene. Is there some way of not creating this blurred frame or two when doing a cut.

    heres an example (yeah.. its S***.. its WIP). Notice when we cut between camera it feels really jarring?




    Frame A
    upload_2018-7-29_17-40-23.png


    Motion Blur Frame
    upload_2018-7-29_17-40-44.png


    Desired Cut
    upload_2018-7-29_17-41-11.png


    the timeline setup producing the cut:

    upload_2018-7-29_17-41-51.png


    has anyone figured out a solution to this?



    this is my desired level of fidelity for cuts - notice theres no motion blur flashes

     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    If you do the motion blur with the Post Processing package, then this is taken care of. CM Brain fires an event when it generates a camera cut, and a handler on this event resets the temporal effects. To make this work, you need a PostProcessing layer on the Unity camera.

    How are you implementing motion blur?
     
  3. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    194
    that sounds exactly like what i want! Weirdly im using the standard Unity motion blur and the standard Unity post processing stack 2.0

    upload_2018-7-30_8-34-40.png

    upload_2018-7-30_8-35-7.png


    do you think it doesn't work with the new post processing stack ?
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    You need to import the CM PostProcessing adaptor package:

    upload_2018-7-30_13-27-41.png
     
    gaborkb and laurentlavigne like this.
  5. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    194
    ah! interesting! okay, will do!
     
  6. olix4242

    olix4242

    Joined:
    Jul 21, 2013
    Posts:
    1,962
    How can we catch this event?
    Also, I have some pretty complex situation when I have to manually scrub the timeline many times in one update (this is needed by my Deckard rendering plugin for estimation of correct motion blur). I have to know if any of the manually scrubbed frames fall into a different cinemachine shot. So, probably a function that lets me know what cinemachine shot is being used will do just fine.
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    upload_2019-5-21_9-57-57.png
     
    gaborkb likes this.
  8. vjess

    vjess

    Joined:
    Jan 24, 2017
    Posts:
    8
    It doesn’t seem to be working with Hdrp. Is it due to the new motion blur system ? Or do we need to setup the system differently ?

    Thanks
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Unfortunately HDRP does not support resetting temporal effects yet. There is a PR with that in flight, so the next version will correct this omission.
     
    gaborkb and laurentlavigne like this.
  10. vjess

    vjess

    Joined:
    Jan 24, 2017
    Posts:
    8
    Thanks Gregoryl, glad to know I'm not doing anything wrong.
    I'll wait for the next version then :) !
     
  11. JumpingGuy

    JumpingGuy

    Joined:
    Jan 2, 2016
    Posts:
    69
    Has there been any progress / updates on this one? I'm also experiencing some blurring between hard cuts with Cinemachine / HDRP.
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    What versions of CM and HDRP are you using? AFAIK this should be fixed in latest.
     
  13. JumpingGuy

    JumpingGuy

    Joined:
    Jan 2, 2016
    Posts:
    69
    I have the latest CM (2.9.0 ) and HDRP. (10.5.1). Unity 2020.3.12f

    I'm thinking that it might not be a native CM / HDRP thing then and more related to what @olix4242 was asking about on this thread in an earlier post as I think it might be directly related to Deckard. Thanks.
     
  14. marchall_box

    marchall_box

    Joined:
    Mar 28, 2013
    Posts:
    139
    @Gregoryl Hi, I am using Unity 2020 LTS, CM 2.8.3. Legacy. I am getting this cut motionblur errors + timescale issue.

    When timesclae is 0.2, motion blur also stays with it 5 times longer
     
  15. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    I don't really understand what you're describing. Can you repro this in a test project?
     
  16. theWinnie

    theWinnie

    Joined:
    Sep 17, 2012
    Posts:
    2
    Hi there, I'm also experiencing this at seemingly random with hard camera cuts. Using 2020.3.26f1. We're shipping our project soon, so I'm happy to use any workarounds if anybody has any.
     
  17. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    I'm on URP 2021.3.3f1 and the blur pop still occurs. Is there a fix for URP or is it only fixed in Built-In and HDRP?
    Thank you
     
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    I know that there was an old issue in HDRP that caused the reset of temporal effects (such as motion blur) to not work. Cinemachine triggers a temporal reset when there is a camera cut. This was fixed. I'm not aware of other issues that would cause blur pops. Can you make a small repro project that shows this problem?
     
  19. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    Hmm you're correct. I tried to use it again the next day and it works fine now . Perhaps I made a mistake since I hadn't changed anything. Thanks anyways Gregoryl!
     
    Gregoryl likes this.
  20. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    I'm on URP 2022.1.20f1 and Cinemachine 2.9.0. The pop still occurs for me ( It still occurs for me on 2021 ). All I did was make a volume with "Motion Blur" enabled and placed two cameras on the timeline with a recorder. I get one blurry frame when it cuts to the second shot.
     

    Attached Files:

  21. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    @YoshYoshKo So yeah, it looks as though Reset of temporal effects on camera cut is not done with URP, only with HDRP. It seems that URP did not support this feature when CM was released. I'm checking now with the URP team to see whether that's been rectified.
     
    Last edited: Feb 3, 2023
  22. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    @YoshYoshKo URP supports reset of temporal effects starting with 2022.2.2f1. The next release of CM (2.9.6) will make use of this API and the fuzzy cuts will disappear.
     
  23. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    Thank you for the reply Gregoryl! Do you have a rough estimate when CM ( 2.9.6 ) may come out?
     
  24. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    There is no fixed schedule for this. Usually we wait until there are enough bugfixes to make it worthwhile. If you're in a hurry, it's possible for you to work around this issue by installing your own OnCameraCut handler that resets URP history. Let me know if you want me to explain how to do that.
     
  25. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    If you could explain it that would be great!
     
  26. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Sure! Drop this script into your project. You'll need Unity 2022.2.2f1 minimum for this to work.

    Code (CSharp):
    1. using UnityEngine;
    2. using Cinemachine;
    3. using UnityEngine.Rendering.Universal;
    4.  
    5. static class ResetTemporalEffectsOnCameraCut
    6. {
    7. #if UNITY_EDITOR
    8.     [UnityEditor.InitializeOnLoad]
    9.     class EditorInitialize { static EditorInitialize() { InitializeModule(); } }
    10. #endif
    11.     [RuntimeInitializeOnLoadMethod]
    12.     static void InitializeModule()
    13.     {
    14.         CinemachineCore.CameraCutEvent.RemoveListener(OnCameraCut);
    15.         CinemachineCore.CameraCutEvent.AddListener(OnCameraCut);
    16.     }
    17.  
    18.     static void OnCameraCut(CinemachineBrain brain)
    19.     {
    20.         // Reset temporal effects
    21.         var cam = brain.OutputCamera;
    22.         if (cam != null && cam.TryGetComponent<UniversalAdditionalCameraData>(out var data))
    23.             data.resetHistory = true;
    24.     }
    25. }
    26.  
     
    YoshYoshKo likes this.
  27. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    I'm currently on 2022.3.11f1 and using Cinemachine 2.9.7. I'm using the asset Tiny Motion for motion blur and I'm still getting the 1 shot of blurry frame every time the camera cuts to a new angle. I also tried using the script you provided and it doesn't appear to work.
     
  28. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Can you send a small repro project that shows this problem?
     
  29. YoshYoshKo

    YoshYoshKo

    Joined:
    Apr 13, 2020
    Posts:
    15
    I tested on a blank project and it appears having the recorder on causes the single frame pops. It works fine if I'm not recording. So it's possible the problem is when how the asset is coded.
    However I forgot that Unity also has a built in motion blur filter so I've started using that instead and the pops don't occur.
     
    Gregoryl likes this.