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

Cinemachine VS DepthOfField what is going on here?

Discussion in 'Cinemachine' started by tcz8, Nov 16, 2019.

  1. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Isn't there risks involved? I wouldn't want to make things any worse than they already are.

    BTW It finished re importing assets, and I was able to re enable round robin for all cameras. The DOF problem appears to be fixed for the moment.

    There are two things I am noticing:
    1. The position of the camera is much further high up on the rigs than were we had it set before and the rotation changed, it's behind the player instead of facing. So the start position changed for some reason.
    2. I think you have a bug in editor mode, the post processing effects are being disabled and re enabled at random, its like a flash, also seems to happen when interacting with the game tab. Looks exactly like disabling and re enabling the post processing by clicking on the button on the top of the scene view but in the game view. Not sure if it also happens in scene view, haven't seen it so far.
    UPDATE:
    It is happening in the scene view, and just now, the problem reversed itself, the post processing is disabled (even though the button is enabled) and when it flashes it shows the postfx for a half a second and disappears again. I fixed it (I mean "un reversed it") by switching to the game view.
     
    Last edited: Dec 5, 2019
  2. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Here is a shot of the problem in action (you can see the fx are enabled on top)
    upload_2019-12-5_15-19-13.png

    Should look like this:
    upload_2019-12-5_15-19-57.png


    AND it keeps coming back now... man that is annoying.
    At least it hasn't happened in play mode... yet.
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I'm not aware of risks associated with this, but can understand if you're feeling a little spooked. Your patch is fine.

    Excellent news

    Not sure why this would happen. Are you using SimpleFollow binding mode in your vcams?

    I will see whether I can repro this in your test project.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I can repro in your test project - game view has these annoying flashes. Will dig into it an get back to you. Thanks for your patience and your perseverance.
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Seems to happen only when the inspector with the PP extension is visible - and not at all when in play mode. Does this match what you're seeing?
     
  6. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Yep that matches what I was getting.

    I updated to PP v2.2.2 and I think its gone (was on 2.1.7).

    Not sure, hasn't done it for a while.

    Do you get the same thing?
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I just ugraded as well - still the same flicker. Note that it only happens if the PP vcam extension is displayed. If you collapse it or inspect something else the flicker goes away. Can you check that?
     
  8. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    You are right it came back with this open:

    upload_2019-12-5_16-56-4.png

    But its not doing it as much as before for some reason, so maybe it was just luck.

    AND I'm also getting this now:

    [Exception] NullReferenceException: Object reference not set to an instance of an object
    RuntimeUtilities.get_copyStdMaterial() Library/PackageCache/com.unity.postprocessing@2.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs:269
    268: Assert.IsNotNull(s_Resources);
    -->269: var shader = s_Resources.shaders.copyStd;
    270: s_CopyStdMaterial = new Material(shader)
    271: {

    PostProcessLayer.BuildCommandBuffers() Library/PackageCache/com.unity.postprocessing@2.2.2/PostProcessing/Runtime/PostProcessLayer.cs:605
    603: tempRt = m_TargetPool.Get();
    604: context.GetScreenSpaceTemporaryRT(m_LegacyCmdBuffer, tempRt, 0, sourceFormat, RenderTextureReadWrite.sRGB);
    -->605: m_LegacyCmdBuffer.BuiltinBlit(cameraTarget, tempRt, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0);
    606: if (!m_NaNKilled)
    607: m_NaNKilled = stopNaNPropagation;

    PostProcessLayer.OnPreCull() Library/PackageCache/com.unity.postprocessing@2.2.2/PostProcessing/Runtime/PostProcessLayer.cs:440
    438: }
    -->440: BuildCommandBuffers();
    441: }


    AND this:
    [Exception] InvalidOperationException: Destroying a GameObject inside a Prefab instance is not allowed.
    Undo.DestroyObjectImmediate() C:/buildslave/unity/build/Editor/Mono/Undo/Undo.bindings.cs:74

    CinemachineFreeLookEditor+CreateRigWithUndo.<CreateRigWithUndo>m__1() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Editor/Editors/CinemachineFreeLookEditor.cs:139
    137: CinemachineFreeLook.DestroyRigOverride = (GameObject rig) =>
    138: {
    -->139: Undo.DestroyObjectImmediate(rig);
    140: };
    141: }

    CinemachineFreeLook.DestroyRigs() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Runtime/Behaviours/CinemachineFreeLook.cs:466
    464: {
    465: if (DestroyRigOverride != null)
    -->466: DestroyRigOverride(oldRigs.gameObject);
    467: else
    468: Destroy(oldRigs.gameObject);

    CinemachineFreeLook.UpdateRigCache() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Runtime/Behaviours/CinemachineFreeLook.cs:558
    556: if (LocateExistingRigs(RigNames, false) != 3 && !isPrefab)
    557: {
    -->558: DestroyRigs();
    559: m_Rigs = CreateRigs(null);
    560: LocateExistingRigs(RigNames, true);

    CinemachineFreeLook.GetRig() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Runtime/Behaviours/CinemachineFreeLook.cs:158
    156: public CinemachineVirtualCamera GetRig(int i)
    157: {
    -->158: UpdateRigCache();
    159: return (i < 0 || i > 2) ? null : m_Rigs;
    160: }

    CinemachineFreeLookEditor.UpdateRigEditors() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Editor/Editors/CinemachineFreeLookEditor.cs:97
    95: for (int i = 0; i < RigNames.Length; ++i)
    96: {
    -->97: CinemachineVirtualCamera rig = Target.GetRig(i);
    98: if (rig == null || rig != m_rigs)
    99: {

    CinemachineFreeLookEditor.OnInspectorGUI() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Editor/Editors/CinemachineFreeLookEditor.cs:67
    66: // Rigs
    -->67: UpdateRigEditors();
    68: for (int i = 0; i < m_editors.Length; ++i)
    69: {

    InspectorWindow.DoOnInspectorGUI() C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1647

    GUIUtility.ProcessEvent()


    AND last but not least this:
    [Exception] ArgumentException: Getting control 20's position in a group with only 20 controls when doing Repaint
    Aborting
    GUILayoutGroup.GetNext() C:/buildslave/unity/build/Modules/IMGUI/LayoutGroup.cs:122

    GUILayoutUtility.DoGetRect() C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:461

    GUILayoutUtility.GetRect() C:/buildslave/unity/build/Modules/IMGUI/GUILayoutUtility.cs:433

    EditorGUILayout.Space() C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:8846

    Cinemachine.Editor.CinemachineVirtualCameraBaseEditor`1[T].DrawExtensionsWidgetInInspector() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Editor/Editors/CinemachineVirtualCameraBaseEditor.cs:109
    107: if (!excluded.Contains("Extensions"))
    108: {
    -->109: EditorGUILayout.Space();
    110: EditorGUILayout.LabelField("Extensions", EditorStyles.boldLabel);
    111: Rect rect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight);

    CinemachineFreeLookEditor.OnInspectorGUI() Library/PackageCache/com.unity.cinemachine@2.4.0-preview.9/Editor/Editors/CinemachineFreeLookEditor.cs:82
    81: // Extensions
    -->82: DrawExtensionsWidgetInInspector();
    83: }

    InspectorWindow.DoOnInspectorGUI() C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1647

    GUIUtility.ProcessEvent()
     
  9. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    I'm going to try restarting Unity once again and let you know if this still happens. I think those errors only started after entering and exiting play mode.

    I have to go help the kids with their homework, I'll update you later tonight.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    I saw those errors too. Here is what I found:
    1. Restarting Unity made them all go away, with the exception of the PostProcessing errors.
    2. The PostProcessing errors go away if you downgrade PostProcessing to version 2.1.7.
    I've notified the PostProcessing team about this issue.

    For the flickering, this is a minor refresh problem with the CM inspector. I've pushed a fix for it, which will be available in the next preview. It's only an aesthetic annoyance in edit mode, and is harmless.

    Thanks for all your help with these issues. Please don't hesitate to post here if you encounter anything else
     
  11. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    You're welcome, thank you for taking of the problems.

    As you mentioned the PP bug is still here on version 2.2.2 after a restart.

    Starts happening when a script recompile in play mode. I only get two errors now.

    This is the first error:

    [Assert] Assertion failure. Value was Null
    Expected: Value was not Null

    Followed by:

    [Exception] NullReferenceException: Object reference not set to an instance of an object
    RuntimeUtilities.get_copyStdMaterial() Library/PackageCache/com.unity.postprocessing@2.2.2/PostProcessing/Runtime/Utils/RuntimeUtilities.cs:269
    268: Assert.IsNotNull(s_Resources);
    -->269: var shader = s_Resources.shaders.copyStd;
    270: s_CopyStdMaterial = new Material(shader)
    271: {

    PostProcessLayer.BuildCommandBuffers() Library/PackageCache/com.unity.postprocessing@2.2.2/PostProcessing/Runtime/PostProcessLayer.cs:605
    603: tempRt = m_TargetPool.Get();
    604: context.GetScreenSpaceTemporaryRT(m_LegacyCmdBuffer, tempRt, 0, sourceFormat, RenderTextureReadWrite.sRGB);
    -->605: m_LegacyCmdBuffer.BuiltinBlit(cameraTarget, tempRt, RuntimeUtilities.copyStdMaterial, stopNaNPropagation ? 1 : 0);
    606: if (!m_NaNKilled)
    607: m_NaNKilled = stopNaNPropagation;

    PostProcessLayer.OnPreCull() Library/PackageCache/com.unity.postprocessing@2.2.2/PostProcessing/Runtime/PostProcessLayer.cs:440
    438: }
    -->440: BuildCommandBuffers();
    441: }


    Thanks again.
     
    Gregoryl likes this.