From ffcf433ae61664a03fc4b71200bf457c672e65a3 Mon Sep 17 00:00:00 2001 From: Gabriel de la Cruz Date: Tue, 7 Sep 2021 10:28:51 +0200 Subject: [PATCH 1/9] Fix sanitize of exposed Camera parameters --- com.unity.visualeffectgraph/CHANGELOG.md | 1 + .../VFXExpressionAbstractValues.cs | 5 ++ .../Implementations/Orientation/Orient.cs | 7 +- .../Editor/Models/Parameters/VFXParameter.cs | 77 +++++++++---------- .../Editor/Models/Slots/VFXSlot.cs | 4 +- .../Editor/Models/VFXSlotContainerModel.cs | 11 +++ 6 files changed, 57 insertions(+), 48 deletions(-) diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 564e505fb6f..b9c8e107a0e 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -101,6 +101,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Unexpected compilation error while modifying ShaderGraph exposed properties [Case 1361601](https://issuetracker.unity3d.com/product/unity/issues/guid/1361601/) - Compilation issue while using new SG integration and SampleTexture/SampleMesh [Case 1359391](https://issuetracker.unity3d.com/product/unity/issues/guid/1359391/) - Eye dropper in the color fields kept updating after pressing the Esc key +- Exposed Camera property fails to upgrade and is converted to a float type [Case 1357685](https://issuetracker.unity3d.com/product/unity/issues/guid/1357685/) ## [11.0.0] - 2020-10-21 ### Added diff --git a/com.unity.visualeffectgraph/Editor/Expressions/VFXExpressionAbstractValues.cs b/com.unity.visualeffectgraph/Editor/Expressions/VFXExpressionAbstractValues.cs index 40b2b062b10..a0adb3b893d 100644 --- a/com.unity.visualeffectgraph/Editor/Expressions/VFXExpressionAbstractValues.cs +++ b/com.unity.visualeffectgraph/Editor/Expressions/VFXExpressionAbstractValues.cs @@ -293,6 +293,11 @@ public override void SetContent(object value) m_Content = obj.GetInstanceID(); return; } + if (value is CameraBuffer cameraBuffer) + { + m_Content = cameraBuffer; + return; + } if (value is GraphicsBuffer) { m_Content = (int)0; diff --git a/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Orientation/Orient.cs b/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Orientation/Orient.cs index c0fdf8abd35..6c16b8481dd 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Orientation/Orient.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Orientation/Orient.cs @@ -321,9 +321,10 @@ public override void Sanitize(int version) /* Slot of type position has changed from undefined VFXSlot to VFXSlotPosition*/ if (GetNbInputSlots() > 0 && !(GetInputSlot(0) is VFXSlotPosition)) { - var oldValue = GetInputSlot(0).value; - RemoveSlot(GetInputSlot(0)); - AddSlot(VFXSlot.Create(new VFXProperty(typeof(Position), "Position"), VFXSlot.Direction.kInput, oldValue)); + VFXSlot oldSlot = GetInputSlot(0); + var oldValue = oldSlot.value; + VFXSlot newSlot = VFXSlot.Create(new VFXProperty(typeof(Position), "Position"), VFXSlot.Direction.kInput, oldValue); + ReplaceSlot(oldSlot, newSlot); } } base.Sanitize(version); diff --git a/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs b/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs index 3bcd23e06a2..cd2963d5521 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXParameter.cs @@ -170,11 +170,11 @@ public bool isOutput if (m_IsOutput) { - var newSlot = VFXSlot.Create(new VFXProperty(outputSlots[0].property.type, "i"), VFXSlot.Direction.kInput); - newSlot.value = outputSlots[0].value; - outputSlots[0].UnlinkAll(true); - RemoveSlot(outputSlots[0]); - AddSlot(newSlot); + var oldSlot = outputSlots[0]; + var newSlot = VFXSlot.Create(new VFXProperty(oldSlot.property.type, "i"), VFXSlot.Direction.kInput); + newSlot.value = oldSlot.value; + oldSlot.UnlinkAll(true); + ReplaceSlot(oldSlot, newSlot); if (m_Nodes != null && m_Nodes.Count > 1) { @@ -186,12 +186,12 @@ public bool isOutput } else { - var newSlot = VFXSlot.Create(new VFXProperty(inputSlots[0].property.type, "o"), VFXSlot.Direction.kOutput); - newSlot.value = inputSlots[0].value; - inputSlots[0].UnlinkAll(true); - RemoveSlot(inputSlots[0]); - AddSlot(newSlot); - m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); + var oldSlot = inputSlots[0]; + var newSlot = VFXSlot.Create(new VFXProperty(oldSlot.property.type, "o"), VFXSlot.Direction.kOutput); + newSlot.value = oldSlot.value; + oldSlot.UnlinkAll(true); + ReplaceSlot(oldSlot, newSlot); + ResetOutputValueExpression(); } } @@ -201,8 +201,10 @@ public bool isOutput public void ResetOutputValueExpression() { - if (!m_IsOutput) - m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); + Debug.Assert(!m_IsOutput); + + m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); + m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); } public bool canHaveValueFilter @@ -315,16 +317,7 @@ private void OnModified(VFXObject obj, bool uiChange) { if (!isOutput && (m_ExprSlots == null || m_ValueExpr == null)) { - if (outputSlots.Count != 0) - { - m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); - m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); - } - else - { - m_ExprSlots = new VFXSlot[0]; - m_ValueExpr = new VFXValue[0]; - } + ResetOutputValueExpression(); } } @@ -431,13 +424,11 @@ protected sealed override void OnInvalidate(VFXModel model, InvalidationCause ca { UpdateDefaultExpressionValue(); } - } - public void UpdateDefaultExpressionValue() - { - if (!isOutput) - for (int i = 0; i < m_ExprSlots.Length; ++i) - m_ValueExpr[i].SetContent(m_ExprSlots[i].value); + if (cause == InvalidationCause.kStructureChanged) + { + ResetOutputValueExpression(); + } } protected override IEnumerable inputProperties @@ -473,8 +464,8 @@ public void Init(Type _type) { throw new InvalidOperationException("Cannot init VFXParameter"); } - m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); - m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); + + ResetOutputValueExpression(); } public override void OnEnable() @@ -482,18 +473,9 @@ public override void OnEnable() base.OnEnable(); onModified += OnModified; - if (!isOutput) + if (!isOutput && outputSlots.Count > 0) { - if (outputSlots.Count != 0) - { - m_ExprSlots = outputSlots[0].GetVFXValueTypeSlots().ToArray(); - m_ValueExpr = m_ExprSlots.Select(t => t.DefaultExpression(valueMode)).ToArray(); - } - else - { - m_ExprSlots = new VFXSlot[0]; - m_ValueExpr = new VFXValue[0]; - } + ResetOutputValueExpression(); } if (m_Nodes != null) @@ -730,6 +712,17 @@ public bool subgraphMode get; set; } + public void UpdateDefaultExpressionValue() + { + if (!isOutput) + { + for (int i = 0; i < m_ExprSlots.Length; ++i) + { + m_ValueExpr[i].SetContent(m_ExprSlots[i].value); + } + } + } + public override void UpdateOutputExpressions() { if (!isOutput) diff --git a/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs b/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs index 462b6730404..97bfd6d54ba 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Slots/VFXSlot.cs @@ -606,9 +606,7 @@ public VFXSlot Recreate() var owner = this.owner; if (owner != null) { - int index = owner.GetSlotIndex(this); - owner.RemoveSlot(this); - owner.AddSlot(newSlot, index); + owner.ReplaceSlot(this, newSlot); } } else diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs b/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs index 51999229685..56bbe504a7f 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXSlotContainerModel.cs @@ -22,6 +22,7 @@ interface IVFXSlotContainer void AddSlot(VFXSlot slot, int index = -1); void RemoveSlot(VFXSlot slot); + void ReplaceSlot(VFXSlot prevSlot, VFXSlot newSlot); int GetSlotIndex(VFXSlot slot); @@ -169,6 +170,16 @@ private void InnerRemoveSlot(VFXSlot slot, bool notify) } } + public virtual void ReplaceSlot(VFXSlot prevSlot, VFXSlot newSlot) { InnerReplaceSlot(prevSlot, newSlot, true); } + private void InnerReplaceSlot(VFXSlot prevSlot, VFXSlot newSlot, bool notify) + { + int index = GetSlotIndex(prevSlot); + InnerRemoveSlot(prevSlot, false); + InnerAddSlot(newSlot, index, false); + if (notify) + Invalidate(InvalidationCause.kStructureChanged); + } + public int GetSlotIndex(VFXSlot slot) { var slotList = slot.direction == VFXSlot.Direction.kInput ? m_InputSlots : m_OutputSlots; From b388445fa2ad082580546796f7fdac42bf77bd47 Mon Sep 17 00:00:00 2001 From: Ludovic Theobald Date: Tue, 7 Sep 2021 17:27:47 +0200 Subject: [PATCH 2/9] Fix SDF Baker on PS4/5 failing due to explicit binding --- .../Assets/TestCaseFilters.asset | 18 ---------------- com.unity.visualeffectgraph/CHANGELOG.md | 1 + .../Runtime/Utilities/SDF/MeshToSDFBaker.cs | 21 ++++++++++++------- .../Shaders/SDFBaker/RayMapVoxelize.shader | 4 +++- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/TestCaseFilters.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/TestCaseFilters.asset index 201697e1da8..bf84b5f6c60 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/TestCaseFilters.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/TestCaseFilters.asset @@ -23,24 +23,6 @@ MonoBehaviour: XrSdk: StereoModes: 0 Reason: See https://jira.unity3d.com/browse/URP-723 - - FilteredScene: {fileID: 0} - FilteredScenes: - - {fileID: 102900000, guid: ebaa785ec5cfd50448e6b1fca17c280f, type: 3} - ColorSpace: -1 - BuildPlatform: 31 - GraphicsDevice: 4 - XrSdk: - StereoModes: 0 - Reason: See https://fogbugz.unity3d.com/f/cases/1351595/ - - FilteredScene: {fileID: 0} - FilteredScenes: - - {fileID: 102900000, guid: ebaa785ec5cfd50448e6b1fca17c280f, type: 3} - ColorSpace: -1 - BuildPlatform: 44 - GraphicsDevice: 4 - XrSdk: - StereoModes: 0 - Reason: See https://fogbugz.unity3d.com/f/cases/1351595/ - FilteredScene: {fileID: 0} FilteredScenes: - {fileID: 102900000, guid: 0379b72b85eee8045afdaec3b1362957, type: 3} diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index b9c8e107a0e..8cb5add1cae 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -102,6 +102,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Compilation issue while using new SG integration and SampleTexture/SampleMesh [Case 1359391](https://issuetracker.unity3d.com/product/unity/issues/guid/1359391/) - Eye dropper in the color fields kept updating after pressing the Esc key - Exposed Camera property fails to upgrade and is converted to a float type [Case 1357685](https://issuetracker.unity3d.com/product/unity/issues/guid/1357685/) +- Fix SDF Baker fail on PS4 & PS5 [Case 1351595](https://fogbugz.unity3d.com/f/cases/1351595/) ## [11.0.0] - 2020-10-21 ### Added diff --git a/com.unity.visualeffectgraph/Runtime/Utilities/SDF/MeshToSDFBaker.cs b/com.unity.visualeffectgraph/Runtime/Utilities/SDF/MeshToSDFBaker.cs index 32e8079dfd2..5bcd569762f 100644 --- a/com.unity.visualeffectgraph/Runtime/Utilities/SDF/MeshToSDFBaker.cs +++ b/com.unity.visualeffectgraph/Runtime/Utilities/SDF/MeshToSDFBaker.cs @@ -52,6 +52,13 @@ private GraphicsBuffer internal static uint kMaxGridSize = 1 << 24; + //TODO: Use PLATFORM_UAVS_SEPARATE_TO_RTS (or equivalent) when it will be available +#if (UNITY_PS4 || UNITY_PS5) && (!UNITY_EDITOR) + private static int kNbActualRT = 1; +#else + private static int kNbActualRT = 0; +#endif + internal VFXRuntimeResources m_RuntimeResources; private struct Triangle @@ -739,10 +746,10 @@ private void SecondDraw() for (var i = 0; i < 3; i++) { m_Cmd.SetRenderTarget(m_RenderTextureViews[i]); - m_Cmd.SetRandomWriteTarget(3, m_TrianglesInVoxels, false); - m_Cmd.SetRandomWriteTarget(2, m_AccumCounterBuffer, false); - m_Cmd.SetViewProjectionMatrices(m_ViewMat[i], m_ProjMat[i]); m_Cmd.ClearRenderTarget(true, true, Color.black, 1.0f); + m_Cmd.SetRandomWriteTarget(3 + kNbActualRT, m_TrianglesInVoxels, false); + m_Cmd.SetRandomWriteTarget(2 + kNbActualRT, m_AccumCounterBuffer, false); + m_Cmd.SetViewProjectionMatrices(m_ViewMat[i], m_ProjMat[i]); m_Cmd.DrawProcedural(Matrix4x4.identity, m_Material[i], 1, MeshTopology.Triangles, nTriangles * 3); } @@ -767,11 +774,11 @@ private void FirstDraw() { m_Cmd.ClearRandomWriteTargets(); m_Cmd.SetRenderTarget(m_RenderTextureViews[i]); - m_Cmd.SetRandomWriteTarget(4, m_AabbBuffer, false); - m_Cmd.SetRandomWriteTarget(1, m_bufferVoxel, false); - m_Cmd.SetRandomWriteTarget(2, m_CounterBuffer, false); - m_Cmd.SetViewProjectionMatrices(m_ViewMat[i], m_ProjMat[i]); m_Cmd.ClearRenderTarget(true, true, Color.black, 1.0f); + m_Cmd.SetRandomWriteTarget(4 + kNbActualRT, m_AabbBuffer, false); + m_Cmd.SetRandomWriteTarget(1 + kNbActualRT, m_bufferVoxel, false); + m_Cmd.SetRandomWriteTarget(2 + kNbActualRT, m_CounterBuffer, false); + m_Cmd.SetViewProjectionMatrices(m_ViewMat[i], m_ProjMat[i]); m_Cmd.DrawProcedural(Matrix4x4.identity, m_Material[i], 0, MeshTopology.Triangles, nTriangles * 3); } diff --git a/com.unity.visualeffectgraph/Shaders/SDFBaker/RayMapVoxelize.shader b/com.unity.visualeffectgraph/Shaders/SDFBaker/RayMapVoxelize.shader index 0841c572549..a601636e6ad 100644 --- a/com.unity.visualeffectgraph/Shaders/SDFBaker/RayMapVoxelize.shader +++ b/com.unity.visualeffectgraph/Shaders/SDFBaker/RayMapVoxelize.shader @@ -20,12 +20,14 @@ Shader "Hidden/VoxelizeShader" float4 position : SV_POSITION; uint triangleID : TEXCOORD0; }; - RWStructuredBuffer voxels : register(u1); StructuredBuffer vertices; StructuredBuffer coordFlip; + + RWStructuredBuffer voxels : register(u1); RWStructuredBuffer aabb : register(u4); RWStructuredBuffer counter : register(u2); RWStructuredBuffer triangleIDs : register(u3); + int currentAxis; int dimX, dimY, dimZ; From 73c30a7e9f9a3a0f0ce0fc21c1702cbe8b098170 Mon Sep 17 00:00:00 2001 From: Julien Amsellem Date: Thu, 16 Sep 2021 12:06:33 +0200 Subject: [PATCH 3/9] Fixed NRE when starting play mode (#279) * Fixed NRE when starting play mode * Save auto-attach lock state and attached VFX in the editor prefs to avoid loosing them when going in play mode * Better restore attached VFX when leaving play mode (even if it has been removed during play) --- .../Editor/GraphView/VFXViewWindow.cs | 2 + .../Editor/GraphView/Views/VFXView.cs | 101 +++++++++++++++++- .../Inspector/AdvancedVisualEffectEditor.cs | 2 +- 3 files changed, 100 insertions(+), 5 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 6c3b078994a..38f2866754f 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -219,6 +219,8 @@ protected void OnDestroy() graphView.UnregisterCallback(OnEnterPanel); graphView.UnregisterCallback(OnLeavePanel); graphView.controller = null; + graphView.Dispose(); + graphView = null; } currentWindow = null; } diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index 701d5866d98..6283f07b43c 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -109,7 +109,66 @@ public void StartEdgeDragInfo(VFXDataAnchor draggedAnchor, VFXDataAnchor overAnc } } - class VFXView : GraphView, IControlledElement, IControllerListener + struct VFXViewSettings + { + private bool m_IsAttachedLocked; + private VisualEffect m_AttachedVisualEffect; + + public void Load(bool force = false) + { + m_IsAttachedLocked = EditorPrefs.GetBool(nameof(m_IsAttachedLocked)); + if (EditorApplication.isPlaying || force) + { + var attachedVisualEffectPath = EditorPrefs.GetString(nameof(m_AttachedVisualEffect)); + if (!string.IsNullOrEmpty(attachedVisualEffectPath)) + { + var go = GameObject.Find(attachedVisualEffectPath); + if (go != null) + { + m_AttachedVisualEffect = go.GetComponent(); + } + } + } + } + + public VisualEffect AttachedVisualEffect + { + get => m_AttachedVisualEffect; + set + { + m_AttachedVisualEffect = value; + if (!EditorApplication.isPlaying) + { + if (m_AttachedVisualEffect != null) + { + var go = m_AttachedVisualEffect.gameObject; + var path = go.GetComponentsInParent() + .Select(x => x.name) + .Reverse() + .ToArray(); + + EditorPrefs.SetString(nameof(m_AttachedVisualEffect), "/" + string.Join('/', path)); + } + else + { + EditorPrefs.SetString(nameof(m_AttachedVisualEffect), null); + } + } + } + } + + public bool AttachedLocked + { + get => m_IsAttachedLocked; + set + { + m_IsAttachedLocked = value; + EditorPrefs.SetBool(nameof(m_IsAttachedLocked), m_IsAttachedLocked); + } + } + } + + class VFXView : GraphView, IControlledElement, IControllerListener, IDisposable { private const int MaximumNameLengthInNotification = 128; @@ -126,7 +185,7 @@ internal static class Contents public HashSet allDataAnchors = new HashSet(); - public bool locked { get; private set; } + public bool locked => m_VFXSettings.AttachedLocked; void IControllerListener.OnControllerEvent(ControllerEvent e) { @@ -140,6 +199,7 @@ void IControllerListener.OnControllerEvent(ControllerEvent e) } } + VFXViewSettings m_VFXSettings; VisualElement m_NoAssetLabel; VisualElement m_LockedElement; @@ -424,6 +484,7 @@ public void OnCreateAsset() public VFXView() { + EditorApplication.playModeStateChanged += OnPlayModeStateChanged; SetupZoom(0.125f, 8); this.AddManipulator(new ContentDragger()); @@ -573,6 +634,10 @@ public VFXView() Add(m_Toolbar); m_Toolbar.SetEnabled(false); + m_VFXSettings = new VFXViewSettings(); + m_VFXSettings.Load(); + m_LockToggle.value = m_VFXSettings.AttachedLocked; + RegisterCallback(OnDragUpdated); RegisterCallback(OnDragPerform); RegisterCallback(ValidateCommand); @@ -590,7 +655,29 @@ public VFXView() RegisterCallback(OnFirstResize); } - private void OnOpenAttachMenu() + public void Dispose() + { + UnregisterCallback(OnDragUpdated); + UnregisterCallback(OnDragPerform); + UnregisterCallback(ValidateCommand); + UnregisterCallback(ExecuteCommand); + UnregisterCallback(OnEnterPanel); + UnregisterCallback(OnLeavePanel); + UnregisterCallback(OnKeyDownEvent); + UnregisterCallback(OnFirstResize); + EditorApplication.playModeStateChanged -= OnPlayModeStateChanged; + } + + void OnPlayModeStateChanged(PlayModeStateChange playModeState) + { + if (playModeState == PlayModeStateChange.EnteredEditMode) + { + m_VFXSettings.Load(true); + TryAttachTo(m_VFXSettings.AttachedVisualEffect); + } + } + + void OnOpenAttachMenu() { var attachPanel = ScriptableObject.CreateInstance(); var bounds = new Rect(ViewToScreenPosition(m_AttachDropDownButton.worldBound.position), m_AttachDropDownButton.worldBound.size); @@ -788,6 +875,7 @@ public bool TryAttachTo(VisualEffect selectedAsset) attached = m_ComponentBoard.Attach(selectedAsset); } + m_VFXSettings.AttachedVisualEffect = attached ? selectedAsset : null; UpdateToolbarButtons(); return attached; } @@ -843,7 +931,7 @@ void OnUndoPerformed() void OnToggleLock(ChangeEvent evt) { - locked = !locked; + m_VFXSettings.AttachedLocked = !locked; if (!locked) { AttachToSelection(); @@ -1062,6 +1150,11 @@ void NewControllerSet() m_Toolbar.SetEnabled(false); } } + + if (m_VFXSettings.AttachedVisualEffect != null) + { + TryAttachTo(m_VFXSettings.AttachedVisualEffect); + } } public void OnFocus() diff --git a/com.unity.visualeffectgraph/Editor/Inspector/AdvancedVisualEffectEditor.cs b/com.unity.visualeffectgraph/Editor/Inspector/AdvancedVisualEffectEditor.cs index 0ab335620e1..91f944e141f 100644 --- a/com.unity.visualeffectgraph/Editor/Inspector/AdvancedVisualEffectEditor.cs +++ b/com.unity.visualeffectgraph/Editor/Inspector/AdvancedVisualEffectEditor.cs @@ -766,7 +766,7 @@ private void DetachIfDeleted() if (EditorWindow.HasOpenInstances()) { VFXViewWindow window = EditorWindow.GetWindowDontShow(); - window.graphView.DetachIfDeleted(); + window.graphView?.DetachIfDeleted(); } } } From 0f3e95db4269bc3b66c1990e17383a12fd1855fb Mon Sep 17 00:00:00 2001 From: julienf-unity Date: Thu, 9 Sep 2021 17:02:47 +0200 Subject: [PATCH 4/9] Fix compil error when cubemap array is used in compute (even on platform supporting it) (#5582) --- com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl b/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl index 7a89892ff19..aaa28c2d851 100644 --- a/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl +++ b/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl @@ -38,6 +38,14 @@ #define UNITY_INV_HALF_PI 0.636619772367f #endif +// SHADER_AVAILABLE_XXX defines are not yet passed to compute shader atm +// So we define it manually for compute atm. +// It won't compile for devices that don't have cubemap array support but this is acceptable by now +// TODO Remove this once SHADER_AVAILABLE_XXX are passed to compute shaders +#ifdef SHADER_STAGE_COMPUTE +#define SHADER_AVAILABLE_CUBEARRAY 1 +#endif + struct VFXSampler2D { Texture2D t; From 9520db9b4b525f35145f213c8b68faa7ff397bcf Mon Sep 17 00:00:00 2001 From: jfryer_unity Date: Fri, 17 Sep 2021 12:25:25 +0200 Subject: [PATCH 5/9] Update HDRP assets --- .../Editor/Tests/Modify_SG_Property.vfx | 61 ----- .../VFXTests/GraphicsTests/07_UnityLogo.unity | 245 ++++++++++++++---- .../GraphicsTests/Materials/Unlit_White.mat | 6 +- .../SampleScene/ShadergraphSampleScene.unity | 2 + .../ShadergraphSampleScene/LightingData.asset | Bin 22244 -> 22244 bytes .../ShadergraphSampleSceneSettings.lighting | 5 +- .../Assets/HDRP/HDRenderPipelineAsset.asset | 14 +- .../HDRenderPipelineGlobalSettings.asset | 9 +- .../018_CollisionScaledPrimitive.png.meta | 8 +- .../ProjectSettings/VFXManager.asset | 2 +- 10 files changed, 228 insertions(+), 124 deletions(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/Modify_SG_Property.vfx b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/Modify_SG_Property.vfx index 29ece2c6b19..44ad61cbb40 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/Modify_SG_Property.vfx +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/Modify_SG_Property.vfx @@ -669,40 +669,6 @@ MonoBehaviour: - 4 primitiveType: 1 useGeometryShader: 0 ---- !u!114 &8926484042661614586 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 70a331b1d86cc8d4aa106ccbe0da5852, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UIIgnoredErrors: [] - m_Parent: {fileID: 0} - m_Children: [] - m_UIPosition: {x: 0, y: 0} - m_UICollapsed: 1 - m_UISuperCollapsed: 0 - m_MasterSlot: {fileID: 8926484042661614586} - m_MasterData: - m_Owner: {fileID: 0} - m_Value: - m_Type: - m_SerializableType: UnityEngine.Texture2D, UnityEngine.CoreModule, Version=0.0.0.0, - Culture=neutral, PublicKeyToken=null - m_SerializableObject: '{"obj":{"fileID":2800000,"guid":"276d9e395ae18fe40a9b4988549f2349","type":3}}' - m_Space: 2147483647 - m_Property: - name: mainTexture - m_serializedType: - m_SerializableType: UnityEngine.Texture2D, UnityEngine.CoreModule, Version=0.0.0.0, - Culture=neutral, PublicKeyToken=null - m_Direction: 0 - m_LinkedSlots: [] --- !u!114 &8926484042661614590 MonoBehaviour: m_ObjectHideFlags: 0 @@ -744,33 +710,6 @@ MonoBehaviour: title: m_Owners: - {fileID: 8926484042661614555} ---- !u!114 &8926484042661614596 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: d78581a96eae8bf4398c282eb0b098bd, type: 3} - m_Name: - m_EditorClassIdentifier: - m_UIIgnoredErrors: [] - m_Parent: {fileID: 0} - m_Children: [] - m_UIPosition: {x: 0, y: 0} - m_UICollapsed: 1 - m_UISuperCollapsed: 0 - title: - m_Owners: [] - dataType: 0 - capacity: 128 - stripCapacity: 1 - particlePerStripCount: 128 - needsComputeBounds: 0 - boundsSettingMode: 0 - m_Space: 0 --- !u!114 &8926484042661614597 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/07_UnityLogo.unity b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/07_UnityLogo.unity index b51c2654c95..266a246abc3 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/07_UnityLogo.unity +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/07_UnityLogo.unity @@ -23,7 +23,7 @@ RenderSettings: m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} - m_AmbientIntensity: 0 + m_AmbientIntensity: 1 m_AmbientMode: 0 m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} m_SkyboxMaterial: {fileID: 0} @@ -35,27 +35,26 @@ RenderSettings: m_DefaultReflectionMode: 0 m_DefaultReflectionResolution: 128 m_ReflectionBounces: 1 - m_ReflectionIntensity: 0 + m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 11 + serializedVersion: 12 m_GIWorkflowMode: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 m_IndirectOutputScale: 1 m_AlbedoBoost: 1 - m_TemporalCoherenceThreshold: 1 m_EnvironmentLightingMode: 0 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 m_LightmapEditorSettings: - serializedVersion: 10 + serializedVersion: 12 m_Resolution: 2 m_BakeResolution: 40 m_AtlasSize: 1024 @@ -63,6 +62,7 @@ LightmapSettings: m_AOMaxDistance: 1 m_CompAOExponent: 1 m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 m_Padding: 2 m_LightmapParameters: {fileID: 0} m_LightmapsBakeMode: 1 @@ -77,10 +77,16 @@ LightmapSettings: m_PVRDirectSampleCount: 32 m_PVRSampleCount: 500 m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 m_PVRFilterTypeDirect: 0 m_PVRFilterTypeIndirect: 0 m_PVRFilterTypeAO: 0 - m_PVRFilteringMode: 1 + m_PVREnvironmentMIS: 0 m_PVRCulling: 1 m_PVRFilteringGaussRadiusDirect: 1 m_PVRFilteringGaussRadiusIndirect: 5 @@ -88,9 +94,12 @@ LightmapSettings: m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 - m_ShowResolutionOverlay: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 m_LightingDataAsset: {fileID: 0} - m_UseShadowmask: 1 + m_LightingSettings: {fileID: 4890085278179872738, guid: 2c4f120e00b444a479dfb5d07fbcdd35, + type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -110,6 +119,8 @@ NavMeshSettings: manualTileSize: 0 tileSize: 256 accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 debug: m_Flags: 0 m_NavMeshData: {fileID: 0} @@ -161,54 +172,118 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 23c1ce4fb46143f46bc5cb5224c934f6, type: 3} m_Name: m_EditorClassIdentifier: - m_Version: 1 clearColorMode: 1 backgroundColorHDR: {r: 0, g: 0, b: 0, a: 0} clearDepth: 1 - renderingPath: 0 volumeLayerMask: serializedVersion: 2 m_Bits: 4294967295 volumeAnchorOverride: {fileID: 0} - aperture: 8 - shutterSpeed: 0.005 - iso: 400 - m_FrameSettings: - enableShadow: 1 - enableContactShadows: 1 - enableShadowMask: 1 - enableSSR: 1 - enableSSAO: 1 - enableSubsurfaceScattering: 1 - enableTransmission: 1 - enableAtmosphericScattering: 1 - enableVolumetrics: 1 - enableLightLayers: 1 - diffuseGlobalDimmer: 1 - specularGlobalDimmer: 1 - enableForwardRenderingOnly: 0 + antialiasing: 0 + SMAAQuality: 2 + dithering: 0 + stopNaNs: 0 + taaSharpenStrength: 0.5 + TAAQuality: 1 + taaHistorySharpening: 0.35 + taaAntiFlicker: 0.5 + taaMotionVectorRejection: 0 + taaAntiHistoryRinging: 0 + taaBaseBlendFactor: 0.875 + physicalParameters: + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + flipYMode: 0 + xrRendering: 1 + fullscreenPassthrough: 0 + allowDynamicResolution: 0 + customRenderingSettings: 0 + invertFaceCulling: 0 + probeLayerMask: + serializedVersion: 2 + m_Bits: 4294967295 + hasPersistentHistory: 0 + allowDeepLearningSuperSampling: 1 + deepLearningSuperSamplingUseCustomQualitySettings: 0 + deepLearningSuperSamplingQuality: 0 + deepLearningSuperSamplingUseCustomAttributes: 0 + deepLearningSuperSamplingUseOptimalSettings: 1 + deepLearningSuperSamplingSharpening: 0 + exposureTarget: {fileID: 0} + materialMipBias: 0 + m_RenderingPathCustomFrameSettings: + bitDatas: + data1: 72130090367975244 + data2: 13763000477350330392 + lodBias: 1 + lodBiasMode: 0 + lodBiasQualityLevel: 0 + maximumLODLevel: 0 + maximumLODLevelMode: 0 + maximumLODLevelQualityLevel: 0 + sssQualityMode: 0 + sssQualityLevel: 0 + sssCustomSampleBudget: 20 + msaaMode: 1 + materialQuality: 0 + renderingPathCustomFrameSettingsOverrideMask: + mask: + data1: 0 + data2: 0 + defaultFrameSettings: 0 + m_Version: 8 + m_ObsoleteRenderingPath: 0 + m_ObsoleteFrameSettings: + overrides: 0 + enableShadow: 0 + enableContactShadows: 0 + enableShadowMask: 0 + enableSSR: 0 + enableSSAO: 0 + enableSubsurfaceScattering: 0 + enableTransmission: 0 + enableAtmosphericScattering: 0 + enableVolumetrics: 0 + enableReprojectionForVolumetrics: 0 + enableLightLayers: 0 + enableExposureControl: 1 + diffuseGlobalDimmer: 0 + specularGlobalDimmer: 0 + shaderLitMode: 0 enableDepthPrepassWithDeferredRendering: 0 - enableTransparentPrepass: 1 - enableMotionVectors: 1 - enableObjectMotionVectors: 1 - enableDecals: 1 - enableRoughRefraction: 1 - enableTransparentPostpass: 1 - enableDistortion: 1 - enablePostprocess: 1 - enableStereo: 1 - enableAsyncCompute: 1 - enableOpaqueObjects: 1 - enableTransparentObjects: 1 + enableTransparentPrepass: 0 + enableMotionVectors: 0 + enableObjectMotionVectors: 0 + enableDecals: 0 + enableRoughRefraction: 0 + enableTransparentPostpass: 0 + enableDistortion: 0 + enablePostprocess: 0 + enableOpaqueObjects: 0 + enableTransparentObjects: 0 + enableRealtimePlanarReflection: 0 enableMSAA: 0 + enableAsyncCompute: 0 + runLightListAsync: 0 + runSSRAsync: 0 + runSSAOAsync: 0 + runContactShadowsAsync: 0 + runVolumeVoxelizationAsync: 0 lightLoopSettings: - enableTileAndCluster: 1 - enableComputeLightEvaluation: 1 - enableComputeLightVariants: 1 - enableComputeMaterialVariants: 1 - enableFptlForForwardOpaque: 1 - enableBigTilePrepass: 1 - isFptlEnabled: 1 + overrides: 0 + enableDeferredTileAndCluster: 0 + enableComputeLightEvaluation: 0 + enableComputeLightVariants: 0 + enableComputeMaterialVariants: 0 + enableFptlForForwardOpaque: 0 + enableBigTilePrepass: 0 + isFptlEnabled: 0 --- !u!20 &80150113 Camera: m_ObjectHideFlags: 0 @@ -221,9 +296,10 @@ Camera: m_ClearFlags: 2 m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_GateFitMode: 2 m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 @@ -261,6 +337,7 @@ Transform: m_LocalRotation: {x: -0.00004331348, y: -0.99919534, z: -0.0041923258, w: 0.039888535} m_LocalPosition: {x: 0.67, y: 0.05, z: 4.7} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -275,6 +352,7 @@ GameObject: m_Component: - component: {fileID: 119120843} - component: {fileID: 119120842} + - component: {fileID: 119120844} m_Layer: 0 m_Name: Logo m_TagString: Untagged @@ -291,8 +369,11 @@ VisualEffect: m_GameObject: {fileID: 119120841} m_Enabled: 1 m_Asset: {fileID: 8926484042661614526, guid: 78b579043ed563646a8189556bdf8e4f, type: 3} + m_InitialEventName: OnPlay + m_InitialEventNameOverriden: 0 m_StartSeed: 0 m_ResetSeedOnPlay: 0 + m_ResourceVersion: 1 m_PropertySheet: m_Float: m_Array: [] @@ -326,10 +407,51 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!73398921 &119120844 +VFXRenderer: + serializedVersion: 1 + m_ObjectHideFlags: 2 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 119120841} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 0 + m_LightProbeUsage: 0 + m_ReflectionProbeUsage: 0 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 257 + m_RendererPriority: 0 + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 --- !u!1 &539400790 GameObject: m_ObjectHideFlags: 0 @@ -355,12 +477,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 539400790} m_Enabled: 1 - serializedVersion: 8 + serializedVersion: 10 m_Type: 1 + m_Shape: 0 m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Intensity: 1 m_Range: 10 m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 m_CookieSize: 10 m_Shadows: m_Type: 2 @@ -370,6 +494,24 @@ Light: m_Bias: 0.05 m_NormalBias: 0.4 m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 m_Cookie: {fileID: 0} m_DrawHalo: 0 m_Flare: {fileID: 0} @@ -377,12 +519,16 @@ Light: m_CullingMask: serializedVersion: 2 m_Bits: 4294967295 + m_RenderingLayerMask: 1 m_Lightmapping: 4 m_LightShadowCasterMode: 0 m_AreaSize: {x: 1, y: 1} m_BounceIntensity: 1 m_ColorTemperature: 6570 m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 m_ShadowRadius: 0 m_ShadowAngle: 0 --- !u!4 &539400792 @@ -395,6 +541,7 @@ Transform: m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 1 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Materials/Unlit_White.mat b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Materials/Unlit_White.mat index 9c160049586..75c1e803f7c 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Materials/Unlit_White.mat +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Materials/Unlit_White.mat @@ -154,6 +154,7 @@ Material: - _DistortionVectorBias: -1 - _DistortionVectorScale: 2 - _DoubleSidedEnable: 0 + - _DoubleSidedGIMode: 0 - _DoubleSidedNormalMode: 1 - _Drag: 1 - _DstBlend: 0 @@ -239,7 +240,7 @@ Material: - _ZWrite: 1 m_Colors: - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - - _Color: {r: 0, g: 0, b: 0, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} - _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0} - _EmissionColor: {r: 1, g: 1, b: 1, a: 1} - _EmissiveColor: {r: 0, g: 0, b: 0, a: 1} @@ -268,3 +269,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: version: 12 + hdPluginSubTargetMaterialVersions: + m_Keys: [] + m_Values: diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleScene.unity b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleScene.unity index 5767fed46e4..4189df89d86 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleScene.unity +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleScene.unity @@ -629,6 +629,7 @@ MonoBehaviour: taaAntiFlicker: 0.5 taaMotionVectorRejection: 0 taaAntiHistoryRinging: 0 + taaBaseBlendFactor: 0.875 physicalParameters: m_Iso: 200 m_ShutterSpeed: 0.005 @@ -1166,6 +1167,7 @@ MonoBehaviour: m_Profile: {fileID: 0} m_StaticLightingSkyUniqueID: 0 m_StaticLightingCloudsUniqueID: 0 + m_StaticLightingVolumetricClouds: 0 --- !u!4 &1232081455 Transform: m_ObjectHideFlags: 1 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleScene/LightingData.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleScene/LightingData.asset index 4a2dfe6374a4f4d56488bc7e389bf0d1cb55782d..aa6871a5629f478cc5ee5a299b165afeb7a9ca0f 100644 GIT binary patch delta 206 zcmaE|mhs72#t9b8NruK7tt;FGz2oO@<`Hc7@AO}mGhbBVJoDs250lM5+!ryb0hKU7 zfftbG0%8duKK%cG1CRm%m!JUs%?CV_m&@Gc_&LCVvbHXFRdlGuW9?;i*v9KFMB<-OhhStXE76*ukM^Y~fwMZs&E)Cd*~p Q5AK@m5aP4>N5~sS09uJW?f?J) delta 206 zcmaE|mhs72#t9b8iG~&%tt;FGCI9|?zG}%C?=_siA4M~WGc!*v^f1}{!+jB>8c+!X z6nFt?E+Ccw;=`H6rHMJNX=$m+CGJIun-6#z;Z_S#Q;-qw;Sv;}zgfcj2)k&6VAsAC zZ#j1}NDJ=P%uclUJ5$p_ee%bkaKeLz#ulFS Z>vlfTY_eRv{ot<24k139e}ueY1OR@BMsffE diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleSceneSettings.lighting b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleSceneSettings.lighting index 7d475d42588..144411191db 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleSceneSettings.lighting +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/VFXTests/GraphicsTests/Shadergraph/SampleScene/ShadergraphSampleSceneSettings.lighting @@ -7,7 +7,7 @@ LightingSettings: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: ShadergraphSampleSceneSettings - serializedVersion: 3 + serializedVersion: 4 m_GIWorkflowMode: 1 m_EnableBakedLightmaps: 1 m_EnableRealtimeLightmaps: 0 @@ -20,7 +20,7 @@ LightingSettings: m_LightmapMaxSize: 1024 m_BakeResolution: 40 m_Padding: 2 - m_TextureCompression: 1 + m_LightmapCompression: 2 m_AO: 0 m_AOMaxDistance: 1 m_CompAOExponent: 1 @@ -61,3 +61,4 @@ LightingSettings: m_PVRFilteringAtrousPositionSigmaDirect: 0.5 m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 + m_PVRTiledBaking: 0 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset index 22c590b718d..53ecd0e5a95 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRP/HDRenderPipelineAsset.asset @@ -44,7 +44,6 @@ MonoBehaviour: decalNormalBufferHP: 1 msaaSampleCount: 1 supportMotionVectors: 1 - supportRuntimeDebugDisplay: 1 supportRuntimeAOVAPI: 0 supportDitheringCrossFade: 1 supportTerrainHole: 0 @@ -132,6 +131,7 @@ MonoBehaviour: forceResolution: 0 forcedPercentage: 100 lowResTransparencyMinimumThreshold: 0 + rayTracingHalfResThreshold: 50 lowresTransparentSettings: enabled: 1 checkerboardDepthBuffer: 1 @@ -184,7 +184,13 @@ MonoBehaviour: ContactShadowSampleCount: 060000000a00000010000000 SSRMaxRaySteps: 100000002000000040000000 SSGIRaySteps: 200000004000000080000000 - SSGIFilterRadius: 100000000e0000000c000000 + SSGIDenoise: 010101 + SSGIHalfResDenoise: 010000 + SSGIDenoiserRadius: + - 0.75 + - 0.5 + - 0.5 + SSGISecondDenoise: 010101 RTAORayLength: - 0.5 - 3 @@ -204,7 +210,6 @@ MonoBehaviour: - 0.5 - 0.8 - 1.5 - RTGIUpScaleRadius: 040000000400000004000000 RTGIRaySteps: 200000003000000040000000 RTGIDenoise: 010101 RTGIHalfResDenoise: 010000 @@ -259,6 +264,7 @@ MonoBehaviour: m_ObsoleteDecalLayerName5: m_ObsoleteDecalLayerName6: m_ObsoleteDecalLayerName7: + m_ObsoleteSupportRuntimeDebugDisplay: 1 allowShaderVariantStripping: 1 enableSRPBatcher: 1 availableMaterialQualityLevels: -1 @@ -271,7 +277,7 @@ MonoBehaviour: - format: 0 sizeInMegaBytes: 128 m_UseRenderGraph: 1 - m_Version: 20 + m_Version: 21 m_ObsoleteFrameSettings: overrides: 0 enableShadow: 0 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset index 746c7214d84..3ec486b8ab0 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset @@ -65,6 +65,7 @@ MonoBehaviour: m_RenderPipelineRayTracingResources: {fileID: 0} beforeTransparentCustomPostProcesses: [] beforePostProcessCustomPostProcesses: [] + afterPostProcessBlursCustomPostProcesses: [] afterPostProcessCustomPostProcesses: [] beforeTAACustomPostProcesses: [] lightLayerName0: @@ -92,7 +93,11 @@ MonoBehaviour: DLSSProjectId: 000000 useDLSSCustomProjectId: 0 supportProbeVolumes: 0 - apvScenesBounds: + supportRuntimeDebugDisplay: 1 + apvScenesData: serializedBounds: [] serializedHasVolumes: [] - m_Version: 2 + serializedProfiles: [] + serializedBakeSettings: [] + serializedBakingSets: [] + m_Version: 3 diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/018_CollisionScaledPrimitive.png.meta b/TestProjects/VisualEffectGraph_HDRP/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/018_CollisionScaledPrimitive.png.meta index 1cd159d4ab8..0be1f662e81 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/018_CollisionScaledPrimitive.png.meta +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/018_CollisionScaledPrimitive.png.meta @@ -6,7 +6,7 @@ TextureImporter: serializedVersion: 11 mipmaps: mipMapMode: 0 - enableMipMap: 1 + enableMipMap: 0 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 @@ -20,7 +20,7 @@ TextureImporter: externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 - isReadable: 0 + isReadable: 1 streamingMipmaps: 0 streamingMipmapsPriority: 0 vTOnly: 0 @@ -39,7 +39,7 @@ TextureImporter: wrapU: 0 wrapV: 0 wrapW: 0 - nPOTScale: 1 + nPOTScale: 0 lightmap: 0 compressionQuality: 50 spriteMode: 0 @@ -69,7 +69,7 @@ TextureImporter: maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 - textureCompression: 1 + textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 diff --git a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset index 01f261ce956..7ea9bbcb57b 100644 --- a/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset +++ b/TestProjects/VisualEffectGraph_HDRP/ProjectSettings/VFXManager.asset @@ -11,5 +11,5 @@ VFXManager: m_FixedTimeStep: 0.016666668 m_MaxDeltaTime: 0.05 m_CompiledVersion: 3 - m_RuntimeVersion: 19 + m_RuntimeVersion: 20 m_RuntimeResources: {fileID: 11400000, guid: bc10b42afe3813544bffd38ae2cd893d, type: 2} From c6fe054459729ecbfa364708bc0c708a6fac58ca Mon Sep 17 00:00:00 2001 From: jfryer_unity Date: Sun, 19 Sep 2021 23:08:32 +0200 Subject: [PATCH 6/9] Fix failing test --- .../Editor/Templates/SimpleSwarmParticleSystem.vfx | 8 -------- 1 file changed, 8 deletions(-) diff --git a/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx b/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx index f34a2e425c5..95ac80f7f0e 100644 --- a/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx +++ b/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx @@ -847,14 +847,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 081ffb0090424ba4cb05370a42ead6b9, type: 3} m_Name: m_EditorClassIdentifier: - m_UIIgnoredErrors: [] - m_Parent: {fileID: 0} - m_Children: [] - m_UIPosition: {x: 0, y: 0} - m_UICollapsed: 1 - m_UISuperCollapsed: 0 - opaqueRenderQueue: 0 - transparentRenderQueue: 1 --- !u!114 &8926484042661614551 MonoBehaviour: m_ObjectHideFlags: 0 From 69e51e47e91d0d15b5cea830c9aa6788d0659643 Mon Sep 17 00:00:00 2001 From: jfryer_unity Date: Mon, 20 Sep 2021 10:19:52 +0200 Subject: [PATCH 7/9] Fix failing test --- .../Assets/AllTests/Editor/Tests/VFXControllerTests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs index 42c3dc1f996..c3fc3b736ff 100644 --- a/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs +++ b/TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXControllerTests.cs @@ -1099,7 +1099,6 @@ public IEnumerator ConvertToSubGraphOperator_And_ModifySubgraph() Assert.AreNotEqual(oneOutputState, twoOutputState); Assert.IsTrue(twoOutputState.Contains(otherParamName)); - window.graphView.controller = null; for (int i = 0; i < 16; ++i) yield return null; From 2eea326e1fe394b91dee1f066a9ca1c53f6ca68f Mon Sep 17 00:00:00 2001 From: jfryer_unity Date: Mon, 20 Sep 2021 10:20:16 +0200 Subject: [PATCH 8/9] Revert "Fix failing test" This reverts commit c6fe054459729ecbfa364708bc0c708a6fac58ca. --- .../Editor/Templates/SimpleSwarmParticleSystem.vfx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx b/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx index 95ac80f7f0e..f34a2e425c5 100644 --- a/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx +++ b/com.unity.visualeffectgraph/Editor/Templates/SimpleSwarmParticleSystem.vfx @@ -847,6 +847,14 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 081ffb0090424ba4cb05370a42ead6b9, type: 3} m_Name: m_EditorClassIdentifier: + m_UIIgnoredErrors: [] + m_Parent: {fileID: 0} + m_Children: [] + m_UIPosition: {x: 0, y: 0} + m_UICollapsed: 1 + m_UISuperCollapsed: 0 + opaqueRenderQueue: 0 + transparentRenderQueue: 1 --- !u!114 &8926484042661614551 MonoBehaviour: m_ObjectHideFlags: 0 From 6c15ab7322589a70888aa74e1dff8c58e6a06d14 Mon Sep 17 00:00:00 2001 From: julienf-unity Date: Thu, 9 Sep 2021 22:43:08 +0200 Subject: [PATCH 9/9] [VFX] Importer and compilation various fixes #5371 --- com.unity.visualeffectgraph/CHANGELOG.md | 3 +++ .../Editor/GraphView/VFXViewWindow.cs | 1 + .../Views/Controller/VFXViewControllerUndo.cs | 1 + .../Editor/GraphView/Views/VFXView.cs | 5 ++++- .../Editor/Models/Operators/VFXOperator.cs | 3 +++ .../Models/Parameters/VFXDynamicBuiltInParameter.cs | 13 +++++++++++++ .../Editor/Models/VFXGraph.cs | 2 +- 7 files changed, 26 insertions(+), 2 deletions(-) diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md index 61b56b4f9f5..a81a5799010 100644 --- a/com.unity.visualeffectgraph/CHANGELOG.md +++ b/com.unity.visualeffectgraph/CHANGELOG.md @@ -105,6 +105,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Prevent VFX Graph compilation each time a property's min/max value is changed - Exposed Camera property fails to upgrade and is converted to a float type [Case 1357685](https://issuetracker.unity3d.com/product/unity/issues/guid/1357685/) - Fix SDF Baker fail on PS4 & PS5 [Case 1351595](https://fogbugz.unity3d.com/f/cases/1351595/) +- Fix potential infinite compilation when using subgraphs [Case 1346576](https://issuetracker.unity3d.com/product/unity/issues/guid/1346576/) +- Prevent out of sync serialization of VFX assets that could cause the asset to be dirtied without reason +- Fix undetermitism in space with LocalToWorld and WorldToLocal operators [Case 1355820](https://issuetracker.unity3d.com/product/unity/issues/guid/1355820/) ## [11.0.0] - 2020-10-21 ### Added diff --git a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs index 38f2866754f..4bca4ee7f89 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/VFXViewWindow.cs @@ -283,6 +283,7 @@ void Update() { VFXGraph.compileReporter = reporter; AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(graphView.controller.model)); + graph.SetExpressionGraphDirty(false); // As are implemented subgraph now, compiling dependents chain can reset dirty flag on used subgraphs, which will make an infinite loop, this is bad! VFXGraph.compileReporter = null; } VFXGraph.explicitCompile = false; diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs index 3c4d934bf7a..49cf3896190 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewControllerUndo.cs @@ -203,6 +203,7 @@ private void SynchronizeUndoRedoState() m_reentrant = true; ExpressionGraphDirty = true; model.GetOrCreateGraph().UpdateSubAssets(); + EditorUtility.SetDirty(graph); NotifyUpdate(); m_reentrant = false; m_graphUndoStack.CleanDirtyState(); diff --git a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index 6283f07b43c..a06baaa9460 100644 --- a/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -214,7 +214,7 @@ Controller IControlledElement.controller void DisconnectController() { if (controller.model && controller.graph) - controller.graph.SetCompilationMode(VFXCompilationMode.Runtime); + controller.graph.SetCompilationMode(VFXViewPreference.forceEditionCompilation ? VFXCompilationMode.Edition : VFXCompilationMode.Runtime); m_Controller.UnregisterHandler(this); @@ -1655,7 +1655,10 @@ void OnSave() foreach (var graph in graphToSave) { if (EditorUtility.IsDirty(graph) || UnityEngine.Object.ReferenceEquals(graph, controller.graph)) + { + graph.UpdateSubAssets(); graph.GetResource().WriteAsset(); + } } } diff --git a/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs b/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs index ce58c9d1f54..0165126e0a8 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperator.cs @@ -103,6 +103,9 @@ public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot) } } } + if (space == (VFXCoordinateSpace)int.MaxValue) + space = outputSlot.space; + return space; } diff --git a/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs b/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs index 9685e18bc87..508fbd3cec6 100644 --- a/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs +++ b/com.unity.visualeffectgraph/Editor/Models/Parameters/VFXDynamicBuiltInParameter.cs @@ -179,6 +179,19 @@ override public string name } } + public override VFXCoordinateSpace GetOutputSpaceFromSlot(VFXSlot outputSlot) + { + switch (m_BuiltInParameters) + { + case BuiltInFlag.LocalToWorld: + return VFXCoordinateSpace.Local; + case BuiltInFlag.WorldToLocal: + return VFXCoordinateSpace.World; + default: + return (VFXCoordinateSpace)int.MaxValue; + } + } + protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression) { var expressions = builtInParameterEnumerable.Select(b => s_BuiltInInfo[b].expression); diff --git a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index bdd344ea646..9d70f283dc6 100644 --- a/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -264,7 +264,7 @@ static string[] OnWillSaveAssets(string[] paths) var vfxResource = VisualEffectResource.GetResourceAtPath(path); if (vfxResource != null) { - var graph = vfxResource.GetOrCreateGraph(); + vfxResource.GetOrCreateGraph().UpdateSubAssets(); vfxResource.WriteAsset(); // write asset as the AssetDatabase won't do it. } }