diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png b/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png index b26b2626580..afa3fface6b 100644 Binary files a/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png and b/Packages/com.unity.render-pipelines.core/Documentation~/Images/Preferences/PopUpAdvanced.png differ diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md b/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md index 97e576f1ccf..a027111c0af 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/TableOfContents.md @@ -36,6 +36,7 @@ * [Customize the UI of a setting](customize-ui-for-a-setting.md) * [Get custom graphics settings](get-custom-graphics-settings.md) * [Include or exclude a setting in your build](choose-whether-unity-includes-a-graphics-setting-in-your-build.md) + * [Advanced Properties](advanced-properties.md) * [Shaders](shaders.md) * [Use shader methods from the SRP Core shader library](built-in-shader-methods.md) * [Synchronizing shader code and C#](generating-shader-includes.md) diff --git a/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md b/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md index 7796caa848f..79fa09eb1b4 100644 --- a/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md +++ b/Packages/com.unity.render-pipelines.core/Documentation~/advanced-properties.md @@ -12,7 +12,7 @@ There is a global state per user that stores if Unity displays **advanced proper ## Exposing advanced properties within the inspector Not every component or Volume Override includes advanced properties. -If one does, it has a contextual menu to the right of each property section header that includes additional properties. To expose advanced properties for that section, open the contextual menu and click **Advanced Properties**. +If one does, it has a contextual menu to the right of each property section header that includes additional properties. To expose advanced properties for that section, open the contextual menu and click **Show All Advanced Properties**. For an example, refer to the **Water Surface** component in [High Definition Render Pipeline (HDRP)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/settings-and-properties-related-to-the-water-system.html). @@ -20,7 +20,7 @@ By default only standard properties are shown. ![](Images/Preferences/HDRP_WaterSurface_General.png) -When you select **Advanced Properties**: +When you select **Show All Advanced Properties**: ![](Images/Preferences/PopUpAdvanced.png) @@ -28,13 +28,13 @@ When you select **Advanced Properties**: ![](Images/Preferences/HDRP_WaterSurface_General_Visible.png) -For Volume Overrides, the already existing contextual menu has a **Advanced Properties** toggle as well. +For Volume Overrides, the already existing contextual menu has a **Show All Advanced Properties** toggle as well. ## Exposing advanced properties on preferences You can also access to this global preference by: -1. Open the **Graphics** tab in the **Preferences** window (menu: **Edit > Preferences > Graphics**). -2. Under **Properties**. Set **Advanced Properties** to **All Visible**. +1. Open the **Graphics** tab in the **Preferences** window (menu: **Edit > Preferences**, macOS: **Unity > Settings**). +2. Under **Graphics**, select **Properties**. Set **Advanced Properties** to **All Visible**. ![](Images/Preferences/AdvancedProperties_Settings.png) diff --git a/Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs b/Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs index 7d31d8580e1..8b43a084d74 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/AssemblyInfo.cs @@ -4,6 +4,5 @@ [assembly: InternalsVisibleTo("Unity.RenderPipelines.Core.Editor.Tests")] [assembly: InternalsVisibleTo("Unity.RenderPipelines.HighDefinition.Editor.Tests")] [assembly: InternalsVisibleTo("Unity.RenderPipelines.Universal.Editor.Tests")] -[assembly: InternalsVisibleTo("Unity.Testing.VisualEffectGraph.EditorTests")] [assembly: InternalsVisibleTo("Assembly-CSharp-Editor-testable")] diff --git a/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CoreBuildData.cs b/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CoreBuildData.cs index a6455d25afb..c11ff6e1809 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CoreBuildData.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/CoreBuildData.cs @@ -81,7 +81,7 @@ private void CheckGPUResidentDrawerUsage() return; GraphicsSettings.GetRenderPipelineSettings() - .ForEachFieldOfType(computeShader => computeShaderCache.Add(computeShader.GetInstanceID(), computeShader)); + .ForEachFieldOfType(computeShader => computeShaderCache.Add(computeShader.GetEntityId(), computeShader)); } /// diff --git a/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers/SRPDisabledComputeShaderVariantStripper.cs b/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers/SRPDisabledComputeShaderVariantStripper.cs index fe20e666966..49bdc1aa997 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers/SRPDisabledComputeShaderVariantStripper.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/BuildProcessors/ShaderStrippers/SRPDisabledComputeShaderVariantStripper.cs @@ -8,6 +8,6 @@ class SRPDisabledComputeShaderVariantStripper : IComputeShaderVariantStripper public bool active => !CoreBuildData.instance.buildingPlayerForRenderPipeline; public bool CanRemoveVariant([DisallowNull] ComputeShader shader, string _, ShaderCompilerData __) - => CoreBuildData.instance.computeShaderCache.ContainsKey(shader.GetInstanceID()); + => CoreBuildData.instance.computeShaderCache.ContainsKey(shader.GetEntityId()); } } \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs index 67ae557bf26..6e59bc9894c 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Debugging/DebugWindow.cs @@ -30,7 +30,7 @@ public int selectedPanel get => Mathf.Max(0, DebugManager.instance.PanelIndex(selectedPanelDisplayName)); set { - var displayName = DebugManager.instance.PanelDiplayName(value); + var displayName = DebugManager.instance.PanelDisplayName(value); if (!string.IsNullOrEmpty(displayName)) selectedPanelDisplayName = displayName; } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs index 79829a9883c..954dc148af1 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.RenderingLayers.cs @@ -127,14 +127,14 @@ static AccelStructAdapter BuildAccelerationStructure() Span perSubMeshOpaqueness = stackalloc bool[subMeshCount]; perSubMeshOpaqueness.Fill(true); - accelStruct.AddInstance(renderer.component.GetInstanceID(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); + accelStruct.AddInstance(renderer.component.GetEntityId(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); } foreach (var terrain in contributors.terrains) { uint mask = GetInstanceMask(terrain.component.shadowCastingMode); uint materialID = terrain.component.renderingLayerMask; // repurpose the material id as we don't need it here - accelStruct.AddInstance(terrain.component.GetInstanceID(), terrain.component, new uint[1] { mask }, new uint[1] { materialID }, new bool[1] { true }, 1); + accelStruct.AddInstance(terrain.component.GetEntityId(), terrain.component, new uint[1] { mask }, new uint[1] { materialID }, new bool[1] { true }, 1); } return accelStruct; diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs index 3207aa7e536..37eb01539a1 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.SkyOcclusion.cs @@ -223,13 +223,13 @@ static AccelStructAdapter BuildAccelerationStructure() Span perSubMeshOpaqueness = stackalloc bool[subMeshCount]; perSubMeshOpaqueness.Fill(true); - accelStruct.AddInstance(renderer.component.GetInstanceID(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); + accelStruct.AddInstance((int)renderer.component.GetEntityId().GetRawData(), renderer.component, perSubMeshMask, matIndices, perSubMeshOpaqueness, 1); } foreach (var terrain in contributors.terrains) { uint mask = GetInstanceMask(terrain.component.shadowCastingMode); - accelStruct.AddInstance(terrain.component.GetInstanceID(), terrain.component, new uint[1] { mask }, new uint[1] { 0 }, new bool[1] { true }, 1); + accelStruct.AddInstance(terrain.component.GetEntityId(), terrain.component, new uint[1] { mask }, new uint[1] { 0 }, new bool[1] { true }, 1); } return accelStruct; diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs index 5cc06919cfc..6c86eddc9c3 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeGIBaking.VirtualOffset.cs @@ -149,7 +149,7 @@ static AccelStructAdapter BuildAccelerationStructure(int mask) Span perSubMeshOpaqueness = stackalloc bool[subMeshCount]; perSubMeshOpaqueness.Fill(true); - accelStruct.AddInstance(renderer.component.GetInstanceID(), renderer.component, maskAndMatDummy, maskAndMatDummy, perSubMeshOpaqueness, 1); + accelStruct.AddInstance(renderer.component.GetEntityId(), renderer.component, maskAndMatDummy, maskAndMatDummy, perSubMeshOpaqueness, 1); } foreach (var terrain in contributors.terrains) @@ -158,7 +158,7 @@ static AccelStructAdapter BuildAccelerationStructure(int mask) if ((layerMask & mask) == 0) continue; - accelStruct.AddInstance(terrain.component.GetInstanceID(), terrain.component, new uint[1] { 0xFFFFFFFF }, new uint[1] { 0xFFFFFFFF }, new bool[1] { true }, 1); + accelStruct.AddInstance(terrain.component.GetEntityId(), terrain.component, new uint[1] { 0xFFFFFFFF }, new uint[1] { 0xFFFFFFFF }, new bool[1] { true }, 1); } return accelStruct; @@ -350,7 +350,7 @@ static internal void RecomputeVOForDebugOnly() var chunkSizeInProbes = ProbeBrickPool.GetChunkSizeInProbeCount(); var hasVirtualOffsets = m_BakingSet.settings.virtualOffsetSettings.useVirtualOffset; var hasRenderingLayers = m_BakingSet.useRenderingLayers; - + if (ValidateBakingCellsSize(bakingCellsArray, chunkSizeInProbes, hasVirtualOffsets, hasRenderingLayers)) { // Write back the assets. @@ -480,7 +480,7 @@ static uint[] GetMaterialIndices(Renderer renderer) for (int i = 0; i < matIndices.Length; ++i) { if (i < renderer.sharedMaterials.Length && renderer.sharedMaterials[i] != null) - matIndices[i] = (uint)renderer.sharedMaterials[i].GetInstanceID(); + matIndices[i] = (uint)renderer.sharedMaterials[i].GetEntityId().GetRawData(); else matIndices[i] = 0; } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs index ab94e7d8f23..bb2045301a0 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Lighting/ProbeVolume/ProbeVolumeLightingTab.cs @@ -361,6 +361,7 @@ void BakingGUI() activeSet = newSet; ProbeReferenceVolume.instance.Clear(); + ProbeReferenceVolume.instance.SetActiveBakingSet(newSet); } if (activeSet != null) diff --git a/Packages/com.unity.render-pipelines.core/Editor/LookDev/Context.cs b/Packages/com.unity.render-pipelines.core/Editor/LookDev/Context.cs index 93f41d3fe88..8ae795ad023 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/LookDev/Context.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/LookDev/Context.cs @@ -435,7 +435,7 @@ public void UpdateViewedObject(GameObject viewedObject) bool fromHierarchy = viewedObject.scene.IsValid(); if (fromHierarchy) - viewedObjecHierarchytEntityId = viewedObject.GetInstanceID(); + viewedObjecHierarchytEntityId = viewedObject.GetEntityId(); else viewedObjectAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(viewedObject)); viewedObjectReference = viewedObject; diff --git a/Packages/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs b/Packages/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs index 712c92f4d91..adf751d1fb2 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/LookDev/EnvironmentLibrary.cs @@ -191,7 +191,7 @@ public static void CreateAndAssignTo(ObjectField field) var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon"); var assetCreator = ScriptableObject.CreateInstance(); assetCreator.SetField(field); - ProjectWindowUtil.StartNameEditingIfProjectWindowExists(assetCreator.GetInstanceID(), assetCreator, "New EnvironmentLibrary.asset", icon, null); + ProjectWindowUtil.StartNameEditingIfProjectWindowExists(assetCreator.GetEntityId(), assetCreator, "New EnvironmentLibrary.asset", icon, null); } } diff --git a/Packages/com.unity.render-pipelines.core/Editor/PathTracing/LightBakerStrangler.cs b/Packages/com.unity.render-pipelines.core/Editor/PathTracing/LightBakerStrangler.cs index 23a52710696..a2b22365781 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/PathTracing/LightBakerStrangler.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/PathTracing/LightBakerStrangler.cs @@ -372,7 +372,7 @@ internal static bool Bake(string bakeInputPath, string lightmapRequestsPath, str // Read BakeInput and requests from LightBaker if (!BakeInputSerialization.Deserialize(bakeInputPath, out BakeInput bakeInput)) return false; - if (!BakeInputSerialization.Deserialize(lightmapRequestsPath, out LightmapRequestData lightmapRequestData)) + if (!BakeInputSerialization.Deserialize(lightmapRequestsPath, out LightmapRequestData lightmapRequestData)) return false; if (!BakeInputSerialization.Deserialize(lightProbeRequestsPath, out ProbeRequestData probeRequestData)) return false; @@ -400,33 +400,33 @@ internal static bool Bake(string bakeInputPath, string lightmapRequestsPath, str using UnityComputeWorld world = new(); world.Init(rayTracingContext, worldResources); - using var samplingResources = new UnityEngine.Rendering.Sampling.SamplingResources(); - samplingResources.Load((uint)UnityEngine.Rendering.Sampling.SamplingResources.ResourceType.All); + using var samplingResources = new UnityEngine.Rendering.Sampling.SamplingResources(); + samplingResources.Load((uint)UnityEngine.Rendering.Sampling.SamplingResources.ResourceType.All); - // Deserialize BakeInput, inject data into world - const bool useLegacyBakingBehavior = true; - const bool autoEstimateLUTRange = true; - BakeInputToWorldConversion.InjectBakeInputData(world.PathTracingWorld, autoEstimateLUTRange, in bakeInput, + // Deserialize BakeInput, inject data into world + const bool useLegacyBakingBehavior = true; + const bool autoEstimateLUTRange = true; + BakeInputToWorldConversion.InjectBakeInputData(world.PathTracingWorld, autoEstimateLUTRange, in bakeInput, out Bounds sceneBounds, out world.Meshes, out FatInstance[] fatInstances, out world.LightHandles, world.TemporaryObjects, UnityComputeWorld.RenderingObjectLayer); // Add instances to world - WorldHelpers.AddContributingInstancesToWorld(world.PathTracingWorld, in fatInstances, out var lodInstances, out var lodgroupToContributorInstances); + WorldHelpers.AddContributingInstancesToWorld(world.PathTracingWorld, in fatInstances, out var lodInstances, out var lodgroupToContributorInstances); - // Build world with extracted data - const bool emissiveSampling = true; - world.PathTracingWorld.Build(sceneBounds, deviceContext.GetCommandBuffer(), ref world.ScratchBuffer, samplingResources, emissiveSampling); + // Build world with extracted data + const bool emissiveSampling = true; + world.PathTracingWorld.Build(sceneBounds, deviceContext.GetCommandBuffer(), ref world.ScratchBuffer, samplingResources, emissiveSampling); LightmapBakeSettings lightmapBakeSettings = GetLightmapBakeSettings(bakeInput); // Build array of lightmap descriptors based on the atlassing data and instances. - LightmapDesc[] lightmapDescriptors = PopulateLightmapDescsFromAtlassing(in lightmapRequestData.atlassing, in fatInstances); + LightmapDesc[] lightmapDescriptors = PopulateLightmapDescsFromAtlassing(in lightmapRequestData.atlassing, in fatInstances); SortInstancesByMeshAndResolution(lightmapDescriptors); ulong probeWorkSteps = CalculateWorkStepsForProbeRequests(in bakeInput, in probeRequestData); - ulong lightmapWorkSteps = CalculateWorkStepsForLightmapRequests(in lightmapRequestData, lightmapDescriptors, lightmapBakeSettings); + ulong lightmapWorkSteps = CalculateWorkStepsForLightmapRequests(in lightmapRequestData, lightmapDescriptors, lightmapBakeSettings); progressState.SetTotalWorkSteps(probeWorkSteps + lightmapWorkSteps); - if (!ExecuteProbeRequests(in bakeInput, in probeRequestData, deviceContext, useLegacyBakingBehavior, world, bakeInput.lightingSettings.maxBounces, progressState, samplingResources)) + if (!ExecuteProbeRequests(in bakeInput, in probeRequestData, deviceContext, useLegacyBakingBehavior, world, bakeInput.lightingSettings.maxBounces, progressState, samplingResources)) return false; if (lightmapRequestData.requests.Length <= 0) @@ -436,7 +436,7 @@ internal static bool Bake(string bakeInputPath, string lightmapRequestsPath, str LightmapResourceLibrary resources = new(); resources.Load(world.RayTracingContext); - if (ExecuteLightmapRequests(in lightmapRequestData, deviceContext, world, in fatInstances, in lodInstances, in lodgroupToContributorInstances, integrationSettings, useLegacyBakingBehavior, resources, progressState, lightmapDescriptors, lightmapBakeSettings, samplingResources) != Result.Success) + if (ExecuteLightmapRequests(in lightmapRequestData, deviceContext, world, in fatInstances, in lodInstances, in lodgroupToContributorInstances, integrationSettings, useLegacyBakingBehavior, resources, progressState, lightmapDescriptors, lightmapBakeSettings, samplingResources) != Result.Success) return false; CoreUtils.Destroy(resources.UVFallbackBufferGenerationMaterial); diff --git a/Packages/com.unity.render-pipelines.core/Editor/PostProcessing/LensFlareDataSRPEditor.cs b/Packages/com.unity.render-pipelines.core/Editor/PostProcessing/LensFlareDataSRPEditor.cs index 447963d2633..006f3dbd8fa 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/PostProcessing/LensFlareDataSRPEditor.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/PostProcessing/LensFlareDataSRPEditor.cs @@ -765,7 +765,7 @@ void DrawSummary(Rect summaryRect, SerializedProperty element, int index) { SerializedProperty lensFlareDataSRP = element.FindPropertyRelative("lensFlareDataSRP"); fieldRect.MoveNext(); - EditorGUI.PropertyField(fieldRect.Current, lensFlareDataSRP, Styles.lensFlareDataSRP); + DrawLensFlareDataSRPFieldWithCycleDetection(fieldRect.Current, lensFlareDataSRP, Styles.lensFlareDataSRP); EditorGUIUtility.labelWidth = oldLabelWidth; return; } @@ -923,7 +923,7 @@ void DrawTypeCathegory(ref Rect remainingRect, SerializedProperty element) { SerializedProperty lensFlareDataSRP = element.FindPropertyRelative("lensFlareDataSRP"); fieldRect.MoveNext(); - EditorGUI.PropertyField(fieldRect.Current, lensFlareDataSRP, Styles.lensFlareDataSRP); + DrawLensFlareDataSRPFieldWithCycleDetection(fieldRect.Current, lensFlareDataSRP, Styles.lensFlareDataSRP); } break; } @@ -1252,6 +1252,67 @@ T GetEnum(SerializedProperty property) void SetEnum(SerializedProperty property, T value) => property.intValue = (int)(object)value; + + void DrawLensFlareDataSRPFieldWithCycleDetection(Rect rect, SerializedProperty lensFlareDataSRPProperty, GUIContent label) + { + LensFlareDataSRP currentAsset = target as LensFlareDataSRP; + + EditorGUI.BeginChangeCheck(); + LensFlareDataSRP newValue = EditorGUI.ObjectField(rect, label, lensFlareDataSRPProperty.objectReferenceValue, typeof(LensFlareDataSRP), false) as LensFlareDataSRP; + + if (EditorGUI.EndChangeCheck()) + { + // Check for cycles before setting the value + bool wouldCreateCycle = false; + + if (newValue != null && currentAsset != null) + { + // Direct self-reference check + if (currentAsset == newValue) + { + wouldCreateCycle = true; + } + else + { + // Multi-level cycle check - see if newValue already references currentAsset + HashSet visited = new HashSet(); + + // Recursive function to check if targetAsset is found in asset's dependency chain + bool CheckCycle(LensFlareDataSRP asset, LensFlareDataSRP targetAsset) + { + if (asset == null || visited.Contains(asset)) + return false; + + visited.Add(asset); + + foreach (var element in asset.elements) + { + if (element.flareType == SRPLensFlareType.LensFlareDataSRP && element.lensFlareDataSRP != null) + { + if (element.lensFlareDataSRP == targetAsset || CheckCycle(element.lensFlareDataSRP, targetAsset)) + return true; + } + } + return false; + } + + wouldCreateCycle = CheckCycle(newValue, currentAsset); + } + } + + if (wouldCreateCycle) + { + // Cycle detected - set to null and show a warning + lensFlareDataSRPProperty.objectReferenceValue = null; + Debug.LogWarning($"Cannot assign lens flare asset '{newValue.name}' because it would create a cyclic dependency. Setting to null to prevent infinite loop."); + } + else + { + lensFlareDataSRPProperty.objectReferenceValue = newValue; + } + } + } + #endregion } } diff --git a/Packages/com.unity.render-pipelines.core/Editor/Properties/AdvancedProperties.cs b/Packages/com.unity.render-pipelines.core/Editor/Properties/AdvancedProperties.cs index 21d8361a651..68071da68bc 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Properties/AdvancedProperties.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Properties/AdvancedProperties.cs @@ -75,14 +75,14 @@ public static bool enabled } /// - /// Adds an entry to toggle Advanced Properties + /// Adds an entry to toggle Advanced Properties global option. /// /// The menu where to add the Advanced Properties entry. /// If the option is checked /// The toggle action public static void AddAdvancedPropertiesBoolMenuItem(this GenericMenu menu, Func hasMoreOptions, Action toggleMoreOptions) { - menu.AddItem(EditorGUIUtility.TrTextContent("Advanced Properties"), hasMoreOptions.Invoke(), () => toggleMoreOptions.Invoke()); + menu.AddItem(EditorGUIUtility.TrTextContent("Show All Advanced Properties"), hasMoreOptions.Invoke(), () => toggleMoreOptions.Invoke()); } /// diff --git a/Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs b/Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs index 5a86ad27577..75f587cb175 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/RenderGraph/RenderGraphViewer.cs @@ -2087,7 +2087,7 @@ void DelayedRefresh() void CreateGUI() { - s_EditorWindowInstanceId = GetInstanceID(); + s_EditorWindowInstanceId = GetEntityId(); if (EditorPrefs.HasKey(kPassFilterLegacyEditorPrefsKey)) m_PassFilterLegacy = (PassFilterLegacy)EditorPrefs.GetInt(kPassFilterLegacyEditorPrefsKey); @@ -2143,7 +2143,7 @@ void OnDisable() // maximized, seemingly nothing happens. When it gets unmaximized, both OnEnable() and OnDisable() get called // on a new EditorWindow instance, which I guess was the maximized one? Anyway we need to ignore this event // because the DebugSession is static and we don't want to unsubscribe because the window is still open. - if (s_EditorWindowInstanceId != GetInstanceID()) + if (s_EditorWindowInstanceId != GetEntityId()) return; m_CurrentDebugData?.Clear(); diff --git a/Packages/com.unity.render-pipelines.core/Editor/Settings/RenderPipelineGlobalSettingsEndNameEditAction.cs b/Packages/com.unity.render-pipelines.core/Editor/Settings/RenderPipelineGlobalSettingsEndNameEditAction.cs index a8a4e2fef03..155e72225c1 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Settings/RenderPipelineGlobalSettingsEndNameEditAction.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Settings/RenderPipelineGlobalSettingsEndNameEditAction.cs @@ -8,14 +8,14 @@ namespace UnityEditor.Rendering /// for /// [Obsolete("RenderPipelineGlobalSettingsEndNameEditAction is no longer used and will be removed in a future release.")] - public class RenderPipelineGlobalSettingsEndNameEditAction : ProjectWindowCallback.EndNameEditAction + public class RenderPipelineGlobalSettingsEndNameEditAction : ProjectWindowCallback.AssetCreationEndAction { private Type renderPipelineType { get; set; } private Type renderPipelineGlobalSettingsType { get; set; } private RenderPipelineGlobalSettings source { get; set; } /// - public override void Action(int instanceId, string pathName, string resourceFile) + public override void Action(EntityId instanceId, string pathName, string resourceFile) { RenderPipelineGlobalSettings assetCreated = RenderPipelineGlobalSettingsUtils.Create(renderPipelineGlobalSettingsType, pathName, source) as RenderPipelineGlobalSettings; @@ -45,7 +45,7 @@ internal static RenderPipelineGlobalSettingsEndNameEditAction CreateEndNameEditA internal static void StartEndNameEditAction(RenderPipelineGlobalSettingsEndNameEditAction action, string pathName) { ProjectWindowUtil.StartNameEditingIfProjectWindowExists( - action.GetInstanceID(), + action.GetEntityId(), action, pathName, CoreEditorStyles.globalSettingsIcon, diff --git a/Packages/com.unity.render-pipelines.core/Editor/Upscaling/DLSSOptionsEditor.cs b/Packages/com.unity.render-pipelines.core/Editor/Upscaling/DLSSOptionsEditor.cs index dbdb768474e..aac3f477f0b 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Upscaling/DLSSOptionsEditor.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Upscaling/DLSSOptionsEditor.cs @@ -1,5 +1,5 @@ #if UNITY_EDITOR -#if ENABLE_UPSCALER_FRAMEWORK && ENABLE_NVIDIA +#if ENABLE_UPSCALER_FRAMEWORK && ENABLE_NVIDIA && ENABLE_NVIDIA_MODULE using UnityEditor; using UnityEngine; using UnityEngine.NVIDIA; diff --git a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileFactory.cs b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileFactory.cs index c51ca454d89..1fed5e893f0 100644 --- a/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileFactory.cs +++ b/Packages/com.unity.render-pipelines.core/Editor/Volume/VolumeProfileFactory.cs @@ -37,7 +37,7 @@ public static void CreateVolumeProfileWithCallback(string fullPath, Action(), diff --git a/Packages/com.unity.render-pipelines.core/Runtime/CommandBuffers/BaseCommandBufer.cs b/Packages/com.unity.render-pipelines.core/Runtime/CommandBuffers/BaseCommandBufer.cs index 047f8da0945..510506316ff 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/CommandBuffers/BaseCommandBufer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/CommandBuffers/BaseCommandBufer.cs @@ -63,7 +63,7 @@ protected internal void ThrowIfRasterNotAllowed() /// Throws an exception if the texture handle is not properly registered for the pass or being used incorrectly. /// [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - protected internal void ValidateTextureHandle(TextureHandle h) + protected internal void ValidateTextureHandle(in TextureHandle h) { if(RenderGraph.enableValidityChecks) { @@ -91,7 +91,7 @@ protected internal void ValidateTextureHandle(TextureHandle h) /// Throws an exception if the texture handle is either not registered as a readable resource or misused as both an attachment and a regular texture. /// [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - protected internal void ValidateTextureHandleRead(TextureHandle h) + protected internal void ValidateTextureHandleRead(in TextureHandle h) { if (RenderGraph.enableValidityChecks) { @@ -118,7 +118,7 @@ protected internal void ValidateTextureHandleRead(TextureHandle h) /// Throws an exception if the texture handle is not registered for writing, attempts to write to a built-in texture, or is misused as both a writeable resource and a render target attachment. /// [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - protected internal void ValidateTextureHandleWrite(TextureHandle h) + protected internal void ValidateTextureHandleWrite(in TextureHandle h) { if(RenderGraph.enableValidityChecks) { diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Common/DynamicResolutionHandler.cs b/Packages/com.unity.render-pipelines.core/Runtime/Common/DynamicResolutionHandler.cs index 0b6a356721d..d98a8ac8f12 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Common/DynamicResolutionHandler.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Common/DynamicResolutionHandler.cs @@ -135,7 +135,7 @@ public bool runUpscalerFilterOnFullResolution private static Dictionary s_CameraInstances = new Dictionary(CameraDictionaryMaxcCapacity); private static DynamicResolutionHandler s_DefaultInstance = new DynamicResolutionHandler(); - private static int s_ActiveCameraId = 0; + private static EntityId s_ActiveCameraId = EntityId.None; private static DynamicResolutionHandler s_ActiveInstance = s_DefaultInstance; //private global state of ScalableBufferManager @@ -161,7 +161,7 @@ private static DynamicResolutionHandler GetOrCreateDrsInstanceHandler(Camera cam return null; DynamicResolutionHandler instance = null; - var key = camera.GetInstanceID(); + var key = camera.GetEntityId(); if (!s_CameraInstances.TryGetValue(key, out instance)) { //if this camera is not available in the map of cameras lets try creating one. @@ -367,7 +367,7 @@ static public void SetActiveDynamicScalerSlot(DynamicResScalerSlot slot) public static void ClearSelectedCamera() { s_ActiveInstance = s_DefaultInstance; - s_ActiveCameraId = 0; + s_ActiveCameraId = EntityId.None; s_ActiveInstanceDirty = true; } @@ -378,7 +378,7 @@ public static void ClearSelectedCamera() /// The filter to be used by the camera to upscale to final resolution. static public void SetUpscaleFilter(Camera camera, DynamicResUpscaleFilter filter) { - var cameraID = camera.GetInstanceID(); + var cameraID = camera.GetEntityId(); if (s_CameraUpscaleFilters.ContainsKey(cameraID)) { s_CameraUpscaleFilters[cameraID] = filter; @@ -408,7 +408,7 @@ public void SetCurrentCameraRequest(bool cameraRequest) /// An action that will be called every time the dynamic resolution system triggers a change in resolution. public static void UpdateAndUseCamera(Camera camera, GlobalDynamicResolutionSettings? settings = null, Action OnResolutionChange = null) { - int newCameraId; + EntityId newCameraId; if (camera == null) { s_ActiveInstance = s_DefaultInstance; @@ -417,7 +417,7 @@ public static void UpdateAndUseCamera(Camera camera, GlobalDynamicResolutionSett else { s_ActiveInstance = GetOrCreateDrsInstanceHandler(camera); - newCameraId = camera.GetInstanceID(); + newCameraId = camera.GetEntityId(); } s_ActiveInstanceDirty = newCameraId != s_ActiveCameraId; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs index bb29b4cf382..726a3c34701 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugDisplaySettingsUI.cs @@ -32,6 +32,10 @@ private void Reset() /// to be registered public void RegisterDebug(IDebugDisplaySettings settings) { +#if UNITY_EDITOR + if (UnityEditor.BuildPipeline.isBuildingPlayer) + return; +#endif DebugManager debugManager = DebugManager.instance; List panels = new List(); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs index b90eed0d6da..f519eb4d8fe 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugManager.cs @@ -297,12 +297,24 @@ public int PanelIndex([DisallowNull] string displayName) return -1; } + + /// + /// Returns the panel display name + /// + /// The panelIndex for the panel to get the name + /// The display name of the panel, or empty string otherwise + [Obsolete("Method is obsolete. Use PanelDisplayName instead. #from(6000.4) (UnityUpgradable) -> PanelDisplayName", true)] + public string PanelDiplayName(int panelIndex) + { + return PanelDisplayName(panelIndex); + } + /// /// Returns the panel display name /// /// The panelIndex for the panel to get the name /// The display name of the panel, or empty string otherwise - public string PanelDiplayName([DisallowNull] int panelIndex) + public string PanelDisplayName(int panelIndex) { if (panelIndex < 0 || panelIndex > m_Panels.Count - 1) return string.Empty; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs index 2f732228409..2803b3dce0d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Debugging/DebugUI.Fields.cs @@ -574,9 +574,7 @@ IEnumerable cameras if (camera.cameraType != CameraType.Preview && camera.cameraType != CameraType.Reflection) { - if (!camera.TryGetComponent(out var additionalData)) - Debug.LogWarning($"Camera {camera.name} does not contain an additional camera data component. Open the Game Object in the inspector to add additional camera data."); - else + if (camera.TryGetComponent(out _)) m_Cameras.Add(camera); } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs index acc7b737062..9b2d6f98e48 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/GPUResidentDrawer.cs @@ -512,7 +512,7 @@ private void EditorFrameUpdate(List cameras) bool newFrame = false; foreach (Camera camera in cameras) { - int instanceID = camera.GetInstanceID(); + int instanceID = camera.GetEntityId(); if (m_FrameCameraIDs.Length == 0 || m_FrameCameraIDs.Contains(instanceID)) { newFrame = true; @@ -544,7 +544,7 @@ private void UpdateSelection() var rendererIDs = new NativeArray(renderers.Length, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); for (int i = 0; i < renderers.Length; ++i) - rendererIDs[i] = renderers[i] ? renderers[i].GetInstanceID() : 0; + rendererIDs[i] = renderers[i] ? renderers[i].GetEntityId() : 0; m_Batcher.UpdateSelectedRenderers(rendererIDs); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs index d4909830936..bc5527180cf 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceCuller.cs @@ -848,7 +848,7 @@ unsafe public void Execute() allocInfo.drawCount = outIndirectCommandIndex; allocInfo.instanceCount = outIndirectVisibleInstanceIndex; - int drawAllocCount = allocInfo.drawCount + IndirectBufferContextStorage.kExtraDrawAllocationCount; + int drawAllocCount = allocInfo.drawCount; int drawAllocEnd = Interlocked.Add(ref UnsafeUtility.AsRef(allocCounters + (int)IndirectAllocator.NextDrawIndex), drawAllocCount); allocInfo.drawAllocIndex = drawAllocEnd - drawAllocCount; @@ -1758,6 +1758,7 @@ private static class ShaderIDs public static readonly int InstanceOcclusionCullerShaderVariables = Shader.PropertyToID("InstanceOcclusionCullerShaderVariables"); public static readonly int _DrawInfo = Shader.PropertyToID("_DrawInfo"); public static readonly int _InstanceInfo = Shader.PropertyToID("_InstanceInfo"); + public static readonly int _DispatchArgs = Shader.PropertyToID("_DispatchArgs"); public static readonly int _DrawArgs = Shader.PropertyToID("_DrawArgs"); public static readonly int _InstanceIndices = Shader.PropertyToID("_InstanceIndices"); public static readonly int _InstanceDataBuffer = Shader.PropertyToID("_InstanceDataBuffer"); @@ -2091,7 +2092,7 @@ public unsafe JobHandle CreateCullJobTree( cullingOutput = cullingOutput.drawCommands, indirectBufferLimits = indirectBufferLimits, visibleInstancesBufferHandle = m_IndirectStorage.visibleInstanceBufferHandle, - indirectArgsBufferHandle = m_IndirectStorage.indirectArgsBufferHandle, + indirectArgsBufferHandle = m_IndirectStorage.indirectDrawArgsBufferHandle, indirectBufferAllocInfo = indirectBufferAllocInfo, indirectInstanceInfoGlobalArray = m_IndirectStorage.instanceInfoGlobalArray, indirectDrawInfoGlobalArray = m_IndirectStorage.drawInfoGlobalArray, @@ -2335,7 +2336,7 @@ public void InstanceOcclusionTest(RenderGraph renderGraph, in OcclusionCullingSe passData.bufferHandles.UseForOcclusionTest(builder); passData.occluderHandles.UseForOcclusionTest(builder); - builder.SetRenderFunc((InstanceOcclusionTestPassData data, ComputeGraphContext context) => + builder.SetRenderFunc(static (InstanceOcclusionTestPassData data, ComputeGraphContext context) => { var batcher = GPUResidentDrawer.instance.batcher; batcher.instanceCullingBatcher.culler.AddOcclusionCullingDispatch( @@ -2386,7 +2387,7 @@ internal void EnsureValidOcclusionTestResults(int viewInstanceID) int kernel = m_CopyInstancesKernel; cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawInfo, m_IndirectStorage.drawInfoBuffer); cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceInfo, m_IndirectStorage.instanceInfoBuffer); - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, m_IndirectStorage.argsBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, m_IndirectStorage.drawArgsBuffer); cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceIndices, m_IndirectStorage.instanceBuffer); cmd.DispatchCompute(cs, kernel, (allocInfo.instanceCount + 63) / 64, 1, 1); @@ -2539,10 +2540,10 @@ private void AddOcclusionCullingDispatch( if (doCopyInstances) { int kernel = m_CopyInstancesKernel; - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawInfo, m_IndirectStorage.drawInfoBuffer); - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceInfo, m_IndirectStorage.instanceInfoBuffer); - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, m_IndirectStorage.argsBuffer); - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceIndices, m_IndirectStorage.instanceBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawInfo, bufferHandles.drawInfoBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceInfo, bufferHandles.instanceInfoBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, bufferHandles.drawArgsBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceIndices, bufferHandles.instanceBuffer); cmd.DispatchCompute(cs, kernel, (allocInfo.instanceCount + 63) / 64, 1, 1); } @@ -2551,7 +2552,10 @@ private void AddOcclusionCullingDispatch( { int kernel = m_ResetDrawArgsKernel; cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawInfo, bufferHandles.drawInfoBuffer); - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, bufferHandles.argsBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, bufferHandles.drawArgsBuffer); + if (isSecondPass) + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DispatchArgs, bufferHandles.dispatchArgsBuffer); + cmd.DispatchCompute(cs, kernel, (allocInfo.drawCount + 63) / 64, 1, 1); } @@ -2560,7 +2564,7 @@ private void AddOcclusionCullingDispatch( int kernel = m_CullInstancesKernel; cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawInfo, bufferHandles.drawInfoBuffer); cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceInfo, bufferHandles.instanceInfoBuffer); - cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, bufferHandles.argsBuffer); + cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._DrawArgs, bufferHandles.drawArgsBuffer); cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceIndices, bufferHandles.instanceBuffer); cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._InstanceDataBuffer, batchersContext.gpuInstanceDataBuffer); cmd.SetComputeBufferParam(cs, kernel, ShaderIDs._OcclusionDebugCounters, m_OcclusionEventDebugArray.CounterBuffer); @@ -2572,7 +2576,7 @@ private void AddOcclusionCullingDispatch( OcclusionCullingCommon.SetDebugPyramid(cmd, m_OcclusionTestShader, kernel, occluderHandles); if (isSecondPass) - cmd.DispatchCompute(cs, kernel, bufferHandles.argsBuffer, (uint)(GraphicsBuffer.IndirectDrawIndexedArgs.size * allocInfo.GetExtraDrawInfoSlotIndex())); + cmd.DispatchCompute(cs, kernel, bufferHandles.dispatchArgsBuffer, 0); else cmd.DispatchCompute(cs, kernel, (allocInfo.instanceCount + 63) / 64, 1, 1); } @@ -2610,6 +2614,7 @@ private void OnEndSceneViewCameraRendering() public void UpdateFrame(int cameraCount) { + DisposeSceneViewHiddenBits(); DisposeCompactVisibilityMasks(); if (cameraCount > m_LODParamsToCameraID.Capacity) m_LODParamsToCameraID.Capacity = cameraCount; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceOcclusionCuller.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceOcclusionCuller.cs index 66adf030165..06bdadb5b66 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceOcclusionCuller.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/InstanceOcclusionCuller.cs @@ -560,14 +560,16 @@ internal struct IndirectBufferContextHandles { public BufferHandle instanceBuffer; public BufferHandle instanceInfoBuffer; - public BufferHandle argsBuffer; + public BufferHandle dispatchArgsBuffer; + public BufferHandle drawArgsBuffer; public BufferHandle drawInfoBuffer; public void UseForOcclusionTest(IBaseRenderGraphBuilder builder) { instanceBuffer = builder.UseBuffer(instanceBuffer, AccessFlags.ReadWrite); instanceInfoBuffer = builder.UseBuffer(instanceInfoBuffer, AccessFlags.Read); - argsBuffer = builder.UseBuffer(argsBuffer, AccessFlags.ReadWrite); + dispatchArgsBuffer = builder.UseBuffer(dispatchArgsBuffer, AccessFlags.ReadWrite); + drawArgsBuffer = builder.UseBuffer(drawArgsBuffer, AccessFlags.ReadWrite); drawInfoBuffer = builder.UseBuffer(drawInfoBuffer, AccessFlags.Read); } } @@ -575,7 +577,6 @@ public void UseForOcclusionTest(IBaseRenderGraphBuilder builder) internal struct IndirectBufferContextStorage : IDisposable { private const int kAllocatorCount = (int)IndirectAllocator.Count; - internal const int kExtraDrawAllocationCount = 1; // over-allocate by one for indirect args scratch space GPU-side internal const int kInstanceInfoGpuOffsetMultiplier = 2; // GPU side allocates storage for extra copy of instance list private IndirectBufferLimits m_BufferLimits; @@ -584,7 +585,8 @@ internal struct IndirectBufferContextStorage : IDisposable private GraphicsBuffer m_InstanceInfoBuffer; private NativeArray m_InstanceInfoStaging; - private GraphicsBuffer m_ArgsBuffer; + private GraphicsBuffer m_DispatchArgsBuffer; + private GraphicsBuffer m_DrawArgsBuffer; private GraphicsBuffer m_DrawInfoBuffer; private NativeArray m_DrawInfoStaging; @@ -596,11 +598,12 @@ internal struct IndirectBufferContextStorage : IDisposable public GraphicsBuffer instanceBuffer { get { return m_InstanceBuffer; } } public GraphicsBuffer instanceInfoBuffer { get { return m_InstanceInfoBuffer; } } - public GraphicsBuffer argsBuffer { get { return m_ArgsBuffer; } } + public GraphicsBuffer dispatchArgsBuffer { get { return m_DispatchArgsBuffer; } } + public GraphicsBuffer drawArgsBuffer { get { return m_DrawArgsBuffer; } } public GraphicsBuffer drawInfoBuffer { get { return m_DrawInfoBuffer; } } public GraphicsBufferHandle visibleInstanceBufferHandle { get { return m_InstanceBuffer.bufferHandle; } } - public GraphicsBufferHandle indirectArgsBufferHandle { get { return m_ArgsBuffer.bufferHandle; } } + public GraphicsBufferHandle indirectDrawArgsBufferHandle { get { return m_DrawArgsBuffer.bufferHandle; } } public IndirectBufferContextHandles ImportBuffers(RenderGraph renderGraph) { @@ -608,7 +611,8 @@ public IndirectBufferContextHandles ImportBuffers(RenderGraph renderGraph) { instanceBuffer = renderGraph.ImportBuffer(m_InstanceBuffer), instanceInfoBuffer = renderGraph.ImportBuffer(m_InstanceInfoBuffer), - argsBuffer = renderGraph.ImportBuffer(m_ArgsBuffer), + dispatchArgsBuffer = renderGraph.ImportBuffer(m_DispatchArgsBuffer), + drawArgsBuffer = renderGraph.ImportBuffer(m_DrawArgsBuffer), drawInfoBuffer = renderGraph.ImportBuffer(m_DrawInfoBuffer), }; } @@ -653,7 +657,9 @@ void FreeInstanceBuffers() void AllocateDrawBuffers(int maxDrawCount) { - m_ArgsBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured | GraphicsBuffer.Target.IndirectArguments, (maxDrawCount + kExtraDrawAllocationCount) * (GraphicsBuffer.IndirectDrawIndexedArgs.size / sizeof(int)), sizeof(int)); + // Compute dispatch arguments are number of thread groups in X,Y and Z dimensions, hence 3 integers for the size. + m_DispatchArgsBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured | GraphicsBuffer.Target.IndirectArguments, 3, sizeof(int)); + m_DrawArgsBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured | GraphicsBuffer.Target.IndirectArguments, maxDrawCount * (GraphicsBuffer.IndirectDrawIndexedArgs.size / sizeof(int)), sizeof(int)); m_DrawInfoBuffer = new GraphicsBuffer(GraphicsBuffer.Target.Structured, maxDrawCount, System.Runtime.InteropServices.Marshal.SizeOf()); m_DrawInfoStaging = new NativeArray(maxDrawCount, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); m_BufferLimits.maxDrawCount = maxDrawCount; @@ -661,7 +667,8 @@ void AllocateDrawBuffers(int maxDrawCount) void FreeDrawBuffers() { - m_ArgsBuffer.Release(); + m_DispatchArgsBuffer.Release(); + m_DrawArgsBuffer.Release(); m_DrawInfoBuffer.Release(); m_DrawInfoStaging.Dispose(); m_BufferLimits.maxDrawCount = 0; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/OcclusionCullingCommon.cs b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/OcclusionCullingCommon.cs index 97a6a836071..bc1b05f43e9 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/OcclusionCullingCommon.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/GPUDriven/OcclusionCullingCommon.cs @@ -259,9 +259,10 @@ private class OcclusionTestOverlaySetupPassData private class OcclusionTestOverlayPassData { public BufferHandle debugPyramid; + public Material debugOcclusionTestMaterial; } - public void RenderDebugOcclusionTestOverlay(RenderGraph renderGraph, DebugDisplayGPUResidentDrawer debugSettings, int viewInstanceID, TextureHandle colorBuffer) + public void RenderDebugOcclusionTestOverlay(RenderGraph renderGraph, DebugDisplayGPUResidentDrawer debugSettings, int viewInstanceID, in TextureHandle colorBuffer) { if (debugSettings == null) return; @@ -279,7 +280,7 @@ public void RenderDebugOcclusionTestOverlay(RenderGraph renderGraph, DebugDispla passData.cb = debugOutput.cb; builder.SetRenderFunc( - (OcclusionTestOverlaySetupPassData data, ComputeGraphContext ctx) => + static (OcclusionTestOverlaySetupPassData data, ComputeGraphContext ctx) => { var occ = GPUResidentDrawer.instance.batcher.occlusionCullingCommon; @@ -299,15 +300,16 @@ public void RenderDebugOcclusionTestOverlay(RenderGraph renderGraph, DebugDispla builder.AllowGlobalStateModification(true); passData.debugPyramid = renderGraph.ImportBuffer(debugOutput.occlusionDebugOverlay); + passData.debugOcclusionTestMaterial = m_DebugOcclusionTestMaterial; builder.SetRenderAttachment(colorBuffer, 0); builder.UseBuffer(passData.debugPyramid); - builder.SetRenderFunc( - (OcclusionTestOverlayPassData data, RasterGraphContext ctx) => + builder.SetRenderFunc( + static (OcclusionTestOverlayPassData data, RasterGraphContext ctx) => { ctx.cmd.SetGlobalBuffer(ShaderIDs._OcclusionDebugOverlay, data.debugPyramid); - CoreUtils.DrawFullScreen(ctx.cmd, m_DebugOcclusionTestMaterial); + CoreUtils.DrawFullScreen(ctx.cmd, data.debugOcclusionTestMaterial); }); } } @@ -328,7 +330,7 @@ class OccluderOverlayPassData public Vector2 validRange; } - public void RenderDebugOccluderOverlay(RenderGraph renderGraph, DebugDisplayGPUResidentDrawer debugSettings, Vector2 screenPos, float maxHeight, TextureHandle colorBuffer) + public void RenderDebugOccluderOverlay(RenderGraph renderGraph, DebugDisplayGPUResidentDrawer debugSettings, Vector2 screenPos, float maxHeight, in TextureHandle colorBuffer) { if (debugSettings == null) return; @@ -362,7 +364,7 @@ public void RenderDebugOccluderOverlay(RenderGraph renderGraph, DebugDisplayGPUR passData.passIndex = passIndex; passData.validRange = debugSettings.occluderDebugViewRange; - builder.SetRenderFunc( + builder.SetRenderFunc(static (OccluderOverlayPassData data, RasterGraphContext ctx) => { var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); @@ -468,7 +470,7 @@ public bool UpdateInstanceOccluders(RenderGraph renderGraph, in OccluderParamete passData.occluderHandles.UseForOccluderUpdate(builder); builder.SetRenderFunc( - (UpdateOccludersPassData data, ComputeGraphContext context) => + static (UpdateOccludersPassData data, ComputeGraphContext context) => { Span occluderSubviewUpdates = stackalloc OccluderSubviewUpdate[data.occluderSubviewUpdates.Count]; int subviewMask = 0; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs index 3f980c0607b..b5535abef4f 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeReferenceVolume.Debug.cs @@ -839,7 +839,7 @@ public void RenderFragmentationOverlay(RenderGraph renderGraph, TextureHandle co passData.chunkCount = passData.debugFragmentationData.count; builder.SetRenderFunc( - (RenderFragmentationOverlayPassData data, UnsafeGraphContext ctx) => + static (RenderFragmentationOverlayPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs index fb80883c6bd..ff5e52958b4 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSet.cs @@ -26,6 +26,7 @@ public LogarithmicAttribute(int min, int max) /// /// An Asset which holds a set of settings to use with a . /// + [CoreRPHelpURL("probevolumes-usebakingsets", "com.unity.render-pipelines.high-definition")] public sealed partial class ProbeVolumeBakingSet : ScriptableObject, ISerializationCallbackReceiver { internal enum Version diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSetWeakReference.cs b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSetWeakReference.cs index 6548d1d3f07..989194d7479 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSetWeakReference.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Lighting/ProbeVolume/ProbeVolumeBakingSetWeakReference.cs @@ -12,7 +12,7 @@ namespace UnityEngine.Rendering internal class ProbeVolumeBakingSetWeakReference { - public int m_InstanceID; + public EntityId m_EntityId; public ProbeVolumeBakingSetWeakReference(ProbeVolumeBakingSet bakingSet) { @@ -21,28 +21,28 @@ public ProbeVolumeBakingSetWeakReference(ProbeVolumeBakingSet bakingSet) public ProbeVolumeBakingSetWeakReference() { - m_InstanceID = 0; + m_EntityId = EntityId.None; } // Change which baking set the references points to. public void Set(ProbeVolumeBakingSet bakingSet) { if (bakingSet == null) - m_InstanceID = 0; + m_EntityId = EntityId.None; else - m_InstanceID = bakingSet.GetInstanceID(); + m_EntityId = bakingSet.GetEntityId(); } // Get the referenced baking set, loading it into memory if necessary. public ProbeVolumeBakingSet Get() { - return Resources.EntityIdToObject(m_InstanceID) as ProbeVolumeBakingSet; + return Resources.EntityIdToObject(m_EntityId) as ProbeVolumeBakingSet; } // Is the referenced baking set in memory? public bool IsLoaded() { - return Resources.EntityIdIsValid(m_InstanceID); + return Resources.EntityIdIsValid(m_EntityId); } // Force the referenced baking set to be unloaded from memory. diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.cs b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.cs index 5682cd2f4c0..4c19c079f46 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.cs @@ -31,15 +31,15 @@ public EnvironmentImportanceSampling(ComputeShader shader) public void ComputeCDFBuffers(CommandBuffer cmd, Texture cubemap) { - cmd.SetComputeIntParam(_shader, "_PathTracingSkyConditionalResolution", _environmentCDF.ConditionalResolution); - cmd.SetComputeIntParam(_shader, "_PathTracingSkyMarginalResolution", _environmentCDF.MarginalResolution); + cmd.SetComputeIntParam(_shader, "_ConditionalResolution", _environmentCDF.ConditionalResolution); + cmd.SetComputeIntParam(_shader, "_MarginalResolution", _environmentCDF.MarginalResolution); - cmd.SetComputeTextureParam(_shader, _computeConditionalKernel, "_PathTracingSkybox", cubemap); - cmd.SetComputeBufferParam(_shader, _computeConditionalKernel, "_PathTracingSkyConditionalBuffer", _environmentCDF.ConditionalBuffer); - cmd.SetComputeBufferParam(_shader, _computeConditionalKernel, "_PathTracingSkyMarginalBuffer", _environmentCDF.MarginalBuffer); + cmd.SetComputeTextureParam(_shader, _computeConditionalKernel, "_EnvCubemap", cubemap); + cmd.SetComputeBufferParam(_shader, _computeConditionalKernel, "_ConditionalBuffer", _environmentCDF.ConditionalBuffer); + cmd.SetComputeBufferParam(_shader, _computeConditionalKernel, "_MarginalBuffer", _environmentCDF.MarginalBuffer); cmd.DispatchCompute(_shader, _computeConditionalKernel, 1, _environmentCDF.MarginalResolution, 1); - cmd.SetComputeBufferParam(_shader, _computeMarginalKernel, "_PathTracingSkyMarginalBuffer", _environmentCDF.MarginalBuffer); + cmd.SetComputeBufferParam(_shader, _computeMarginalKernel, "_MarginalBuffer", _environmentCDF.MarginalBuffer); cmd.DispatchCompute(_shader, _computeMarginalKernel, 1, 1, 1); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.hlsl new file mode 100644 index 00000000000..8fc3affb4d4 --- /dev/null +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.hlsl @@ -0,0 +1,71 @@ +#ifndef _ENVIRONMENT_IMPORTANCE_SAMPLING_HLSL_ +#define _ENVIRONMENT_IMPORTANCE_SAMPLING_HLSL_ + +#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl" + +// Equiareal mapping +float2 MapSkyDirectionToUV(float3 dir) +{ + float cosTheta = dir.y; + float phi = atan2(-dir.z, -dir.x); + return float2(0.5 - phi * INV_TWO_PI, (cosTheta + 1.0) * 0.5); +} + +// Equiareal mapping +float3 MapUVToSkyDirection(float2 uv) +{ + float phi = TWO_PI * (1.0 - uv.x); + float cosTheta = 2.0 * uv.y - 1.0; + return TransformGLtoDX(SphericalToCartesian(phi, cosTheta)); +} + +// Dichotomic search +float SampleSkyCDF(StructuredBuffer cdf, uint size, uint bufferOffset, float smp) +{ + uint i = 0; + for (uint halfsize = size >> 1, offset = halfsize; offset > 0; offset >>= 1) + { + if (smp < cdf[bufferOffset + halfsize]) + { + // i is already in the right half (lower one) + halfsize -= offset >> 1; + } + else + { + // i has to move to the other half (upper one) + i += offset; + halfsize += offset >> 1; + } + } + + // MarginalTexture[0] stores the PDF normalization factor, so we need a test on i == 0 + float cdfInf = i == 0 ? 0.0 : cdf[bufferOffset + i]; + float cdfSup = i + 1 == size ? 1.0f : cdf[bufferOffset + i + 1]; + + return (i + (smp - cdfInf) / (cdfSup - cdfInf)) / size; +} + +float GetSkyPDFNormalizationFactor(StructuredBuffer marginalBuffer) +{ + return marginalBuffer[0]; +} + +// This PDF approximation is valid only if PDF/CDF tables are computed with equiareal mapping +float GetSkyPDFFromValue(float3 value, float pdfNormalization) +{ + return Luminance(value) * pdfNormalization; +} + +float GetSkyPDFFromValue(float3 value, StructuredBuffer marginalBuffer) +{ + return GetSkyPDFFromValue(value, GetSkyPDFNormalizationFactor(marginalBuffer)); +} + +float2 SampleSky(float2 rand, uint marginalResolution, StructuredBuffer marginalBuffer, uint conditionalResolution, StructuredBuffer conditionalBuffer) +{ + float v = SampleSkyCDF(marginalBuffer, marginalResolution, 0, rand.x); + float u = SampleSkyCDF(conditionalBuffer, conditionalResolution, conditionalResolution * uint(v * marginalResolution), rand.y); + return float2(u, v); +} + +#endif diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySampling.hlsl.meta b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.hlsl.meta similarity index 100% rename from Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySampling.hlsl.meta rename to Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.hlsl.meta diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySamplingData.compute b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSamplingBuild.compute similarity index 66% rename from Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySamplingData.compute rename to Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSamplingBuild.compute index 7ec6461e9b5..2a24aa86e06 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySamplingData.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSamplingBuild.compute @@ -1,25 +1,22 @@ // This implementation is adapted from BuildProbabilityTables.compute #pragma only_renderers d3d11 vulkan metal glcore -#define COMPUTE_PATH_TRACING_SKY_SAMPLING_DATA #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl" -#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl" -#include "PathTracingSkySampling.hlsl" +#include "EnvironmentImportanceSampling.hlsl" #define KERNEL_WIDTH 64 -// Make sky data access a little less verbose -#define CONDITIONAL _PathTracingSkyConditionalBuffer -#define MARGINAL _PathTracingSkyMarginalBuffer -#define CONDITIONAL_RESOLUTION _PathTracingSkyConditionalResolution -#define MARGINAL_RESOLUTION _PathTracingSkyMarginalResolution -TextureCube _PathTracingSkybox; -SamplerState sampler_PathTracingSkybox; +uint _ConditionalResolution; +uint _MarginalResolution; +RWStructuredBuffer _ConditionalBuffer; +RWStructuredBuffer _MarginalBuffer; +TextureCube _EnvCubemap; +SamplerState sampler_EnvCubemap; float3 SampleSkyTexture(float3 dir, float lod, int sliceIndex) { - return _PathTracingSkybox.SampleLevel(sampler_PathTracingSkybox, dir, lod).xyz; + return _EnvCubemap.SampleLevel(sampler_EnvCubemap, dir, lod).xyz; } // Performs a block-level parallel scan. @@ -92,38 +89,38 @@ void ComputeConditional(uint3 dispatchThreadId : SV_DispatchThreadID) { const uint i = dispatchThreadId.x; const uint j = dispatchThreadId.y; - const uint iterCount = CONDITIONAL_RESOLUTION / KERNEL_WIDTH; - const uint conditionalBufferOffset = j * CONDITIONAL_RESOLUTION; + const uint iterCount = _ConditionalResolution / KERNEL_WIDTH; + const uint conditionalBufferOffset = j * _ConditionalResolution; uint iter; - float v = (j + 0.5) / MARGINAL_RESOLUTION; + float v = (j + 0.5) / _MarginalResolution; //float sinTheta = sin(v * PI); for (iter = 0; iter < iterCount; iter++) { uint idx = i + iter * KERNEL_WIDTH; - float u = (idx + 0.5) / CONDITIONAL_RESOLUTION; + float u = (idx + 0.5) / _ConditionalResolution; // No need for a sinTheta term in the PDF when using equiareal mapping - float3 dir = MapUVToSkyDirection(u, v); - CONDITIONAL[conditionalBufferOffset + idx] = Luminance(SampleSkyTexture(dir, 0.0, 0).rgb); // * sinTheta; + float3 dir = MapUVToSkyDirection(float2(u, v)); + _ConditionalBuffer[conditionalBufferOffset + idx] = Luminance(SampleSkyTexture(dir, 0.0, 0).rgb); // * sinTheta; } float rowValSum = 0.0f; - ParallelScan(i, CONDITIONAL_RESOLUTION, iterCount, CONDITIONAL, conditionalBufferOffset, rowValSum); + ParallelScan(i, _ConditionalResolution, iterCount, _ConditionalBuffer, conditionalBufferOffset, rowValSum); for (iter = 0; iter < iterCount; iter++) { uint idx = i + iter * KERNEL_WIDTH; - CONDITIONAL[conditionalBufferOffset + idx] /= rowValSum; + _ConditionalBuffer[conditionalBufferOffset + idx] /= rowValSum; } if (i == 0) { - float rowIntegralValue = rowValSum / CONDITIONAL_RESOLUTION; - MARGINAL[j] = rowIntegralValue; + float rowIntegralValue = rowValSum / _ConditionalResolution; + _MarginalBuffer[j] = rowIntegralValue; } } @@ -133,22 +130,22 @@ void ComputeConditional(uint3 dispatchThreadId : SV_DispatchThreadID) void ComputeMarginal(uint3 dispatchThreadId : SV_DispatchThreadID) { const uint i = dispatchThreadId.x; - const uint iterCount = MARGINAL_RESOLUTION / KERNEL_WIDTH; + const uint iterCount = _MarginalResolution / KERNEL_WIDTH; float rowValSum = 0.0f; - ParallelScan(i, MARGINAL_RESOLUTION, iterCount, MARGINAL, 0, rowValSum); + ParallelScan(i, _MarginalResolution, iterCount, _MarginalBuffer, 0, rowValSum); for (uint iter = 0; iter < iterCount; iter++) { uint idx = i + iter * KERNEL_WIDTH; - MARGINAL[idx] /= rowValSum; + _MarginalBuffer[idx] /= rowValSum; } if (i == 0) { - float imgIntegralValue = rowValSum / MARGINAL_RESOLUTION; + float imgIntegralValue = rowValSum / _MarginalResolution; float pdfNormalization = imgIntegralValue > 0.0 ? rcp(imgIntegralValue) * 0.25 * INV_PI : 0.0; - MARGINAL[0] = pdfNormalization; + _MarginalBuffer[0] = pdfNormalization; } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySamplingData.compute.meta b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSamplingBuild.compute.meta similarity index 100% rename from Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySamplingData.compute.meta rename to Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSamplingBuild.compute.meta diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/PathTracingUtil.cs b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/PathTracingUtil.cs index bba21c758a5..94b4e72fe9f 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/PathTracingUtil.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/PathTracingUtil.cs @@ -27,10 +27,10 @@ internal static class ShaderProperties public static readonly int EmissionTextures = Shader.PropertyToID("g_EmissionTextures"); public static readonly int TransmissionTextures = Shader.PropertyToID("g_TransmissionTextures"); public static readonly int AtlasTexelSize = Shader.PropertyToID("g_AtlasTexelSize"); - public static readonly int PathTracingSkyConditionalResolution = Shader.PropertyToID("_PathTracingSkyConditionalResolution"); - public static readonly int PathTracingSkyMarginalResolution = Shader.PropertyToID("_PathTracingSkyMarginalResolution"); - public static readonly int PathTracingSkyConditionalBuffer = Shader.PropertyToID("_PathTracingSkyConditionalBuffer"); - public static readonly int PathTracingSkyMarginalBuffer = Shader.PropertyToID("_PathTracingSkyMarginalBuffer"); + public static readonly int EnvironmentCdfConditionalResolution = Shader.PropertyToID("_EnvironmentCdfConditionalResolution"); + public static readonly int EnvironmentCdfMarginalResolution = Shader.PropertyToID("_EnvironmentCdfMarginalResolution"); + public static readonly int EnvironmentCdfConditionalBuffer = Shader.PropertyToID("_EnvironmentCdfConditionalBuffer"); + public static readonly int EnvironmentCdfMarginalBuffer = Shader.PropertyToID("_EnvironmentCdfMarginalBuffer"); public static readonly int SceneAccelStruct = Shader.PropertyToID("g_SceneAccelStruct"); public static readonly int EnvTex = Shader.PropertyToID("g_EnvTex"); public static readonly int LightEvaluations = Shader.PropertyToID("g_LightEvaluations"); @@ -103,10 +103,10 @@ internal static void BindMaterialsAndTextures(CommandBuffer cmd, IRayTracingShad // Helper function to set the skybox CDF resources internal static void SetEnvSamplingShaderParams(CommandBuffer cmd, IRayTracingShader shader, EnvironmentCDF envCDF) { - shader.SetIntParam(cmd, ShaderProperties.PathTracingSkyConditionalResolution, envCDF.ConditionalResolution); - shader.SetIntParam(cmd, ShaderProperties.PathTracingSkyMarginalResolution, envCDF.MarginalResolution); - shader.SetBufferParam(cmd, ShaderProperties.PathTracingSkyConditionalBuffer, envCDF.ConditionalBuffer); - shader.SetBufferParam(cmd, ShaderProperties.PathTracingSkyMarginalBuffer, envCDF.MarginalBuffer); + shader.SetIntParam(cmd, ShaderProperties.EnvironmentCdfConditionalResolution, envCDF.ConditionalResolution); + shader.SetIntParam(cmd, ShaderProperties.EnvironmentCdfMarginalResolution, envCDF.MarginalResolution); + shader.SetBufferParam(cmd, ShaderProperties.EnvironmentCdfConditionalBuffer, envCDF.ConditionalBuffer); + shader.SetBufferParam(cmd, ShaderProperties.EnvironmentCdfMarginalBuffer, envCDF.MarginalBuffer); } internal static void BindAccelerationStructure(CommandBuffer cmd, IRayTracingShader shader, AccelStructAdapter accel) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/BuildLightGrid.compute b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/BuildLightGrid.compute index b40ba665ba4..93ac3c5d04d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/BuildLightGrid.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/BuildLightGrid.compute @@ -8,9 +8,17 @@ #include "PathTracingRandom.hlsl" #include "PathTracingLightGrid.hlsl" +#if defined(SHADER_API_MOBILE) && defined(SHADER_API_METAL) +// On pre A9 (iPhone 6S and earlier) devices, the max groupshared size is 16352. So to avoid exceeding that limit, we reduce the group size. +#define GROUP_SIZE_X 4 +#define GROUP_SIZE_Y 4 +#define GROUP_SIZE_Z 2 +#else #define GROUP_SIZE_X 4 #define GROUP_SIZE_Y 4 #define GROUP_SIZE_Z 4 +#endif + #define MAX_RESERVOIRS_PER_VOXEL 64 groupshared float s_SampleCount[GROUP_SIZE_X * GROUP_SIZE_Y * GROUP_SIZE_Z * MAX_RESERVOIRS_PER_VOXEL]; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/LightSampling.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/LightSampling.hlsl index ae7c40d96e1..fafa79d51ce 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/LightSampling.hlsl +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/LightSampling.hlsl @@ -7,7 +7,8 @@ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Sampling/Sampling.hlsl" #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl" -#include "PathTracingSkySampling.hlsl" + +#include "Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Environment/EnvironmentImportanceSampling.hlsl" #define SOLID_ANGLE_SAMPLING #define RESAMPLED_IMPORTANCE_SAMPLING @@ -47,6 +48,10 @@ float g_IndirectScale; float g_ExposureScale; int g_MaxIntensity; +uint _EnvironmentCdfConditionalResolution; +uint _EnvironmentCdfMarginalResolution; +StructuredBuffer _EnvironmentCdfConditionalBuffer; +StructuredBuffer _EnvironmentCdfMarginalBuffer; struct LightShapeSample { @@ -452,18 +457,16 @@ bool SamplePunctualLight(float3 P, PTLight light, out LightShapeSample lightSamp bool SampleEnvironmentLight(inout PathTracingSampler rngState, uint dimsOffset, out uint dimsUsed, float3 P, PTLight light, out LightShapeSample lightSample) { - lightSample = (LightShapeSample)0; - float r1 = rngState.GetFloatSample(dimsOffset); - float r2 = rngState.GetFloatSample(dimsOffset+1); + const float2 rand = float2(rngState.GetFloatSample(dimsOffset), rngState.GetFloatSample(dimsOffset + 1)); dimsUsed = 2; #ifdef UNIFORM_ENVSAMPLING // Sample the environment with a random direction. Should only be used for reference / ground truth. - lightSample.lightVector = SampleSphereUniform(r1, r2); + lightSample.lightVector = SampleSphereUniform(rand.x, rand.y); lightSample.weight = 4 * PI; #else - float normalizationFactor = GetSkyPDFNormalizationFactor(); + float normalizationFactor = GetSkyPDFNormalizationFactor(_EnvironmentCdfMarginalBuffer); // A normalization factor of zero means that the environment cubemap was zero, and in this case // its PDF isn't well-defined. It is safe to bail in this case, because the environment wouldn't @@ -471,8 +474,12 @@ bool SampleEnvironmentLight(inout PathTracingSampler rngState, uint dimsOffset, if (normalizationFactor == 0.0f) return false; - // Sample the environment CDF - float2 u = SampleSky(r1, r2); + const float2 u = SampleSky( + rand, + _EnvironmentCdfMarginalResolution, + _EnvironmentCdfMarginalBuffer, + _EnvironmentCdfConditionalResolution, + _EnvironmentCdfConditionalBuffer); lightSample.lightVector = MapUVToSkyDirection(u); float3 envValue = g_EnvTex.SampleLevel(sampler_g_EnvTex, lightSample.lightVector, 0).xyz; @@ -751,7 +758,7 @@ bool GetEnvironmentLightEmissionAndDensity(float3 direction, out float3 emission #ifdef UNIFORM_ENVSAMPLING density = rcp(4 * PI); #else - density = GetSkyPDFFromValue(emission); + density = GetSkyPDFFromValue(emission, _EnvironmentCdfMarginalBuffer); #endif return true; } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySampling.hlsl b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySampling.hlsl deleted file mode 100644 index f33ea713258..00000000000 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/Shaders/PathTracingSkySampling.hlsl +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef _PATHTRACING_PATHTRACINGSKYSAMPLING_HLSL_ -#define _PATHTRACING_PATHTRACINGSKYSAMPLING_HLSL_ - -#ifdef COMPUTE_PATH_TRACING_SKY_SAMPLING_DATA -RWStructuredBuffer _PathTracingSkyConditionalBuffer; -RWStructuredBuffer _PathTracingSkyMarginalBuffer; -#else -StructuredBuffer _PathTracingSkyConditionalBuffer; -StructuredBuffer _PathTracingSkyMarginalBuffer; -#endif - -uint _PathTracingSkyConditionalResolution; -uint _PathTracingSkyMarginalResolution; - -// Equiareal mapping -float2 MapSkyDirectionToUV(float3 dir) -{ - float cosTheta = dir.y; - float phi = atan2(-dir.z, -dir.x); - - return float2(0.5 - phi * INV_TWO_PI, (cosTheta + 1.0) * 0.5); -} - -// Equiareal mapping -float3 MapUVToSkyDirection(float u, float v) -{ - float phi = TWO_PI * (1.0 - u); - float cosTheta = 2.0 * v - 1.0; - - return TransformGLtoDX(SphericalToCartesian(phi, cosTheta)); -} - -float3 MapUVToSkyDirection(float2 uv) -{ - return MapUVToSkyDirection(uv.x, uv.y); -} - -#ifndef COMPUTE_PATH_TRACING_SKY_SAMPLING_DATA - - -bool IsSkySamplingEnabled() -{ - return _PathTracingSkyConditionalResolution; -} - -float GetSkyCDF(StructuredBuffer cdf, uint i, uint offset) -{ - return cdf[offset + i]; -} - -// Dichotomic search -float SampleSkyCDF(StructuredBuffer cdf, uint size, uint bufferOffset, float smp) -{ - uint i = 0; - for (uint halfsize = size >> 1, offset = halfsize; offset > 0; offset >>= 1) - { - if (smp < GetSkyCDF(cdf, halfsize, bufferOffset)) - { - // i is already in the right half (lower one) - halfsize -= offset >> 1; - } - else - { - // i has to move to the other half (upper one) - i += offset; - halfsize += offset >> 1; - } - } - - // MarginalTexture[0] stores the PDF normalization factor, so we need a test on i == 0 - float cdfInf = i > 0 ? GetSkyCDF(cdf, i, bufferOffset) : 0.0; - float cdfSup = i < size ? GetSkyCDF(cdf, i + 1, bufferOffset) : 1.0; - - return (i + (smp - cdfInf) / (cdfSup - cdfInf)) / size; -} - -float GetSkyPDFNormalizationFactor() -{ - return _PathTracingSkyMarginalBuffer[0]; -} - -// This PDF approximation is valid only if PDF/CDF tables are computed with equiareal mapping -float GetSkyPDFFromValue(float3 value, float pdfNormalization) -{ - return Luminance(value) * pdfNormalization; -} - -float GetSkyPDFFromValue(float3 value) -{ - return GetSkyPDFFromValue(value, GetSkyPDFNormalizationFactor()); -} - -float2 SampleSky(float smpU, float smpV) -{ - float v = SampleSkyCDF(_PathTracingSkyMarginalBuffer, _PathTracingSkyMarginalResolution, 0, smpV); - float u = SampleSkyCDF(_PathTracingSkyConditionalBuffer, _PathTracingSkyConditionalResolution, _PathTracingSkyConditionalResolution * uint(v * _PathTracingSkyMarginalResolution), smpU); - return float2(u, v); -} - -float2 SampleSky(float2 smp) -{ - return SampleSky(smp.x, smp.y); -} - -#endif // COMPUTE_PATH_TRACING_SKY_SAMPLING_DATA - -#endif // UNITY_PATH_TRACING_SKY_SAMPLING_INCLUDED diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/World.cs b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/World.cs index 41afb532ec8..c1da6112adf 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/World.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/World.cs @@ -326,7 +326,7 @@ public void Init(RayTracingContext ctx, WorldResourceSet worldResources) _lightState = new LightState(); _cubemapRender = new CubemapRender(worldResources.SkyBoxMesh, worldResources.SixFaceSkyBoxMesh); - _environmentSampling = new EnvironmentImportanceSampling(worldResources.PathTracingSkySamplingDataShader); + _environmentSampling = new EnvironmentImportanceSampling(worldResources.EnvironmentImportanceSamplingBuild); _reservoirGrid = new RegirLightGrid(worldResources.BuildLightGridShader); _conservativeLightGrid = new ConservativeLightGrid(worldResources.BuildLightGridShader); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/WorldResources.cs b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/WorldResources.cs index 79b79bd7fa8..7988ecdb9d9 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/WorldResources.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/PathTracing/WorldResources.cs @@ -1,5 +1,6 @@ using System; using UnityEngine.Rendering; +using UnityEngine.Serialization; #if UNITY_EDITOR using UnityEditor; @@ -28,8 +29,8 @@ public int version [SerializeField, ResourcePath("Runtime/PathTracing/Shaders/SetAlphaChannel.compute")] ComputeShader _setAlphaChannelShader; - [SerializeField, ResourcePath("Runtime/PathTracing/Shaders/PathTracingSkySamplingData.compute")] - ComputeShader _pathTracingSkySamplingDataShader; + [SerializeField, ResourcePath("Runtime/PathTracing/Environment/EnvironmentImportanceSamplingBuild.compute"), FormerlySerializedAs("_pathTracingSkySamplingDataShader")] + ComputeShader _environmentImportanceSamplingBuild; [SerializeField, ResourcePath("Runtime/PathTracing/Meshes/SkyBoxMesh.mesh")] Mesh _skyBoxMesh; @@ -59,10 +60,10 @@ public ComputeShader SetAlphaChannelShader set => this.SetValueAndNotify(ref _setAlphaChannelShader, value, nameof(_setAlphaChannelShader)); } - public ComputeShader PathTracingSkySamplingDataShader + public ComputeShader EnvironmentImportanceSamplingBuild { - get => _pathTracingSkySamplingDataShader; - set => this.SetValueAndNotify(ref _pathTracingSkySamplingDataShader, value, nameof(_pathTracingSkySamplingDataShader)); + get => _environmentImportanceSamplingBuild; + set => this.SetValueAndNotify(ref _environmentImportanceSamplingBuild, value, nameof(_environmentImportanceSamplingBuild)); } public Mesh SkyBoxMesh @@ -89,7 +90,7 @@ internal class WorldResourceSet public ComputeShader BlitCubemap; public ComputeShader BlitGrayScaleCookie; public ComputeShader SetAlphaChannelShader; - public ComputeShader PathTracingSkySamplingDataShader; + public ComputeShader EnvironmentImportanceSamplingBuild; public Mesh SkyBoxMesh; public Mesh SixFaceSkyBoxMesh; public ComputeShader BuildLightGridShader; @@ -102,7 +103,7 @@ public void LoadFromAssetDatabase() BlitCubemap = AssetDatabase.LoadAssetAtPath(packageFolder + "Shaders/BlitCubemap.compute"); BlitGrayScaleCookie = AssetDatabase.LoadAssetAtPath(packageFolder + "Shaders/BlitCookie.compute"); SetAlphaChannelShader = AssetDatabase.LoadAssetAtPath(packageFolder + "Shaders/SetAlphaChannel.compute"); - PathTracingSkySamplingDataShader = AssetDatabase.LoadAssetAtPath(packageFolder + "Shaders/PathTracingSkySamplingData.compute"); + EnvironmentImportanceSamplingBuild = AssetDatabase.LoadAssetAtPath(packageFolder + "Environment/EnvironmentImportanceSamplingBuild.compute"); SkyBoxMesh = AssetDatabase.LoadAssetAtPath(packageFolder + "Meshes/SkyboxMesh.mesh"); SixFaceSkyBoxMesh = AssetDatabase.LoadAssetAtPath(packageFolder + "Meshes/6FaceSkyboxMesh.mesh"); BuildLightGridShader = AssetDatabase.LoadAssetAtPath(packageFolder + "Shaders/BuildLightGrid.compute"); @@ -116,7 +117,7 @@ public bool LoadFromRenderPipelineResources() Debug.Assert(rpResources.BlitCubemap != null); Debug.Assert(rpResources.BlitGrayScaleCookie != null); Debug.Assert(rpResources.SetAlphaChannelShader != null); - Debug.Assert(rpResources.PathTracingSkySamplingDataShader != null); + Debug.Assert(rpResources.EnvironmentImportanceSamplingBuild != null); Debug.Assert(rpResources.SkyBoxMesh != null); Debug.Assert(rpResources.SixFaceSkyBoxMesh != null); Debug.Assert(rpResources.BuildLightGridShader != null); @@ -124,7 +125,7 @@ public bool LoadFromRenderPipelineResources() BlitCubemap = rpResources.BlitCubemap; BlitGrayScaleCookie = rpResources.BlitGrayScaleCookie; SetAlphaChannelShader = rpResources.SetAlphaChannelShader; - PathTracingSkySamplingDataShader = rpResources.PathTracingSkySamplingDataShader; + EnvironmentImportanceSamplingBuild = rpResources.EnvironmentImportanceSamplingBuild; SkyBoxMesh = rpResources.SkyBoxMesh; SixFaceSkyBoxMesh = rpResources.SixFaceSkyBoxMesh; BuildLightGridShader = rpResources.BuildLightGridShader; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/CompilerContextData.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/CompilerContextData.cs index d57ceddb47b..49b0d721fbf 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/CompilerContextData.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/CompilerContextData.cs @@ -61,6 +61,7 @@ void AllocateNativeDataStructuresIfNeeded(int estimatedNumPasses) inputData = new NativeList(estimatedNumPasses * 2, AllocatorManager.Persistent); outputData = new NativeList(estimatedNumPasses * 2, AllocatorManager.Persistent); fragmentData = new NativeList(estimatedNumPasses * 4, AllocatorManager.Persistent); + sampledData = new NativeList(estimatedNumPasses * 2, AllocatorManager.Persistent); randomAccessResourceData = new NativeList(4, AllocatorManager.Persistent); // We assume not a lot of passes use random write nativePassData = new NativeList(estimatedNumPasses, AllocatorManager.Persistent);// assume nothing gets merged nativeSubPassData = new NativeList(estimatedNumPasses, AllocatorManager.Persistent);// there should "never" be more subpasses than graph passes @@ -90,6 +91,7 @@ public void Clear() inputData.Clear(); outputData.Clear(); fragmentData.Clear(); + sampledData.Clear(); randomAccessResourceData.Clear(); nativePassData.Clear(); nativeSubPassData.Clear(); @@ -101,20 +103,20 @@ public void Clear() public ResourcesData resources; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref ResourceUnversionedData UnversionedResourceData(ResourceHandle h) + public ref ResourceUnversionedData UnversionedResourceData(in ResourceHandle h) { return ref resources.unversionedData[h.iType].ElementAt(h.index); } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref ResourceVersionedData VersionedResourceData(ResourceHandle h) + public ref ResourceVersionedData VersionedResourceData(in ResourceHandle h) { return ref resources[h]; } // Iterate over all the readers of a particular resource [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ReadOnlySpan Readers(ResourceHandle h) + public ReadOnlySpan Readers(in ResourceHandle h) { int firstReader = resources.IndexReader(h, 0); int numReaders = resources[h].numReaders; @@ -123,7 +125,7 @@ public ReadOnlySpan Readers(ResourceHandle h) // Get the i'th reader of a resource [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref ResourceReaderData ResourceReader(ResourceHandle h, int i) + public ref ResourceReaderData ResourceReader(in ResourceHandle h, int i) { int numReaders = resources[h].numReaders; #if DEVELOPMENT_BUILD || UNITY_EDITOR @@ -144,6 +146,7 @@ public ref ResourceReaderData ResourceReader(ResourceHandle h, int i) public NativeList inputData; public NativeList outputData; public NativeList fragmentData; + public NativeList sampledData; public NativeList createData; public NativeList destroyData; public NativeList randomAccessResourceData; @@ -153,7 +156,7 @@ public ref ResourceReaderData ResourceReader(ResourceHandle h, int i) public NativeList nativeSubPassData; //Tighty packed list of per nrp subpasses // resources can be added as fragment both as input and output so make sure not to add them twice (return true upon new addition) - public bool TryAddToFragmentList(TextureAccess access, int listFirstIndex, int numItems, out string errorMessage) + public bool TryAddToFragmentList(in TextureAccess access, int listFirstIndex, int numItems, out string errorMessage) { errorMessage = null; #if DEVELOPMENT_BUILD || UNITY_EDITOR @@ -200,13 +203,13 @@ public bool TryAddToFragmentList(TextureAccess access, int listFirstIndex, int n public string GetPassName(int passId) => passNames[passId].name; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public string GetResourceName(ResourceHandle h) => resources.resourceNames[h.iType][h.index].name; + public string GetResourceName(in ResourceHandle h) => resources.resourceNames[h.iType][h.index].name; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public string GetResourceVersionedName(ResourceHandle h) => GetResourceName(h) + " V" + h.version; + public string GetResourceVersionedName(in ResourceHandle h) => GetResourceName(h) + " V" + h.version; // resources can be added as fragment both as input and output so make sure not to add them twice (return true upon new addition) - public bool TryAddToRandomAccessResourceList(ResourceHandle h, int randomWriteSlotIndex, bool preserveCounterValue, int listFirstIndex, int numItems, out string errorMessage) + public bool TryAddToRandomAccessResourceList(in ResourceHandle h, int randomWriteSlotIndex, bool preserveCounterValue, int listFirstIndex, int numItems, out string errorMessage) { errorMessage = null; for (var i = listFirstIndex; i < listFirstIndex + numItems; ++i) @@ -369,6 +372,7 @@ void Cleanup() inputData.Dispose(); outputData.Dispose(); fragmentData.Dispose(); + sampledData.Dispose(); createData.Dispose(); destroyData.Dispose(); randomAccessResourceData.Dispose(); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs index 92b1b7b024a..6c6e6726b60 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.Debug.cs @@ -55,7 +55,7 @@ internal static string MakePassBreakInfoMessage(CompilerContextData ctx, in Nati return msg; } - internal static string MakePassMergeMessage(CompilerContextData ctx, in PassData pass, in PassData prevPass, PassBreakAudit mergeResult) + internal static string MakePassMergeMessage(CompilerContextData ctx, in PassData pass, in PassData prevPass, in PassBreakAudit mergeResult) { string message = mergeResult.reason == PassBreakReason.Merged ? "The passes are compatible to be merged.\n\n" : diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs index a57092ebbfa..0357f870dfe 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/NativePassCompiler.cs @@ -1,6 +1,6 @@ using System; -using System.Diagnostics; using System.Collections.Generic; +using System.Diagnostics; using Unity.Collections; using Unity.Collections.LowLevel.Unsafe; @@ -446,6 +446,22 @@ void BuildGraph() ctxPass.numOutputs++; } + + // For raster passes, we do an extra step to monitor textures sampled in the pass + // It can be a breaking change reason later on when building a native render pass + if (type == (int)RenderGraphResourceType.Texture && ctxPass.type == RenderGraphPassType.Raster) + { + ctxPass.firstSampledOnlyRaster = ctx.sampledData.Length; + foreach (ref readonly var input in ctxPass.Inputs(ctx)) + { + // Check if this input is the shading rate image + if (!ctxPass.IsUsedAsFragment(input.resource, ctx)) + { + ctx.sampledData.Add(input.resource); + ctxPass.numSampledOnlyRaster++; + } + } + } } } } @@ -868,7 +884,7 @@ void FindResourceUsageRangeAndSynchronization() for (int passIndex = 0; passIndex < ctx.passData.Length; passIndex++) { ref var pass = ref ctx.passData.ElementAt(passIndex); - + if (pass.culled) continue; @@ -913,7 +929,7 @@ void FindResourceUsageRangeAndSynchronization() ref var pointToVer = ref ctx.VersionedResourceData(outputResource); var last = pointTo.latestVersionNumber; if (last == outputResource.version && pointToVer.numReaders == 0) - { + { if (isAsync) { // If no fence found, we fallback to the last non culled pass of the graph, not ideal but safe @@ -1034,7 +1050,7 @@ void PropagateTextureUVOrigin() } } - static bool IsGlobalTextureInPass(RenderGraphPass pass, ResourceHandle handle) + static bool IsGlobalTextureInPass(RenderGraphPass pass, in ResourceHandle handle) { foreach (var g in pass.setGlobalsList) { @@ -1673,28 +1689,24 @@ internal unsafe void ExecuteBeginRenderPass(InternalRenderGraphContext rgContext currBeginAttachment = new AttachmentDescriptor(renderTargetInfo.format); // Set up the RT pointers - if (attachments[i].memoryless == false) + var rtHandle = resources.GetTexture(currAttachmentHandle.index); + + //HACK: Always set the loadstore target even if StoreAction == DontCare or Resolve + //and LoadAction == Clear or DontCare + //in these cases you could argue setting the loadStoreTarget to NULL and only set the resolveTarget + //but this confuses the backend (on vulkan) and in general is not how the lower level APIs tend to work. + //because of the RenderTexture duality where we always bundle store+resolve targets as one RTex + //it does become impossible to have a memoryless loadStore texture with a memoryfull resolve + //but that is why we mark this as a hack and future work to fix. + //The proper (and planned) solution would be to move away from the render texture duality. + RenderTargetIdentifier rtidAllSlices = rtHandle; + currBeginAttachment.loadStoreTarget = new RenderTargetIdentifier(rtidAllSlices, attachments[i].mipLevel, CubemapFace.Unknown, attachments[i].depthSlice); + + if (attachments[i].storeAction == RenderBufferStoreAction.Resolve || + attachments[i].storeAction == RenderBufferStoreAction.StoreAndResolve) { - var rtHandle = resources.GetTexture(currAttachmentHandle.index); - - //HACK: Always set the loadstore target even if StoreAction == DontCare or Resolve - //and LoadAction == Clear or DontCare - //in these cases you could argue setting the loadStoreTarget to NULL and only set the resolveTarget - //but this confuses the backend (on vulkan) and in general is not how the lower level APIs tend to work. - //because of the RenderTexture duality where we always bundle store+resolve targets as one RTex - //it does become impossible to have a memoryless loadStore texture with a memoryfull resolve - //but that is why we mark this as a hack and future work to fix. - //The proper (and planned) solution would be to move away from the render texture duality. - RenderTargetIdentifier rtidAllSlices = rtHandle; - currBeginAttachment.loadStoreTarget = new RenderTargetIdentifier(rtidAllSlices, attachments[i].mipLevel, CubemapFace.Unknown, attachments[i].depthSlice); - - if (attachments[i].storeAction == RenderBufferStoreAction.Resolve || - attachments[i].storeAction == RenderBufferStoreAction.StoreAndResolve) - { - currBeginAttachment.resolveTarget = rtHandle; - } + currBeginAttachment.resolveTarget = rtHandle; } - // In the memoryless case it's valid to not set both loadStoreTarget/and resolveTarget as the backend will allocate a transient one currBeginAttachment.loadAction = attachments[i].loadAction; currBeginAttachment.storeAction = attachments[i].storeAction; @@ -1705,7 +1717,7 @@ internal unsafe void ExecuteBeginRenderPass(InternalRenderGraphContext rgContext currBeginAttachment.clearColor = Color.red; currBeginAttachment.clearDepth = 1.0f; currBeginAttachment.clearStencil = 0; - var desc = resources.GetTextureResourceDesc(currAttachmentHandle, true); + ref readonly var desc = ref resources.GetTextureResourceDesc(currAttachmentHandle, true); if (i == 0 && nativePass.hasDepth) { // TODO: There seems to be no clear depth specified ?!?! @@ -1897,7 +1909,7 @@ private void ExecuteSetRenderTargets(RenderGraphPass pass, InternalRenderGraphCo } } - internal unsafe void ExecuteSetRandomWriteTarget(in CommandBuffer cmd, RenderGraphResourceRegistry resources, int index, ResourceHandle resource, bool preserveCounterValue = true) + internal unsafe void ExecuteSetRandomWriteTarget(in CommandBuffer cmd, RenderGraphResourceRegistry resources, int index, in ResourceHandle resource, bool preserveCounterValue = true) { if (resource.type == RenderGraphResourceType.Texture) { diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs index 09555b465e4..cdb8b770e6c 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/PassesData.cs @@ -1,9 +1,7 @@ using System; +using System.Collections.Generic; using System.Diagnostics; using System.Runtime.CompilerServices; -using Unity.Collections.LowLevel.Unsafe; -using UnityEngine.Rendering; -using System.Collections.Generic; using Unity.Collections; using UnityEngine.Experimental.Rendering; @@ -15,7 +13,7 @@ internal readonly struct PassInputData { public readonly ResourceHandle resource; - public PassInputData(ResourceHandle resource) + public PassInputData(in ResourceHandle resource) { this.resource = resource; } @@ -27,7 +25,7 @@ internal readonly struct PassOutputData { public readonly ResourceHandle resource; - public PassOutputData(ResourceHandle resource) + public PassOutputData(in ResourceHandle resource) { this.resource = resource; } @@ -42,7 +40,7 @@ internal readonly struct PassFragmentData public readonly int mipLevel; public readonly int depthSlice; - public PassFragmentData(ResourceHandle handle, AccessFlags flags, int mipLevel, int depthSlice) + public PassFragmentData(in ResourceHandle handle, AccessFlags flags, int mipLevel, int depthSlice) { resource = handle; accessFlags = flags; @@ -80,7 +78,7 @@ internal readonly struct PassRandomWriteData public readonly int index; public readonly bool preserveCounterValue; - public PassRandomWriteData(ResourceHandle resource, int index, bool preserveCounterValue) + public PassRandomWriteData(in ResourceHandle resource, int index, bool preserveCounterValue) { this.resource = resource; this.index = index; @@ -130,6 +128,8 @@ internal struct PassData public int numFragments; public int firstFragmentInput; //base+offset in CompilerContextData.fragmentData (use the Fragment inputs iterator to iterate this more easily) public int numFragmentInputs; + public int firstSampledOnlyRaster; //base+offset in CompilerContextData.sampledData (use the Sampled iterator to iterate this more easily) + public int numSampledOnlyRaster; public int firstRandomAccessResource; //base+offset in CompilerContextData.randomWriteData (use the Fragment inputs iterator to iterate this more easily) public int numRandomAccessResources; public int firstCreate; //base+offset in CompilerContextData.createData (use the InputNodes iterator to iterate this more easily) @@ -181,6 +181,8 @@ public PassData(in RenderGraphPass pass, int passIndex) numOutputs = 0; firstFragment = 0; numFragments = 0; + firstSampledOnlyRaster = 0; + numSampledOnlyRaster = 0; firstRandomAccessResource = 0; numRandomAccessResources = 0; firstFragmentInput = 0; @@ -233,6 +235,8 @@ public void ResetAndInitialize(in RenderGraphPass pass, int passIndex) numFragments = 0; firstFragmentInput = 0; numFragmentInputs = 0; + firstSampledOnlyRaster = 0; + numSampledOnlyRaster = 0; firstRandomAccessResource = 0; numRandomAccessResources = 0; firstCreate = 0; @@ -271,6 +275,10 @@ public readonly ReadOnlySpan Inputs(CompilerContextData ctx) public readonly ReadOnlySpan Fragments(CompilerContextData ctx) => ctx.fragmentData.MakeReadOnlySpan(firstFragment, numFragments); + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public readonly ReadOnlySpan SampledTexturesIfRaster(CompilerContextData ctx) + => ctx.sampledData.MakeReadOnlySpan(firstSampledOnlyRaster, numSampledOnlyRaster); + // ShadingRateImageAttachment [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly PassFragmentData ShadingRateImage(CompilerContextData ctx) @@ -491,7 +499,7 @@ internal readonly struct NativePassAttachment public readonly int mipLevel; public readonly int depthSlice; - public NativePassAttachment(ResourceHandle handle, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, bool memoryless, int mipLevel, int depthSlice) + public NativePassAttachment(in ResourceHandle handle, RenderBufferLoadAction loadAction, RenderBufferStoreAction storeAction, bool memoryless, int mipLevel, int depthSlice) { this.handle = handle; this.loadAction = loadAction; @@ -811,10 +819,10 @@ static bool CanMergeMSAASamples(ref NativePassData nativePass, ref PassData pass return (nativePass.samples == passToMerge.fragmentInfoSamples) || (passToMerge.fragmentInfoSamples == 1 && passToMerge.extendedFeatureFlags.HasFlag(ExtendedFeatureFlags.MultisampledShaderResolve)); } - + static bool AreExtendedFeatureFlagsCompatible(ExtendedFeatureFlags flags0, ExtendedFeatureFlags flags1) { - // Which of the newly added flags are incompatible? + // Which of the newly added flags are incompatible? return true; } @@ -912,22 +920,22 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ } } - // Check the non-fragment inputs of this pass, if they are generated by the current open native pass we can't merge + // Check the non-fragment textures of this pass, if they are generated by the current open native pass we can't merge // as we need to commit the pixels to the texture - foreach (ref readonly var input in passToMerge.Inputs(contextData)) + foreach (ref readonly var sampledTexture in passToMerge.SampledTexturesIfRaster(contextData)) { - var inputResource = input.resource; - - ref readonly var inputDataVersioned = ref contextData.VersionedResourceData(inputResource); + ref readonly var sampledDataVersioned = ref contextData.VersionedResourceData(sampledTexture); - bool isWrittenInCurrNativePass = inputDataVersioned.written && (inputDataVersioned.writePassId >= nativePass.firstGraphPass && inputDataVersioned.writePassId < nativePass.lastGraphPass + 1); - - if (isWrittenInCurrNativePass) + // If the writing pass is culled, we don't need to break the native pass merge + // because the texture won't actually be written to, so there's no read-after-write conflict + bool isWritingPassCulled = contextData.passData[sampledDataVersioned.writePassId].culled; + if (!isWritingPassCulled) { - // If it's not used as a fragment, it's used as some sort of texture read or load so we need to break the current native render pass - // as we can't sample and write to it in the same native render pass - if (!passToMerge.IsUsedAsFragment(inputResource, contextData)) + bool isWrittenInCurrNativePass = sampledDataVersioned.written && (sampledDataVersioned.writePassId >= nativePass.firstGraphPass && sampledDataVersioned.writePassId < nativePass.lastGraphPass + 1); + if (isWrittenInCurrNativePass) { + // It's used as some sort of texture read or load so we need to break the current native render pass + // as we can't sample and write to it in the same native render pass return new PassBreakAudit(PassBreakReason.NextPassReadsTexture, passIdToMerge); } } @@ -939,52 +947,60 @@ public static PassBreakAudit CanMerge(CompilerContextData contextData, int activ // We can't have more than the maximum amount of attachments in a given native renderpass int currAvailableAttachmentSlots = FixedAttachmentArray.MaxAttachments - nativePass.fragments.size; - foreach (ref readonly var fragment in passToMerge.Fragments(contextData)) + // Early exit: only build the HashSet and check if we actually have fragments to check against it + if (passToMerge.numFragments > 0) { - bool alreadyAttached = false; - - for (int i = 0; i < nativePass.fragments.size; ++i) + // Temporary cache of sampled textures in current Native Render Pass for conflict detection against fragments + using (HashSetPool.Get(out var tempSampledTextures)) { - if (PassFragmentData.SameSubResource(nativePass.fragments[i], fragment)) + var graphPasses = nativePass.GraphPasses(contextData); + foreach (ref readonly var graphPass in graphPasses) { - alreadyAttached = true; - break; + if (graphPass.numSampledOnlyRaster > 0) // Skip passes with no sampled textures + { + foreach (ref readonly var earlierInput in graphPass.SampledTexturesIfRaster(contextData)) + { + tempSampledTextures.Add(earlierInput.index); + } + } } - } - // This fragment is not attached to the native renderpass yet, we will need to attach it - if (!alreadyAttached) - { - // We already reached the maximum amount of attachments in this renderpass - // We can't add any new attachment, just start a new renderpass - if (currAvailableAttachmentSlots == 0) + foreach (ref readonly var fragment in passToMerge.Fragments(contextData)) { - return new PassBreakAudit(PassBreakReason.AttachmentLimitReached, passIdToMerge); - } - else - { - attachmentsToTryAdding.Add(fragment); - currAvailableAttachmentSlots--; - } - } + bool alreadyAttached = false; - // Check if this fragment is already sampled in the native renderpass as a standard texture - for (int i = nativePass.firstGraphPass; i <= nativePass.lastGraphPass; ++i) - { - ref var earlierPassData = ref contextData.passData.ElementAt(i); - foreach (ref readonly var earlierInput in earlierPassData.Inputs(contextData)) - { - // If this fragment is already used in current native render pass - if (earlierInput.resource.index == fragment.resource.index) + for (int i = 0; i < nativePass.fragments.size; ++i) + { + if (PassFragmentData.SameSubResource(nativePass.fragments[i], fragment)) + { + alreadyAttached = true; + break; + } + } + + // This fragment is not attached to the native renderpass yet, we will need to attach it + if (!alreadyAttached) { - // If it's not used as a fragment, it's used as some sort of texture read of load so we need to sync it out - if (!earlierPassData.IsUsedAsFragment(earlierInput.resource, contextData)) + // We already reached the maximum amount of attachments in this renderpass + // We can't add any new attachment, just start a new renderpass + if (currAvailableAttachmentSlots == 0) { - return new PassBreakAudit(PassBreakReason.NextPassTargetsTexture, passIdToMerge); + return new PassBreakAudit(PassBreakReason.AttachmentLimitReached, passIdToMerge); + } + else + { + attachmentsToTryAdding.Add(fragment); + currAvailableAttachmentSlots--; } } + + // Check if this fragment is already sampled in the native renderpass as a standard texture + // Before looking in the HashSet check if there is any sampled texture + if (tempSampledTextures.Contains(fragment.resource.index)) + return new PassBreakAudit(PassBreakReason.NextPassTargetsTexture, passIdToMerge); + } - } + } // Close the using block for HashSetPool } foreach (ref readonly var fragmentInput in passToMerge.FragmentInputs(contextData)) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs index e117c199ef9..37685bbe3b0 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/Compiler/ResourcesData.cs @@ -7,10 +7,16 @@ namespace UnityEngine.Rendering.RenderGraphModule.NativeRenderPassCompiler { // Data per usage of a resource(version) - internal struct ResourceReaderData + internal readonly struct ResourceReaderData { - public int passId; // Pass using this - public int inputSlot; // Nth input of the pass using this resource + public readonly int passId; // Pass using this + public readonly int inputSlot; // Nth input of the pass using this resource + + public ResourceReaderData(int _passId, int _inputSlot) + { + passId = _passId; + inputSlot = _inputSlot; + } } // Part of the data that remains the same for all versions of the resource @@ -41,7 +47,7 @@ internal struct ResourceUnversionedData public TextureUVOriginSelection textureUVOrigin; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public string GetName(CompilerContextData ctx, ResourceHandle h) => ctx.GetResourceName(h); + public string GetName(CompilerContextData ctx, in ResourceHandle h) => ctx.GetResourceName(h); public ResourceUnversionedData(TextureResource rll, ref RenderTargetInfo info, ref TextureDesc desc, bool isResourceShared) { @@ -58,7 +64,7 @@ public ResourceUnversionedData(TextureResource rll, ref RenderTargetInfo info, r volumeDepth = info.volumeDepth; msaaSamples = info.msaaSamples; - latestVersionNumber = rll.version; + latestVersionNumber = (int)rll.writeCount; clear = desc.clearBuffer; discard = desc.discardBuffer; @@ -84,7 +90,7 @@ public ResourceUnversionedData(IRenderGraphResource rll, ref BufferDesc _, bool volumeDepth = -1; msaaSamples = -1; - latestVersionNumber = rll.version; + latestVersionNumber = (int)rll.writeCount; clear = false; discard = false; @@ -110,7 +116,7 @@ public ResourceUnversionedData(IRenderGraphResource rll, ref RayTracingAccelerat volumeDepth = -1; msaaSamples = -1; - latestVersionNumber = rll.version; + latestVersionNumber = (int)rll.writeCount; clear = false; discard = false; @@ -137,7 +143,7 @@ internal struct ResourceVersionedData // Register the pass writing this resource version. A version can only be written by a single pass as every write should introduce a new distinct version. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetWritingPass(CompilerContextData ctx, ResourceHandle h, int passId) + public void SetWritingPass(CompilerContextData ctx, in ResourceHandle h, int passId) { #if DEVELOPMENT_BUILD || UNITY_EDITOR if (written) @@ -154,7 +160,7 @@ public void SetWritingPass(CompilerContextData ctx, ResourceHandle h, int passId // Add an extra reader for this resource version. Resource versions can be read many times // The same pass can even read a resource twice (if it is passed to two separate input slots) [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void RegisterReadingPass(CompilerContextData ctx, ResourceHandle h, int passId, int index) + public void RegisterReadingPass(CompilerContextData ctx, in ResourceHandle h, int passId, int index) { #if DEVELOPMENT_BUILD || UNITY_EDITOR if (numReaders >= ctx.resources.MaxReaders[h.iType]) @@ -164,17 +170,13 @@ public void RegisterReadingPass(CompilerContextData ctx, ResourceHandle h, int p throw new Exception($"Maximum '{ctx.resources.MaxReaders}' passes can use a single graph output as input. Pass {passName} is trying to read {resourceName}."); } #endif - ctx.resources.readerData[h.iType][ctx.resources.IndexReader(h, numReaders)] = new ResourceReaderData - { - passId = passId, - inputSlot = index - }; + ctx.resources.readerData[h.iType][ctx.resources.IndexReader(h, numReaders)] = new ResourceReaderData(passId, index); numReaders++; } // Remove all the reads for the given pass of this resource version [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void RemoveReadingPass(CompilerContextData ctx, ResourceHandle h, int passId) + public void RemoveReadingPass(CompilerContextData ctx, in ResourceHandle h, int passId) { for (int r = 0; r < numReaders;) { @@ -333,7 +335,7 @@ public void Initialize(RenderGraphResourceRegistry resources) // Flatten array index [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int Index(ResourceHandle h) + public int Index(in ResourceHandle h) { #if UNITY_EDITOR // Hot path if (h.version < 0 || h.version >= MaxVersions[h.iType]) @@ -344,7 +346,7 @@ public int Index(ResourceHandle h) // Flatten array index [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int IndexReader(ResourceHandle h, int readerID) + public int IndexReader(in ResourceHandle h, int readerID) { #if UNITY_EDITOR // Hot path if (h.version < 0 || h.version >= MaxVersions[h.iType]) diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.Compiler.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.Compiler.cs index 1c44fae3e45..dbe3f0dab2d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.Compiler.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.Compiler.cs @@ -19,14 +19,12 @@ internal NativePassCompiler CompileNativeRenderGraph(int graphHash) if (!compilationIsCached) nativeCompiler.Compile(m_Resources); - var passData = nativeCompiler.contextData.passData; + ref var passData = ref nativeCompiler.contextData.passData; int numPasses = passData.Length; for (int i = 0; i < numPasses; ++i) { - if (passData.ElementAt(i).culled) - continue; - var rp = m_RenderPasses[i]; - m_RendererLists.AddRange(rp.usedRendererListList); + if (!passData.ElementAt(i).culled) + m_RendererLists.AddRange(m_RenderPasses[i].usedRendererListList); } m_Resources.CreateRendererLists(m_RendererLists, m_RenderGraphContext.renderContext, m_RendererListCulling); @@ -40,11 +38,6 @@ void ExecuteNativeRenderGraph() using (new ProfilingScope(m_RenderGraphContext.cmd, ProfilingSampler.Get(RenderGraphProfileId.ExecuteRenderGraph))) { nativeCompiler.ExecuteGraph(m_RenderGraphContext, m_Resources, m_RenderPasses); - - if (m_RenderGraphContext.contextlessTesting == false) - m_RenderGraphContext.renderContext.ExecuteCommandBuffer(m_RenderGraphContext.cmd); - - m_RenderGraphContext.cmd.Clear(); } } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs index 201b0ea333d..4d5627999c0 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraph.cs @@ -969,7 +969,7 @@ public TextureHandle CreateTexture(TextureHandle texture) { CheckNotUsedWhenExecuting(); - return m_Resources.CreateTexture(m_Resources.GetTextureResourceDesc(texture.handle)); + return m_Resources.CreateTexture(in m_Resources.GetTextureResourceDesc(texture.handle)); } /// @@ -1241,7 +1241,7 @@ public BufferHandle CreateBuffer(in BufferHandle graphicsBuffer) { CheckNotUsedWhenExecuting(); - return m_Resources.CreateBuffer(m_Resources.GetBufferResourceDesc(graphicsBuffer.handle)); + return m_Resources.CreateBuffer(in m_Resources.GetBufferResourceDesc(graphicsBuffer.handle)); } /// @@ -1772,7 +1772,7 @@ public void BeginProfilingSampler(ProfilingSampler sampler, passData.sampler = sampler; builder.AllowPassCulling(false); builder.GenerateDebugData(false); - builder.SetRenderFunc((ProfilingScopePassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (ProfilingScopePassData data, UnsafeGraphContext ctx) => { data.sampler.Begin(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -1797,7 +1797,7 @@ public void EndProfilingSampler(ProfilingSampler sampler, passData.sampler = sampler; builder.AllowPassCulling(false); builder.GenerateDebugData(false); - builder.SetRenderFunc((ProfilingScopePassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (ProfilingScopePassData data, UnsafeGraphContext ctx) => { data.sampler.End(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -3036,7 +3036,7 @@ void GenerateCompilerDebugData(ref DebugData debugData) } else if (resourceType == RenderGraphResourceType.Buffer) { - var bufferDesc = m_Resources.GetBufferResourceDesc(handle, true); + ref readonly var bufferDesc = ref m_Resources.GetBufferResourceDesc(handle, true); var bufferData = new DebugData.BufferResourceData(); bufferData.count = bufferDesc.count; @@ -3120,7 +3120,7 @@ void GenerateCompilerDebugData(ref DebugData debugData) Dictionary registeredGlobals = new Dictionary(); - internal void SetGlobal(TextureHandle h, int globalPropertyId) + internal void SetGlobal(in TextureHandle h, int globalPropertyId) { if (!h.IsValid()) throw new ArgumentException("Attempting to register an invalid texture handle as a global"); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilder.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilder.cs index 8bdf1bfd889..3dfb424ed04 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilder.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilder.cs @@ -132,7 +132,7 @@ public TextureHandle CreateTransientTexture(in TextureDesc desc) /// A new transient TextureHandle. public TextureHandle CreateTransientTexture(in TextureHandle texture) { - var desc = m_Resources.GetTextureResourceDesc(texture.handle); + ref readonly var desc = ref m_Resources.GetTextureResourceDesc(texture.handle); var result = m_Resources.CreateTexture(desc, m_RenderPass.index); m_RenderPass.AddTransientResource(result.handle); return result; @@ -221,7 +221,7 @@ public BufferHandle CreateTransientBuffer(in BufferDesc desc) /// A new transient GraphicsBufferHandle. public BufferHandle CreateTransientBuffer(in BufferHandle graphicsbuffer) { - var desc = m_Resources.GetBufferResourceDesc(graphicsbuffer.handle); + ref readonly var desc = ref m_Resources.GetBufferResourceDesc(graphicsbuffer.handle); var result = m_Resources.CreateBuffer(desc, m_RenderPass.index); m_RenderPass.AddTransientResource(result.handle); return result; diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilders.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilders.cs index f34f8a29503..0418d32c776 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilders.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphBuilders.cs @@ -84,26 +84,26 @@ public void EnableFoveatedRasterization(bool value) public BufferHandle CreateTransientBuffer(in BufferDesc desc) { var result = m_Resources.CreateBuffer(desc, m_RenderPass.index); - UseResource(result.handle, AccessFlags.Write | AccessFlags.Read, isTransient: true); + UseTransientResource(result.handle); return result; } public BufferHandle CreateTransientBuffer(in BufferHandle computebuffer) { - var desc = m_Resources.GetBufferResourceDesc(computebuffer.handle); + ref readonly var desc = ref m_Resources.GetBufferResourceDesc(computebuffer.handle); return CreateTransientBuffer(desc); } public TextureHandle CreateTransientTexture(in TextureDesc desc) { var result = m_Resources.CreateTexture(desc, m_RenderPass.index); - UseResource(result.handle, AccessFlags.Write | AccessFlags.Read, isTransient: true); + UseTransientResource(result.handle); return result; } public TextureHandle CreateTransientTexture(in TextureHandle texture) { - var desc = m_Resources.GetTextureResourceDesc(texture.handle); + ref readonly var desc = ref m_Resources.GetTextureResourceDesc(texture.handle); return CreateTransientTexture(desc); } @@ -163,7 +163,7 @@ protected virtual void Dispose(bool disposing) } [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - private void ValidateWriteTo(in ResourceHandle handle) + private void CheckWriteTo(in ResourceHandle handle) { if (RenderGraph.enableValidityChecks) { @@ -201,57 +201,63 @@ private void ValidateWriteTo(in ResourceHandle handle) } } - private ResourceHandle UseResource(in ResourceHandle handle, AccessFlags flags, bool isTransient = false) + // Lifetime of a transient resource is one render graph pass + private ResourceHandle UseTransientResource(in ResourceHandle inputHandle) { - CheckResource(handle); + CheckResource(inputHandle); - // If we are not discarding the resource, add a "read" dependency on the current version - // this "Read" is a bit of a misnomer it really means more like "Preserve existing content or read" - if ((flags & AccessFlags.Discard) == 0) - { - ResourceHandle versioned; - if (!handle.IsVersioned) - { - versioned = m_Resources.GetLatestVersionHandle(handle); - } - else - { - versioned = handle; - } + ResourceHandle versionedHandle = inputHandle.IsVersioned ? inputHandle : m_Resources.GetLatestVersionHandle(inputHandle); - if (isTransient) - { - m_RenderPass.AddTransientResource(versioned); - return GetLatestVersionHandle(handle); - } + // Transient resources are always considered written and read in the render graph pass where they are used + // Compiler will take it into account later, no need to add them to read and write lists + m_RenderPass.AddTransientResource(versionedHandle); + + return versionedHandle; + } + + private ResourceHandle UseResource(in ResourceHandle inputHandle, AccessFlags flags) + { + CheckResource(inputHandle); + + bool discard = (flags & AccessFlags.Discard) != 0; + bool read = (flags & AccessFlags.Read) != 0; + bool write = (flags & AccessFlags.Write) != 0; - m_RenderPass.AddResourceRead(versioned); - m_Resources.IncrementReadCount(handle); + ResourceHandle versionedHandle = inputHandle.IsVersioned ? inputHandle : m_Resources.GetLatestVersionHandle(inputHandle); - if ((flags & AccessFlags.Read) == 0) + // If we are not discarding the current version and its data, add a "read" dependency on it + // this is a bit of a misnomer it really means more like "Preserve existing content or read" + if (!discard) + { + m_Resources.IncrementReadCount(versionedHandle); + m_RenderPass.AddResourceRead(versionedHandle); + + // Implicit read - not user-specified + if (!read) { - // Flag the resource as being an "implicit read" so that we can distinguish it from a user-specified read - m_RenderPass.implicitReadsList.Add(versioned); + m_RenderPass.implicitReadsList.Add(versionedHandle); } } else { // We are discarding it but we still read it, so we add a dependency on version "0" of this resource - if ((flags & AccessFlags.Read) != 0) + if (read) { - m_RenderPass.AddResourceRead(m_Resources.GetZeroVersionedHandle(handle)); - m_Resources.IncrementReadCount(handle); + var zeroVersionHandle = m_Resources.GetZeroVersionHandle(versionedHandle); + m_Resources.IncrementReadCount(zeroVersionHandle); + m_RenderPass.AddResourceRead(zeroVersionHandle); } } - if ((flags & AccessFlags.Write) != 0) + if (write) { - ValidateWriteTo(handle); - m_RenderPass.AddResourceWrite(m_Resources.GetNewVersionedHandle(handle)); - m_Resources.IncrementWriteCount(handle); + CheckWriteTo(inputHandle); + // New versioned written by this render graph pass + versionedHandle = m_Resources.IncrementWriteCount(inputHandle); + m_RenderPass.AddResourceWrite(versionedHandle); } - return GetLatestVersionHandle(handle); + return versionedHandle; } public BufferHandle UseBuffer(in BufferHandle input, AccessFlags flags) @@ -266,12 +272,11 @@ public BufferHandle UseBuffer(in BufferHandle input, AccessFlags flags) // for ample UseTexture(myTexV1, read) UseFragment(myTexV2, ReadWrite) as they are different versions // but for now we don't allow any of that. [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - private void CheckNotUseFragment(TextureHandle tex) + private void CheckNotUseFragment(in TextureHandle tex) { - if(RenderGraph.enableValidityChecks) + if (RenderGraph.enableValidityChecks) { - bool usedAsFragment = false; - usedAsFragment = (m_RenderPass.depthAccess.textureHandle.IsValid() && m_RenderPass.depthAccess.textureHandle.handle.index == tex.handle.index); + bool usedAsFragment = (m_RenderPass.depthAccess.textureHandle.IsValid() && m_RenderPass.depthAccess.textureHandle.handle.index == tex.handle.index); if (!usedAsFragment) { for (int i = 0; i <= m_RenderPass.colorBufferMaxIndex; i++) @@ -293,7 +298,7 @@ private void CheckNotUseFragment(TextureHandle tex) } [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - private void CheckTextureUVOriginIsValid(ResourceHandle handle, TextureResource texRes) + private void CheckTextureUVOriginIsValid(in ResourceHandle handle, TextureResource texRes) { if (texRes.textureUVOrigin == TextureUVOriginSelection.TopLeft) { @@ -345,9 +350,9 @@ public void SetGlobalTextureAfterPass(in TextureHandle input, int propertyId) // Shared validation between SetRenderAttachment/SetRenderAttachmentDepth [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] - private void CheckUseFragment(TextureHandle tex, bool isDepth) + private void CheckUseFragment(in TextureHandle tex, bool isDepth) { - if(RenderGraph.enableValidityChecks) + if (RenderGraph.enableValidityChecks) { // We ignore the version as we don't allow mixing UseTexture/UseFragment between different versions // even though it should theoretically work (and we might do so in the future) for now we're overly strict. @@ -533,22 +538,11 @@ public void UseRendererList(in RendererListHandle input) { m_RenderPass.UseRendererList(input); } - - private ResourceHandle GetLatestVersionHandle(in ResourceHandle handle) - { - // Transient resources can't be used outside the pass so can never be versioned - if (m_Resources.GetRenderGraphResourceTransientIndex(handle) >= 0) - { - return handle; - } - - return m_Resources.GetLatestVersionHandle(handle); - } - + [Conditional("DEVELOPMENT_BUILD"), Conditional("UNITY_EDITOR")] void CheckResource(in ResourceHandle res, bool checkTransientReadWrite = false) { - if(RenderGraph.enableValidityChecks) + if (RenderGraph.enableValidityChecks) { if (res.IsValid()) { diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphPass.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphPass.cs index dc50c917066..a2d3a91110d 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphPass.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphPass.cs @@ -371,7 +371,7 @@ void ComputeTextureHash(ref HashFNV1A32 generator, in ResourceHandle handle, Ren { var res = resources.GetTextureResource(handle); var graphicsResource = res.graphicsResource; - ref var desc = ref res.desc; + ref readonly var desc = ref res.desc; var externalTexture = graphicsResource.externalTexture; if (externalTexture != null) // External texture @@ -416,7 +416,7 @@ void ComputeTextureHash(ref HashFNV1A32 generator, in ResourceHandle handle, Ren } else { - var desc = resources.GetTextureResourceDesc(handle); + ref readonly var desc = ref resources.GetTextureResourceDesc(handle); generator.Append((int) desc.format); generator.Append((int) desc.dimension); generator.Append((int) desc.msaaSamples); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceAccelerationStructure.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceAccelerationStructure.cs index b5e2caaffcc..19c76e5d4bd 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceAccelerationStructure.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceAccelerationStructure.cs @@ -8,7 +8,7 @@ namespace UnityEngine.Rendering.RenderGraphModule /// [DebuggerDisplay("RayTracingAccelerationStructure ({handle.index})")] [MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")] - public struct RayTracingAccelerationStructureHandle + public readonly struct RayTracingAccelerationStructureHandle { private static RayTracingAccelerationStructureHandle s_NullHandle = new RayTracingAccelerationStructureHandle(); @@ -18,7 +18,7 @@ public struct RayTracingAccelerationStructureHandle /// A null ray tracing acceleration structure handle. public static RayTracingAccelerationStructureHandle nullHandle { get { return s_NullHandle; } } - internal ResourceHandle handle; + internal readonly ResourceHandle handle; internal RayTracingAccelerationStructureHandle(int handle) { this.handle = new ResourceHandle(handle, RenderGraphResourceType.AccelerationStructure, false); } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceBuffer.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceBuffer.cs index ce35d207bdd..97b8430077e 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceBuffer.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceBuffer.cs @@ -9,7 +9,7 @@ namespace UnityEngine.Rendering.RenderGraphModule /// [DebuggerDisplay("Buffer ({handle.index})")] [MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")] - public struct BufferHandle + public readonly struct BufferHandle { // Minor Warning: This calls the zeroing constructor this means that the embedded ResourceHandle struct will also be zero-ed // which then means ResourceHandle.type will be set to zero == Texture. As this is an "invalid" bufferhandle I guess setting it @@ -22,7 +22,7 @@ public struct BufferHandle /// A null graphics buffer handle. public static BufferHandle nullHandle { get { return s_NullHandle; } } - internal ResourceHandle handle; + internal readonly ResourceHandle handle; internal BufferHandle(in ResourceHandle h) { handle = h; } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs index f2cd92a260f..8a21135bec2 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceRegistry.cs @@ -348,10 +348,11 @@ void CheckHandleValidity(RenderGraphResourceType type, int index) } } - internal void IncrementWriteCount(in ResourceHandle res) + internal ResourceHandle IncrementWriteCount(in ResourceHandle res) { CheckHandleValidity(res); - m_RenderGraphResources[res.iType].resourceArray[res.index].IncrementWriteCount(); + var version = (int)m_RenderGraphResources[res.iType].resourceArray[res.index].IncrementWriteCount(); + return new ResourceHandle(res, version); } internal void IncrementReadCount(in ResourceHandle res) @@ -359,40 +360,20 @@ internal void IncrementReadCount(in ResourceHandle res) CheckHandleValidity(res); m_RenderGraphResources[res.iType].resourceArray[res.index].IncrementReadCount(); } - - internal void NewVersion(in ResourceHandle res) - { - CheckHandleValidity(res); - m_RenderGraphResources[res.iType].resourceArray[res.index].NewVersion(); - } - + internal ResourceHandle GetLatestVersionHandle(in ResourceHandle res) { CheckHandleValidity(res); - var ver = m_RenderGraphResources[res.iType].resourceArray[res.index].version; - return new ResourceHandle(res, ver); + var version = (int)m_RenderGraphResources[res.iType].resourceArray[res.index].writeCount; + return new ResourceHandle(res, version); } - internal int GetLatestVersionNumber(in ResourceHandle res) - { - CheckHandleValidity(res); - var ver = m_RenderGraphResources[res.iType].resourceArray[res.index].version; - return ver; - } - - internal ResourceHandle GetZeroVersionedHandle(in ResourceHandle res) + internal ResourceHandle GetZeroVersionHandle(in ResourceHandle res) { CheckHandleValidity(res); return new ResourceHandle(res, 0); } - internal ResourceHandle GetNewVersionedHandle(in ResourceHandle res) - { - CheckHandleValidity(res); - var ver = m_RenderGraphResources[res.iType].resourceArray[res.index].NewVersion(); - return new ResourceHandle(res, ver); - } - internal IRenderGraphResource GetResourceLowLevel(in ResourceHandle res) { CheckHandleValidity(res); @@ -750,7 +731,7 @@ internal void GetRenderTargetInfo(in ResourceHandle res, out RenderTargetInfo ou // we can't know from the size/format/... from the enum. It's implicitly defined by the current camera, // screen resolution,.... we can't even hope to know or replicate the size calculation here // so we just say we don't know what this rt is and rely on the user passing in the info to us. - var desc = GetTextureResourceDesc(res, true); + ref readonly var desc = ref GetTextureResourceDesc(res, true); #if DEVELOPMENT_BUILD || UNITY_EDITOR if (desc.width == 0 || desc.height == 0 || desc.slices == 0 || desc.msaaSamples == 0 || desc.format == GraphicsFormat.None) { @@ -773,7 +754,7 @@ internal void GetRenderTargetInfo(in ResourceHandle res, out RenderTargetInfo ou else { // Managed by rendergraph, it might not be created yet so we look at the desc to find out - var desc = GetTextureResourceDesc(res); + ref readonly var desc = ref GetTextureResourceDesc(res); var dim = desc.CalculateFinalDimensions(); outInfo = new RenderTargetInfo(); outInfo.width = dim.x; @@ -851,13 +832,13 @@ internal TextureResource GetTextureResource(int index) return m_RenderGraphResources[(int)RenderGraphResourceType.Texture].resourceArray[index] as TextureResource; } - internal TextureDesc GetTextureResourceDesc(in ResourceHandle handle, bool noThrowOnInvalidDesc = false) + internal ref readonly TextureDesc GetTextureResourceDesc(in ResourceHandle handle, bool noThrowOnInvalidDesc = false) { Debug.Assert(handle.type == RenderGraphResourceType.Texture); var texture = (m_RenderGraphResources[(int)RenderGraphResourceType.Texture].resourceArray[handle.index] as TextureResource); if (!texture.validDesc && !noThrowOnInvalidDesc) throw new ArgumentException("The passed in texture handle does not have a valid descriptor. (This is most commonly cause by the handle referencing a built-in texture such as the system back buffer.)", "handle"); - return texture.desc; + return ref texture.desc; } internal RendererListHandle CreateRendererList(in CoreRendererListDesc desc) @@ -952,13 +933,13 @@ internal BufferHandle CreateBuffer(in BufferDesc desc, int transientPassIndex = return new BufferHandle(newHandle); } - internal BufferDesc GetBufferResourceDesc(in ResourceHandle handle, bool noThrowOnInvalidDesc = false) + internal ref readonly BufferDesc GetBufferResourceDesc(in ResourceHandle handle, bool noThrowOnInvalidDesc = false) { Debug.Assert(handle.type == RenderGraphResourceType.Buffer); var buffer = (m_RenderGraphResources[(int)RenderGraphResourceType.Buffer].resourceArray[handle.index] as BufferResource); if (!buffer.validDesc && !noThrowOnInvalidDesc) throw new ArgumentException("The passed in buffer handle does not have a valid descriptor. (This is most commonly cause by importing the buffer.)", "handle"); - return buffer.desc; + return ref buffer.desc; } internal int GetBufferResourceCount() diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceTexture.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceTexture.cs index 408ac2fa8de..eb039afa38b 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceTexture.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResourceTexture.cs @@ -14,7 +14,7 @@ internal readonly struct TextureAccess public readonly int depthSlice; public readonly AccessFlags flags; - public TextureAccess(TextureHandle handle, AccessFlags flags, int mipLevel, int depthSlice) + public TextureAccess(in TextureHandle handle, AccessFlags flags, int mipLevel, int depthSlice) { this.textureHandle = handle; this.flags = flags; @@ -22,7 +22,7 @@ public TextureAccess(TextureHandle handle, AccessFlags flags, int mipLevel, int this.depthSlice = depthSlice; } - public TextureAccess(TextureAccess access, TextureHandle handle) + public TextureAccess(in TextureAccess access, in TextureHandle handle) { this.textureHandle = handle; this.flags = access.flags; @@ -97,7 +97,7 @@ internal enum TextureUVOriginSelection /// [DebuggerDisplay("Texture ({handle.index})")] [MovedFrom(true, "UnityEngine.Experimental.Rendering.RenderGraphModule", "UnityEngine.Rendering.RenderGraphModule")] - public struct TextureHandle + public readonly struct TextureHandle { private static TextureHandle s_NullHandle = new TextureHandle(); @@ -107,9 +107,9 @@ public struct TextureHandle /// A null texture handle. public static TextureHandle nullHandle { get { return s_NullHandle; } } - internal ResourceHandle handle; + internal readonly ResourceHandle handle; - private bool builtin; + private readonly bool builtin; internal TextureHandle(in ResourceHandle h) { @@ -508,7 +508,6 @@ public Vector2Int CalculateFinalDimensions() TextureSizeMode.Functor => RTHandles.CalculateDimensions(func), _ => throw new ArgumentOutOfRangeException() }; - } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs index cfcf52956bf..0a34696ee40 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphResources.cs @@ -136,7 +136,6 @@ class IRenderGraphResource public int cachedHash; public int transientPassIndex; public int sharedResourceLastFrameUsed; - public int version; [MethodImpl(MethodImplOptions.AggressiveInlining)] public virtual void Reset(IRenderGraphResourcePool _ = null) @@ -150,7 +149,6 @@ public virtual void Reset(IRenderGraphResourcePool _ = null) requestFallBack = false; writeCount = 0; readCount = 0; - version = 0; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -166,9 +164,10 @@ public virtual bool IsCreated() } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public virtual void IncrementWriteCount() + public virtual uint IncrementWriteCount() { writeCount++; + return writeCount; } // readCount is currently not used in the HDRP Compiler. @@ -178,13 +177,6 @@ public virtual void IncrementReadCount() readCount++; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public virtual int NewVersion() - { - version++; - return version; - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public virtual bool NeedsFallBack() { diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphUtilsBlit.cs b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphUtilsBlit.cs index 2552aed1337..eb59d9d9ed9 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphUtilsBlit.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderGraph/RenderGraphUtilsBlit.cs @@ -214,7 +214,7 @@ public static IBaseRenderGraphBuilder AddCopyPass( builder.SetInputAttachment(source, 0); builder.SetRenderAttachment(destination, 0, AccessFlags.Write); - builder.SetRenderFunc((CopyPassData data, RasterGraphContext context) => CopyRenderFunc(data, context)); + builder.SetRenderFunc(static (CopyPassData data, RasterGraphContext context) => CopyRenderFunc(data, context)); if (passData.force2DForXR) builder.AllowGlobalStateModification(true);// So we can set the keywords @@ -451,7 +451,7 @@ public static IBaseRenderGraphBuilder AddBlitPass(this RenderGraph graph, passData.isDepth = destinationIsDepth; builder.UseTexture(source, AccessFlags.Read); builder.UseTexture(destination, AccessFlags.Write); - builder.SetRenderFunc((BlitPassData data, UnsafeGraphContext context) => BlitRenderFunc(data, context)); + builder.SetRenderFunc(static (BlitPassData data, UnsafeGraphContext context) => BlitRenderFunc(data, context)); } catch { @@ -1026,7 +1026,7 @@ public static IBaseRenderGraphBuilder AddBlitPass(this RenderGraph graph, builder.UseTexture(blitParameters.source); } builder.UseTexture(blitParameters.destination, AccessFlags.Write); - builder.SetRenderFunc((BlitMaterialPassData data, UnsafeGraphContext context) => BlitMaterialRenderFunc(data, context)); + builder.SetRenderFunc(static (BlitMaterialPassData data, UnsafeGraphContext context) => BlitMaterialRenderFunc(data, context)); } catch { diff --git a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/InstanceOcclusionCullingKernels.compute b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/InstanceOcclusionCullingKernels.compute index fd055762f53..6c9fc7378a6 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/InstanceOcclusionCullingKernels.compute +++ b/Packages/com.unity.render-pipelines.core/Runtime/RenderPipelineResources/GPUDriven/InstanceOcclusionCullingKernels.compute @@ -18,17 +18,22 @@ #define OCCLUSION_ANY_PASS #endif -#define DRAW_ARGS_INDEX(N) (5*(_DrawInfoAllocIndex + (N))) -#define DRAW_ARGS_INDEX_INDIRECT_DISPATCH DRAW_ARGS_INDEX(_DrawInfoCount) -#define DRAW_ARGS_INDEX_INSTANCE_COUNTER (DRAW_ARGS_INDEX_INDIRECT_DISPATCH + 3) +#define DRAW_ARGS_PARAMETER_COUNT 5 +#define DRAW_ARGS_INSTANCE_COUNT_PARAMETER_OFFSET 1 +#define DRAW_ARGS_INDEX(N) (DRAW_ARGS_PARAMETER_COUNT*(_DrawInfoAllocIndex + (N))) +#define DRAW_ARGS_INDEX_INDIRECT_DISPATCH DRAW_ARGS_INDEX(_DrawInfoCount) +#define DRAW_ARGS_INDEX_INSTANCE_COUNTER (DRAW_ARGS_INDEX_INDIRECT_DISPATCH + 3) #define INSTANCE_INFO_OFFSET_SECOND_PASS(N) (_InstanceInfoCount + (N)) // buffers allocate 2 sets of instance info per instance (for the second pass) #define INSTANCE_ALLOC_INDEX (_InstanceInfoAllocIndex/2) +#define THREAD_GROUP_SIZE 64 + StructuredBuffer _DrawInfo; RWStructuredBuffer _InstanceInfo; +RWStructuredBuffer _DispatchArgs; RWStructuredBuffer _DrawArgs; RWByteAddressBuffer _InstanceIndices; ByteAddressBuffer _InstanceDataBuffer; @@ -66,7 +71,7 @@ SphereBound LoadInstanceBoundingSphere(uint instanceID) return b; } -[numthreads(64,1,1)] +[numthreads(THREAD_GROUP_SIZE, 1, 1)] void ResetDrawArgs(uint drawInfoOffset : SV_DispatchThreadID) { if (drawInfoOffset < _DrawInfoCount) @@ -84,11 +89,11 @@ void ResetDrawArgs(uint drawInfoOffset : SV_DispatchThreadID) if (drawInfoOffset == 0) { #ifdef OCCLUSION_SECOND_PASS - // convert to dispatch args - uint argsBase = DRAW_ARGS_INDEX_INDIRECT_DISPATCH; - _DrawArgs[argsBase + 0] = (_DrawArgs[DRAW_ARGS_INDEX_INSTANCE_COUNTER] + 63)/64; - _DrawArgs[argsBase + 1] = 1; - _DrawArgs[argsBase + 2] = 1; + // convert to compute dispatch args + uint argsBase = 0; + _DispatchArgs[argsBase + 0] = (_DrawArgs[DRAW_ARGS_INDEX_INSTANCE_COUNTER] + (THREAD_GROUP_SIZE-1)) / THREAD_GROUP_SIZE; + _DispatchArgs[argsBase + 1] = 1; + _DispatchArgs[argsBase + 2] = 1; #else // zero the instance count _DrawArgs[DRAW_ARGS_INDEX_INSTANCE_COUNTER] = 0; @@ -96,7 +101,7 @@ void ResetDrawArgs(uint drawInfoOffset : SV_DispatchThreadID) } } -[numthreads(64, 1, 1)] +[numthreads(THREAD_GROUP_SIZE, 1, 1)] void CopyInstances(uint dispatchIdx : SV_DispatchThreadID) { if (dispatchIdx < _DrawInfoCount) @@ -133,7 +138,7 @@ uint GetPrimitiveCount(uint indexCount, uint topology, bool nativeQuads) } } -[numthreads(64,1,1)] +[numthreads(THREAD_GROUP_SIZE, 1, 1)] void CullInstances(uint instanceInfoOffset : SV_DispatchThreadID) { uint instanceInfoCount = GetInstanceInfoCount(); @@ -202,7 +207,7 @@ void CullInstances(uint instanceInfoOffset : SV_DispatchThreadID) { uint argsBase = DRAW_ARGS_INDEX(drawOffset); uint offsetWithinDraw = 0; - InterlockedAdd(_DrawArgs[argsBase + 1], 1 << _InstanceMultiplierShift, offsetWithinDraw); // IndirectDrawIndexedArgs.instanceCount + InterlockedAdd(_DrawArgs[argsBase + DRAW_ARGS_INSTANCE_COUNT_PARAMETER_OFFSET], 1 << _InstanceMultiplierShift, offsetWithinDraw); // IndirectDrawIndexedArgs.instanceCount offsetWithinDraw = offsetWithinDraw >> _InstanceMultiplierShift; IndirectDrawInfo drawInfo = LoadDrawInfo(drawOffset); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/STP/STP.cs b/Packages/com.unity.render-pipelines.core/Runtime/STP/STP.cs index e37aa350392..6677f23a897 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/STP/STP.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/STP/STP.cs @@ -1047,7 +1047,7 @@ class TaaData } // Internal helper function used to streamline usage of the render graph API - static TextureHandle UseTexture(IBaseRenderGraphBuilder builder, TextureHandle texture, AccessFlags flags = AccessFlags.Read) + static TextureHandle UseTexture(IBaseRenderGraphBuilder builder, in TextureHandle texture, AccessFlags flags = AccessFlags.Read) { builder.UseTexture(texture, flags); return texture; @@ -1170,7 +1170,7 @@ public static TextureHandle Execute(RenderGraph renderGraph, ref Config config) passData.priorConvergence = UseTexture(builder, renderGraph.ImportTexture(priorConvergence)); builder.SetRenderFunc( - (SetupData data, ComputeGraphContext ctx) => + static (SetupData data, ComputeGraphContext ctx) => { // Update the constant buffer data on the GPU // TODO: Fix usage of m_WrappedCommandBuffer here once NRP support is added to ConstantBuffer.cs @@ -1248,7 +1248,7 @@ public static TextureHandle Execute(RenderGraph renderGraph, ref Config config) passData.convergence = UseTexture(builder, renderGraph.ImportTexture(convergence), AccessFlags.WriteAll); builder.SetRenderFunc( - (PreTaaData data, ComputeGraphContext ctx) => + static (PreTaaData data, ComputeGraphContext ctx) => { ConstantBuffer.Set(data.cs, ShaderResources._StpConstantBufferData); @@ -1310,7 +1310,7 @@ public static TextureHandle Execute(RenderGraph renderGraph, ref Config config) passData.output = UseTexture(builder, config.destination, AccessFlags.WriteAll); builder.SetRenderFunc( - (TaaData data, ComputeGraphContext ctx) => + static (TaaData data, ComputeGraphContext ctx) => { ConstantBuffer.Set(data.cs, ShaderResources._StpConstantBufferData); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Textures/PowerOfTwoTextureAtlas.cs b/Packages/com.unity.render-pipelines.core/Runtime/Textures/PowerOfTwoTextureAtlas.cs index df3496d78e3..1c16a0dc057 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Textures/PowerOfTwoTextureAtlas.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Textures/PowerOfTwoTextureAtlas.cs @@ -126,7 +126,7 @@ public override void BlitTexture(CommandBuffer cmd, Vector4 scaleOffset, Texture if (Is2D(texture)) { Blit2DTexture(cmd, scaleOffset, texture, sourceScaleOffset, blitMips, BlitType.Padding); - MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetInstanceID(), blitMips); + MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetEntityId(), blitMips); } } @@ -145,7 +145,7 @@ public void BlitTextureMultiply(CommandBuffer cmd, Vector4 scaleOffset, Texture if (Is2D(texture)) { Blit2DTexture(cmd, scaleOffset, texture, sourceScaleOffset, blitMips, BlitType.PaddingMultiply); - MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetInstanceID(), blitMips); + MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetEntityId(), blitMips); } } @@ -164,7 +164,7 @@ public override void BlitOctahedralTexture(CommandBuffer cmd, Vector4 scaleOffse if (Is2D(texture)) { Blit2DTexture(cmd, scaleOffset, texture, sourceScaleOffset, blitMips, BlitType.OctahedralPadding); - MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetInstanceID(), blitMips); + MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetEntityId(), blitMips); } } @@ -183,7 +183,7 @@ public void BlitOctahedralTextureMultiply(CommandBuffer cmd, Vector4 scaleOffset if (Is2D(texture)) { Blit2DTexture(cmd, scaleOffset, texture, sourceScaleOffset, blitMips, BlitType.OctahedralPaddingMultiply); - MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetInstanceID(), blitMips); + MarkGPUTextureValid(overrideInstanceID != -1 ? overrideInstanceID : texture.GetEntityId(), blitMips); } } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs b/Packages/com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs index 43039450c62..45d840208c2 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Textures/RTHandle.cs @@ -209,9 +209,9 @@ internal void SetTexture(RenderTargetIdentifier tex) public int GetInstanceID() { if (m_RT != null) - return m_RT.GetInstanceID(); + return m_RT.GetEntityId(); else if (m_ExternalTexture != null) - return m_ExternalTexture.GetInstanceID(); + return m_ExternalTexture.GetEntityId(); else return m_NameID.GetHashCode(); // No instance ID so we return the hash code. } diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Textures/Texture2DAtlas.cs b/Packages/com.unity.render-pipelines.core/Runtime/Textures/Texture2DAtlas.cs index 24bdb09ed12..44f12424ae2 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Textures/Texture2DAtlas.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Textures/Texture2DAtlas.cs @@ -490,7 +490,7 @@ public virtual bool AllocateTexture(CommandBuffer cmd, ref Vector4 scaleOffset, /// Allocated scale (.xy) and offset (.zw). /// True on success, false otherwise. public bool AllocateTextureWithoutBlit(Texture texture, int width, int height, ref Vector4 scaleOffset) - => AllocateTextureWithoutBlit(texture.GetInstanceID(), width, height, ref scaleOffset); + => AllocateTextureWithoutBlit(texture.GetEntityId(), width, height, ref scaleOffset); /// /// Allocate space from the atlas for a texture. @@ -537,7 +537,7 @@ private protected int GetTextureHash(Texture textureA, Texture textureB) /// Texture instance ID. public int GetTextureID(Texture texture) { - return texture.GetInstanceID(); + return texture.GetEntityId(); } /// diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs index 134f3bd95b7..e85681ad3e8 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Utilities/CoreUtils.cs @@ -1722,7 +1722,7 @@ public static int GetTextureHash(Texture texture) #if UNITY_EDITOR hash = 23 * hash + texture.imageContentsHash.GetHashCode(); #endif - hash = 23 * hash + texture.GetInstanceID().GetHashCode(); + hash = 23 * hash + texture.GetEntityId().GetHashCode(); hash = 23 * hash + texture.graphicsFormat.GetHashCode(); hash = 23 * hash + texture.wrapMode.GetHashCode(); hash = 23 * hash + texture.width.GetHashCode(); diff --git a/Packages/com.unity.render-pipelines.core/Runtime/Vrs/Vrs.cs b/Packages/com.unity.render-pipelines.core/Runtime/Vrs/Vrs.cs index 56992b91b3c..d49f60326b4 100644 --- a/Packages/com.unity.render-pipelines.core/Runtime/Vrs/Vrs.cs +++ b/Packages/com.unity.render-pipelines.core/Runtime/Vrs/Vrs.cs @@ -182,7 +182,7 @@ public static TextureHandle ColorMaskTextureToShadingRateImage(RenderGraph rende builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((ConversionPassData innerPassData, ComputeGraphContext context) => + builder.SetRenderFunc(static (ConversionPassData innerPassData, ComputeGraphContext context) => { ConversionDispatch(context.cmd, innerPassData); }); @@ -235,7 +235,7 @@ public static void ShadingRateImageToColorMaskTexture(RenderGraph renderGraph, i builder.AllowPassCulling(false); - builder.SetRenderFunc((VisualizationPassData innerPassData, RasterGraphContext context) => + builder.SetRenderFunc(static (VisualizationPassData innerPassData, RasterGraphContext context) => { // must setup blitter source via the material: it's a typed texture (uint) innerPassData.material.SetTexture(VrsShaders.s_ShadingRateImage, innerPassData.source); diff --git a/Packages/com.unity.render-pipelines.core/Tests/Editor/GPUDriven/GPUDrivenRenderingTests.cs b/Packages/com.unity.render-pipelines.core/Tests/Editor/GPUDriven/GPUDrivenRenderingTests.cs index 9e5239b1424..93f5c51d7b3 100644 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/GPUDriven/GPUDrivenRenderingTests.cs +++ b/Packages/com.unity.render-pipelines.core/Tests/Editor/GPUDriven/GPUDrivenRenderingTests.cs @@ -118,7 +118,7 @@ public void TestInstanceCullingBatcherAddRemove() foreach (var obj in objList) { obj.material = dotsMaterial; - objIDs.Add(obj.GetInstanceID()); + objIDs.Add(obj.GetEntityId()); } var instances = new NativeArray(objList.Count, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); @@ -173,7 +173,7 @@ public void TestInstanceCullingTier0() foreach (var obj in objList) { obj.material = simpleDotsMat; - objIDs.Add(obj.GetInstanceID()); + objIDs.Add(obj.GetEntityId()); } var instances = new NativeArray(objList.Count, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); @@ -265,7 +265,7 @@ public void TestSceneViewHiddenRenderersCullingTier0() var objIDs = new NativeArray(1, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); var instances = new NativeArray(1, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); - objIDs[0] = renderer.GetInstanceID(); + objIDs[0] = renderer.GetEntityId(); instances[0] = InstanceHandle.Invalid; var gpuDrivenProcessor = new GPUDrivenProcessor(); @@ -345,7 +345,7 @@ public void TestMultipleMetadata() obj.receiveGI = ReceiveGI.LightProbes; obj.lightProbeUsage = LightProbeUsage.BlendProbes; obj.material = simpleDotsMat; - objIDs.Add(obj.GetInstanceID()); + objIDs.Add(obj.GetEntityId()); } objList[2].lightProbeUsage = LightProbeUsage.Off; @@ -1011,9 +1011,9 @@ public void TestInstanceData() Assert.IsTrue(instanceSystem.InternalSanityCheckStates()); - renderersID[0] = gameObjects[3].GetComponent().GetInstanceID(); - renderersID[1] = gameObjects[4].GetComponent().GetInstanceID(); - renderersID[2] = gameObjects[5].GetComponent().GetInstanceID(); + renderersID[0] = gameObjects[3].GetComponent().GetEntityId(); + renderersID[1] = gameObjects[4].GetComponent().GetEntityId(); + renderersID[2] = gameObjects[5].GetComponent().GetEntityId(); gpuDrivenProcessor.EnableGPUDrivenRenderingAndDispatchRendererData(renderersID, (in GPUDrivenRendererGroupData rendererData, IList meshes, IList materials) => { @@ -1037,7 +1037,7 @@ public void TestInstanceData() renderersID.Dispose(); renderersID = new NativeArray(1, Allocator.TempJob); - renderersID[0] = gameObjects[6].GetComponent().GetInstanceID(); + renderersID[0] = gameObjects[6].GetComponent().GetEntityId(); gpuDrivenProcessor.EnableGPUDrivenRenderingAndDispatchRendererData(renderersID, (in GPUDrivenRendererGroupData rendererData, IList meshes, IList materials) => { @@ -1197,9 +1197,9 @@ public void TestDisallowGPUDrivenRendering() gpuDrivenProcessor.EnableGPUDrivenRenderingAndDispatchRendererData(rendererIDs, (in GPUDrivenRendererGroupData rendererData, IList meshes, IList materials) => { Assert.IsTrue(rendererData.rendererGroupID.Length == 1); - Assert.IsTrue(rendererData.rendererGroupID[0] == renderer1.GetInstanceID()); + Assert.IsTrue(rendererData.rendererGroupID[0] == renderer1.GetEntityId()); Assert.IsTrue(rendererData.invalidRendererGroupID.Length == 1); - Assert.IsTrue(rendererData.invalidRendererGroupID[0] == renderer0.GetInstanceID()); + Assert.IsTrue(rendererData.invalidRendererGroupID[0] == renderer0.GetEntityId()); dispatched = true; }, true); @@ -1370,7 +1370,7 @@ SpeedTreeWindAsset CreateDummySpeedTreeWindAsset(params object[] args) renderer.receiveGI = ReceiveGI.LightProbes; renderer.lightProbeUsage = LightProbeUsage.BlendProbes; renderer.material = simpleSpeedTreeDotsMat; - rendererIDs.Add(renderer.GetInstanceID()); + rendererIDs.Add(renderer.GetEntityId()); } var instances = new NativeArray(renderers.Count, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); diff --git a/Packages/com.unity.render-pipelines.core/Tests/Editor/PathTracing/Unity.PathTracing.Editor.Tests.csproj b/Packages/com.unity.render-pipelines.core/Tests/Editor/PathTracing/Unity.PathTracing.Editor.Tests.csproj deleted file mode 100644 index 8f84f09bd45..00000000000 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/PathTracing/Unity.PathTracing.Editor.Tests.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - false - true - Unity.PathTracing.Editor.Tests - - true - - - Editor - - - - - - - - - - - - \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Tests/Editor/PathTracing/Unity.PathTracing.Editor.Tests.csproj.meta b/Packages/com.unity.render-pipelines.core/Tests/Editor/PathTracing/Unity.PathTracing.Editor.Tests.csproj.meta deleted file mode 100644 index b87b9c43196..00000000000 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/PathTracing/Unity.PathTracing.Editor.Tests.csproj.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ee9095c25e614d59bcb015b49fdba96d -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.core/Tests/Editor/RenderPipeline/RenderPipelineGlobalSettingsUtilsTests.cs b/Packages/com.unity.render-pipelines.core/Tests/Editor/RenderPipeline/RenderPipelineGlobalSettingsUtilsTests.cs index 471c44991d5..a744e20f2dd 100644 --- a/Packages/com.unity.render-pipelines.core/Tests/Editor/RenderPipeline/RenderPipelineGlobalSettingsUtilsTests.cs +++ b/Packages/com.unity.render-pipelines.core/Tests/Editor/RenderPipeline/RenderPipelineGlobalSettingsUtilsTests.cs @@ -74,7 +74,7 @@ public void Ensure(string path, bool canCreateNewAsset, AssetState assetState, s else { var instanceInGraphics = GraphicsSettings.GetSettingsForRenderPipeline(); - Assert.AreEqual(instanceInGraphics.GetInstanceID(), instanceEnsured.GetInstanceID()); + Assert.AreEqual(instanceInGraphics.GetEntityId(), instanceEnsured.GetEntityId()); Assert.IsTrue(expectedPath.Equals(AssetDatabase.GetAssetPath(instanceEnsured), StringComparison.InvariantCultureIgnoreCase)); } } @@ -87,13 +87,13 @@ public void EnsureWithAValidInstanceReturnsTheCurrentInstance() Assert.IsNotNull(instanceEnsured); Assert.IsTrue(path.Equals(AssetDatabase.GetAssetPath(instanceEnsured), StringComparison.InvariantCultureIgnoreCase)); - var instanceIDExpected = instanceEnsured.GetInstanceID(); + var instanceIDExpected = instanceEnsured.GetEntityId(); var ensureResult = RenderPipelineGlobalSettingsUtils. TryEnsure(ref instanceEnsured, DummyRenderPipelineGlobalSettings.defaultPath, true, out _); Assert.IsTrue(ensureResult); Assert.IsNotNull(instanceEnsured); - Assert.AreEqual(instanceIDExpected, instanceEnsured.GetInstanceID()); + Assert.AreEqual(instanceIDExpected, instanceEnsured.GetEntityId()); } } } diff --git a/Packages/com.unity.render-pipelines.core/Tests/Runtime/PathTracing/Unity.PathTracing.Runtime.Tests.csproj b/Packages/com.unity.render-pipelines.core/Tests/Runtime/PathTracing/Unity.PathTracing.Runtime.Tests.csproj deleted file mode 100644 index 8d9d2490408..00000000000 --- a/Packages/com.unity.render-pipelines.core/Tests/Runtime/PathTracing/Unity.PathTracing.Runtime.Tests.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - false - true - Unity.PathTracing.Runtime.Tests - - true - - - - - - - - - - - - \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.core/Tests/Runtime/PathTracing/Unity.PathTracing.Runtime.Tests.csproj.meta b/Packages/com.unity.render-pipelines.core/Tests/Runtime/PathTracing/Unity.PathTracing.Runtime.Tests.csproj.meta deleted file mode 100644 index d9d5f420eb6..00000000000 --- a/Packages/com.unity.render-pipelines.core/Tests/Runtime/PathTracing/Unity.PathTracing.Runtime.Tests.csproj.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: c3616d38e7c2446fad048d0f1b116a51 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Material-Type.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Material-Type.md index 5d64aec6bc8..78ee84189bb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/Material-Type.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/Material-Type.md @@ -8,7 +8,7 @@ The **Material Type** property allows you to give your Material a type, which al | **Standard** | Applies the basic metallic Shader workflow to the Material. This is the default **Material Type**. | | **Anisotropy** | Applies the anisotropic workflow to the Material. The highlights of Anisotropic surfaces change in appearance as you view the Material from different angles. Use this **Material Type** to create Materials with anisotropic highlights. For example, brushed metal or velvet. | | **Iridescence** | Applies the Iridescence workflow to the Material. Iridescent surfaces appear to gradually change color as the angle of view or angle of illumination changes. Use this **Material Type** to create Materials like soap bubbles, iridescent metal, or insect wings. | -| **Specular Color** | Applies the Specular Color workflow to the Material. Use this **Material Type** to create Materials with a coloured specular highlight. This is similar to the [built-in Specular Shader](https://docs.unity3d.com/Manual/StandardShaderMaterialParameterSpecular.html). | +| **Specular Color** | Applies the Specular Color workflow to the Material. Use this **Material Type** to create Materials with a coloured specular highlight. For more information, refer to [Metallic and specular workflows](https://docs.unity3d.com/Documentation/Manual/StandardShaderMetallicVsSpecular.html). | | **Translucent** | Applies the Translucent workflow to the Material. Use this **Material Type**, and a thickness map, to simulate a translucent object, such as a plant leaf. In contrast to **Subsurface Scattering** Materials, **Translucent** Materials do not blur light that transmits through the Material. | ![A detailed dragon statuette, rendered three times. The first dragon is iridescent, the second is a translucent green material, and the third has subsurface scattering.](Images/MaterialType1.png) diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-create-gameobject.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-create-gameobject.md index ae94a5da675..472f418a2fd 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-create-gameobject.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-create-gameobject.md @@ -19,6 +19,11 @@ To use a full-screen Custom Pass, you need to create a material for your Custom - [Create a Material from a full-screen shader graph](#material-from-fullscreen-shadergraph). - [Create a Material from a full-screen Custom Pass shader](#material-from-fullscreen-custompass). +You can also create the material and its shader directly from the **FullScreen Material** property in the [Custom Pass Volume](custom-pass-reference.md) Inspector by using the **New** dropdown with the following options: + +- **ShaderGraph**: Creates a new material or material variant from a new shader graph asset based on the **Fullscreen Basic HDRP** shader graph template. This is ideal for building fullscreen effects visually without writing shader code. +- **Handwritten Shader**: Creates a new handwritten shader using the HDRP fullscreen Custom Pass template. This is ideal if you prefer writing HLSL code for maximum control. + ### Create a Material from a full-screen Shader graph diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-reference.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-reference.md index 655306dcae3..27c7e2f555f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-reference.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/custom-pass-reference.md @@ -21,7 +21,7 @@ Configure a full-screen Custom Pass in the **Custom Passes** panel using the fol | Target Depth Buffer | Select the buffer where Unity writes and tests the depth and stencil data.
This buffer does not contain transparent objects that have **Depth Write** enabled in the [shader properties](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/Lit-Shader.html).

When the Target Color Buffer and The Target Buffer are both set to **None** Unity does not execute a Custom Pass because there is no buffer to render to. | | Clear Flags | A clear flag discards the contents of a buffer before Unity executes this Custom Pass.
This property assigns a clear flag to one of the following buffers:
**None:** Doesn’t clear any buffers in this pass.
**Color:** Clears the depth buffer.
**Depth:** Clears the depth buffer and the stencil buffer.
**All:** Clears the data in the color, depth, and stencil buffers. | | Fetch Color Buffer | Enable this checkbox to allow this Custom Pass to read data from the color buffer.
This applies even when you enable [Multisampling anti-aliasing (MSAA)](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/MSAA.html).

When you enable**Fetch Color Buffer** and MSAA, it forces the color buffer to resolve, and the Custom Pass uses one of the following injection points:
Before PreRefraction
Before Transparent
After Opaque Depth And Normal

A Custom Pass can’t read and write to the same render target. This means that you can’t enable **Fetch Color Buffer** and use **Target Color Buffer** at the same time. | -| FullScreen Material | The material this Custom Pass renders in your scene. | +| FullScreen Material | The material this Custom Pass renders in your scene. Use the **New** dropdown to create a new material and its associated shader from a template. The options are the following:
  • **ShaderGraph**: Creates a new material or material variant from a new shader graph asset based on the **Fullscreen Basic HDRP** shader graph template, which uses the default [**HDRP Fullscreen** material type](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/fullscreen-master-stack-reference.html).
    **Note**: To define if Unity creates a material or a material variant from the shader graph asset, refer to the **Graph Template Workflow** option in the [Shader Graph Preferences](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Shader-Graph-Preferences.html).
  • **Handwritten Shader**: Creates a new handwritten shader using the HDRP fullscreen Custom Pass template.
| | Pass Name | Select the shader [Pass name](https://docs.unity3d.com/Manual/SL-Pass.html) that Unity uses to draw the full-screen quad. | ## Draw renderers Custom Pass properties diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/decal-projector-reference.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/decal-projector-reference.md index b2ae3dc79f0..a2118fd228b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/decal-projector-reference.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/decal-projector-reference.md @@ -34,7 +34,7 @@ Using the Inspector allows you to change all of the Decal Projector properties, | **Size** | The size of the projector influence box, and thus the decal along the projected plane. The projector scales the decal to match the **Width** (along the local x-axis) and **Height** (along the local y-axis) components of the **Size**. | | **Projection Depth** | The depth of the projector influence box. The projector scales the decal to match **Projection Depth**. The Decal Projector component projects decals along the local z-axis. | | **Pivot** | The offset position of the transform regarding the projection box. To rotate the projected texture around a specific position, adjust the **X** and **Y** values. To set a depth offset for the projected texture, adjust the **Z** value. | -| **Material** | The decal Material to project. The decal Material must use a HDRP/Decal Shader. | +| **Material** | The decal Material to project. The decal Material must use a HDRP/Decal Shader. Use the **New** dropdown to create a new material and its associated shader from a template. The options are the following:
  • **HDRP Decal**: Creates a new decal Material that uses the default HDRP Decal Shader. This provides a ready‑to‑use decal shader set up for HDRP’s decal system.
  • **ShaderGraph Decal**: Creates a new material or material variant from a new shader graph asset based on the **Decal Simple** shader graph template, which uses the default [**HDRP Decal** material type](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/decal-master-stack-reference.html). This is recommended for building decals visually without writing shader code.
    **Note**: To define if Unity creates a material or a material variant from the shader graph asset, refer to the **Graph Template Workflow** option in the [Shader Graph Preferences](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Shader-Graph-Preferences.html).
| | **Decal Layer** | The layer that specifies the Materials to project the decal onto. Any Mesh Renderers or Terrain that uses a matching Decal Layer receives the decal. | | **Draw Distance** | The distance from the Camera to the Decal at which this projector stops projecting the decal and HDRP no longer renders the decal. | | **Start Fade** | Use the slider to set the distance from the Camera at which the projector begins to fade out the decal. Scales from 0 to 1 and represents a percentage of the **Draw Distance**. A value of 0.9 begins fading the decal out at 90% of the **Draw Distance** and finished fading it out at the **Draw Distance**. | diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/gpu-resident-drawer.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/gpu-resident-drawer.md index 036c132a6e3..db7952697fb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/gpu-resident-drawer.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/gpu-resident-drawer.md @@ -31,7 +31,7 @@ To analyze the results of the GPU Resident Drawer, you can use the following: - [Frame Debugger](https://docs.unity3d.com/Manual/FrameDebugger.html). If the GPU Resident Drawer groups GameObjects, the Frame Debugger displays draw calls called **Hybrid Batch Group**. - [Rendering Debugger](rendering-debugger-window-reference.md) -- [Rendering Statistics](https://docs.unity3d.com/Manual/RenderingStatistics.html) to check if the number of frames per second has increased, and the CPU processing time and SetPass calls have decreased. +- [Rendering Statistics](https://docs.unity3d.com/Manual/RenderingStatistics.html) to check if the number of frames per second has increased, and the CPU processing time and Set Pass calls have decreased. - [Unity Profiler](https://docs.unity3d.com/Manual/Profiler.html) ## Optimize the GPU Resident Drawer diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/shadows-visualize-and-adjust.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/shadows-visualize-and-adjust.md index 89986a1f7fe..347a8f9d0e6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/shadows-visualize-and-adjust.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/shadows-visualize-and-adjust.md @@ -1,4 +1,4 @@ -## Visualize and adjust shadows +# Visualize and adjust shadows You can use the Shadows override to visualize the cascade sizes in the Inspector, and the boundaries of the cascades as they appear inside your Scene in real time. @@ -9,7 +9,8 @@ In the Inspector, use the **Cascade Splits** bar to see the size of each cascade In the Scene view and the Game view, the cascade visualization feature allows you to see the boundaries of each cascade in your Scene. Each color represents a separate cascade, and the colors match those in the **Cascade Splits** bar. This allows you to see which colored area matches which cascade. -![Cascade visualization example.](/Images/Override-Shadows3.png) +![A visualization of shadow cascades in the default Unity sample scene. Each shadow cascade displays as a concentric coloured circle.](Images/Override-Shadows3.png)
+A visualization of shadow cascades in the default Unity sample scene. Each shadow cascade displays as a concentric coloured circle. To enable the cascade visualization feature, select **Show Cascades** at the top of the list of **Shadows** properties. You can now see the shadow maps in the Scene view and the Game view. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md index bbc2a172f35..b6f657ea342 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md @@ -2,5 +2,5 @@ Base Color Parametrization N/A N/A -Specifies the method to set color and reflectance properties of the material. The options are:
Base Metallic: Applies the basic metallic Shader workflow to the material. In the StackLit shader, when Metallic is 0, Dielectric Ior determines the specular color of the base layer.
Specular Color: Applies the Specular Color workflow to the material. Use this to create Materials with a coloured specular highlight. This is similar to the built-in Specular Shader. +Specifies the method to set color and reflectance properties of the material. The options are:
Base Metallic: Applies the basic metallic Shader workflow to the material. In the StackLit shader, when Metallic is 0, Dielectric Ior determines the specular color of the base layer.
Specular Color: Applies the Specular Color workflow to the material. Use this to create Materials with a coloured specular highlight. For more information, refer to Metallic and specular workflows. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/material-type.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/material-type.md index 81f9c1eb1d0..25d0c2b2fc0 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/material-type.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/material-type.md @@ -2,5 +2,5 @@ Material Type N/A N/A -Specifies a type for the material. This allows you to customize the material with different settings depending on the type you select. The options are:
• Subsurface Scattering: Applies the subsurface scattering workflow to the material. Subsurface scattering simulates the way light interacts with and penetrates translucent objects, such as skin or plant leaves. When light penetrates the surface of a subsurface scattering material, it scatters and blurs before exiting the surface at a different point.
• Standard: Applies the basic metallic Shader workflow to the material. This is the default Material Type.
• Anisotropy: Applies the anisotropic workflow to the material. The highlights of Anisotropic surfaces change in appearance as you view the material from different angles. Use this Material Type to create materials with anisotropic highlights. For example, brushed metal or velvet.
• Iridescence: Applies the Iridescence workflow to the material. Iridescent surfaces appear to gradually change color as the angle of view or angle of illumination changes. Use this Material Type to create materials like soap bubbles, iridescent metal, or insect wings.
• Specular Color: Applies the Specular Color workflow to the material. Use this Material Type to create Materials with a coloured specular highlight. This is similar to the built-in Specular Shader.
• Translucent: Applies the Translucent workflow to the material. Use this Material Type, and a thickness map, to simulate a translucent material. In contrast to Subsurface Scattering materials, Translucent materials do not blur light that transmits through the material.
For more information about the feature and for the list of properties each Material Type exposes, see the Material Type documentation. +Specifies a type for the material. This allows you to customize the material with different settings depending on the type you select. The options are:
• Subsurface Scattering: Applies the subsurface scattering workflow to the material. Subsurface scattering simulates the way light interacts with and penetrates translucent objects, such as skin or plant leaves. When light penetrates the surface of a subsurface scattering material, it scatters and blurs before exiting the surface at a different point.
• Standard: Applies the basic metallic Shader workflow to the material. This is the default Material Type.
• Anisotropy: Applies the anisotropic workflow to the material. The highlights of Anisotropic surfaces change in appearance as you view the material from different angles. Use this Material Type to create materials with anisotropic highlights. For example, brushed metal or velvet.
• Iridescence: Applies the Iridescence workflow to the material. Iridescent surfaces appear to gradually change color as the angle of view or angle of illumination changes. Use this Material Type to create materials like soap bubbles, iridescent metal, or insect wings.
• Specular Color: Applies the Specular Color workflow to the material. Use this Material Type to create Materials with a coloured specular highlight. For more information, refer to Metallic and specular workflows.
• Translucent: Applies the Translucent workflow to the material. Use this Material Type, and a thickness map, to simulate a translucent material. In contrast to Subsurface Scattering materials, Translucent materials do not blur light that transmits through the material.
For more information about the feature and for the list of properties each Material Type exposes, see the Material Type documentation. diff --git a/Packages/com.unity.render-pipelines.high-definition/Documentation~/use-decals.md b/Packages/com.unity.render-pipelines.high-definition/Documentation~/use-decals.md index 26d9f17088a..4097f3c7781 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Documentation~/use-decals.md +++ b/Packages/com.unity.render-pipelines.high-definition/Documentation~/use-decals.md @@ -8,6 +8,10 @@ The High Definition Render Pipeline (HDRP) includes the following ways to create To use these methods, you need to create a decal Material. A decal Material is a Material that uses the [Decal Shader](Decal-Shader.md) or [Decal Master Stack](master-stack-decal.md). You can then place or project your decal Material into a Scene. +You can also create the decal Material and its shader directly from the **Material** field in the [Decal Projector](decal-projector-reference.md) Inspector by using the **New** dropdown with the following options: +- **HDRP Decal**: Creates a new decal Material that uses the default HDRP Decal Shader. +- **ShaderGraph Decal**: Creates a new material or material variant from a new shader graph asset based on the **Decal Simple** shader graph template, which uses the default [**HDRP Decal** material type](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest/index.html?subfolder=/manual/decal-master-stack-reference.html). This is ideal for building custom decals visually without writing shader code. + ![Decal shader.](Images/HDRPFeatures-DecalShader.png) ## Decal Layers diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPBuildData.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPBuildData.cs index efd8bfbdcec..e316d3ca59a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPBuildData.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/HDRPBuildData.cs @@ -19,7 +19,7 @@ internal class HDRPBuildData : IDisposable public bool waterDecalMaskAndCurrent { get; private set; } public Dictionary rayTracingComputeShaderCache { get; private set; } = new(); public Dictionary computeShaderCache { get; private set; } = new(); - + public HDRenderPipelineRuntimeShaders runtimeShaders { get; private set; } public HDRenderPipelineRuntimeMaterials materialResources { get; private set; } @@ -51,11 +51,11 @@ public HDRPBuildData(BuildTarget buildTarget, bool isDevelopmentBuild) if (hdrpGlobalSettingsInstance != null) { GraphicsSettings.GetRenderPipelineSettings() - .ForEachFieldOfType(computeShader => rayTracingComputeShaderCache.Add(computeShader.GetInstanceID(), computeShader)); + .ForEachFieldOfType(computeShader => rayTracingComputeShaderCache.Add(computeShader.GetEntityId(), computeShader)); runtimeShaders = GraphicsSettings.GetRenderPipelineSettings(); - runtimeShaders?.ForEachFieldOfType(computeShader => computeShaderCache.Add(computeShader.GetInstanceID(), computeShader)); - + runtimeShaders?.ForEachFieldOfType(computeShader => computeShaderCache.Add(computeShader.GetEntityId(), computeShader)); + materialResources = GraphicsSettings.GetRenderPipelineSettings(); stripDebugVariants = !isDevelopmentBuild || GraphicsSettings.GetRenderPipelineSettings().stripRuntimeDebugShaders; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPComputeShaderVariantStripper.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPComputeShaderVariantStripper.cs index c07916db393..a9ffa22b499 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPComputeShaderVariantStripper.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPComputeShaderVariantStripper.cs @@ -194,7 +194,7 @@ public bool CanRemoveVariant([DisallowNull] ComputeShader shader, string shaderV public bool SkipShader([DisallowNull] ComputeShader shader, string shaderVariant) { // Discard any compute shader use for raytracing if none of the RP asset required it - if (!HDRPBuildData.instance.playerNeedRaytracing && HDRPBuildData.instance.rayTracingComputeShaderCache.ContainsKey(shader.GetInstanceID())) + if (!HDRPBuildData.instance.playerNeedRaytracing && HDRPBuildData.instance.rayTracingComputeShaderCache.ContainsKey(shader.GetEntityId())) return true; return false; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPDisabledComputeShaderVariantStripper.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPDisabledComputeShaderVariantStripper.cs index 5ac35a65040..26e0dda18e5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPDisabledComputeShaderVariantStripper.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/BuildProcessors/ShaderStrippers/HDRPDisabledComputeShaderVariantStripper.cs @@ -9,7 +9,7 @@ class HDRPDisabledComputeShaderVariantStripper : IComputeShaderVariantStripper public bool CanRemoveVariant([DisallowNull] ComputeShader shader, string _, ShaderCompilerData __) { - var shaderInstanceID = shader.GetInstanceID(); + var shaderInstanceID = shader.GetEntityId(); if (HDRPBuildData.instance.computeShaderCache.ContainsKey(shaderInstanceID)) return true; diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightEditor.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightEditor.cs index 5e1f6f62032..517a2e41035 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightEditor.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightEditor.cs @@ -66,6 +66,9 @@ void OnUndoRedo() foreach (var hdLightData in m_AdditionalLightDatas) if (hdLightData != null) { + if (hdLightData.lightIdxForCachedShadows >= 0) // If it is within the cached system we need to evict it. + HDShadowManager.cachedShadowManager.EvictLight(hdLightData, hdLightData.legacyLight.type); + hdLightData.UpdateAreaLightEmissiveMesh(); hdLightData.UpdateRenderEntity(); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs index 73a9ebcdd88..2bcdd91b723 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDBakedReflectionSystem.cs @@ -437,7 +437,7 @@ public static bool BakeProbes(IEnumerable bakedProbes) } activeProbes.Add(probe); - probeInstanceIDs.Add(probe.GetInstanceID()); + probeInstanceIDs.Add(probe.GetEntityId()); } // APV Normalization (Execute baking) @@ -816,7 +816,7 @@ static void ComputeProbeInstanceID(IEnumerable probes, HDProbeBakingSta var i = 0; foreach (var probe in probes) { - states[i].entityId = probe.GetInstanceID(); + states[i].entityId = probe.GetEntityId(); ++i; } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.Handlers.cs b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.Handlers.cs index 7e5e8541abf..20e933aad82 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.Handlers.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Camera/HDCameraEditor.Handlers.cs @@ -16,7 +16,7 @@ void OnSceneGUI() if (!CameraEditorUtils.IsViewPortRectValidToRender(c.rect)) return; - UnityEditor.CameraEditorUtils.HandleFrustum(c, c.GetInstanceID()); - } + UnityEditor.CameraEditorUtils.HandleFrustum(c, c.GetEntityId()); + } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositorCameraRegistry.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositorCameraRegistry.cs index e2ca2a3ac8e..4a78f576ac4 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositorCameraRegistry.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Compositor/CompositorCameraRegistry.cs @@ -74,7 +74,7 @@ internal void PrinCameraIDs() { for (int i = s_CompositorManagedCameras.Count - 1; i >= 0; i--) { - var id = s_CompositorManagedCameras[i] ? s_CompositorManagedCameras[i].GetInstanceID() : 0; + var id = s_CompositorManagedCameras[i] ? s_CompositorManagedCameras[i].GetEntityId() : EntityId.None; } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/Texture2DAtlasDynamic.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/Texture2DAtlasDynamic.cs index bd36843ede1..eddaba6481d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/Texture2DAtlasDynamic.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/Texture2DAtlasDynamic.cs @@ -442,7 +442,7 @@ public void ResetAllocator() /// Returns True if Unity successfully adds the texture. public bool AddTexture(CommandBuffer cmd, out Vector4 scaleOffset, Texture texture) { - int key = texture.GetInstanceID(); + int key = texture.GetEntityId(); if (!m_AllocationCache.TryGetValue(key, out scaleOffset)) { int width = texture.width; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache.cs index f6ca9b8e014..628aea3cdd9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Core/Textures/TextureCache.cs @@ -17,13 +17,13 @@ abstract class TextureCache // Counter of input texture that have been fed to this structure private int m_NumTextures; // Array that maps input textureIDs into the slices indexes - Dictionary m_LocatorInSliceDictionnary; + Dictionary m_LocatorInSliceDictionnary; // This structure defines the mapping between an input texture and the internal structure private struct SliceEntry { // ID of the internal structure - public uint texId; + public EntityId texId; // This counter tracks the number of frames since this slice was requested. The mechanic behind this is due to the fact that the number storage of the cache is limited public uint countLRU; // Hash that tracks the version of the input texture (allows us to know if it needs an update) @@ -40,7 +40,6 @@ private struct SliceEntry // Constant values private static uint g_MaxFrameCount = unchecked((uint)(-1)); - private static uint g_InvalidTexID = (uint)0; protected const int k_FP16SizeInByte = 2; protected const int k_NbChannel = 4; @@ -77,13 +76,13 @@ protected bool AllocTextureArray(int numTextures) { m_SliceArray = new SliceEntry[numTextures]; m_SortedIdxArray = new int[numTextures]; - m_LocatorInSliceDictionnary = new Dictionary(); + m_LocatorInSliceDictionnary = new Dictionary(); m_NumTextures = numTextures / m_SliceSize; for (int i = 0; i < m_NumTextures; i++) { m_SliceArray[i].countLRU = g_MaxFrameCount; // never used before - m_SliceArray[i].texId = g_InvalidTexID; + m_SliceArray[i].texId = EntityId.None; m_SortedIdxArray[i] = i; } } @@ -102,8 +101,8 @@ public int ReserveSlice(Texture texture, uint textureHash, out bool needUpdate) // Check the validity of the input texture if (texture == null) return -1; - var texId = (uint)texture.GetInstanceID(); - if (texId == g_InvalidTexID) + var texId = texture.GetEntityId(); + if (texId == EntityId.None) return -1; // Search for existing copy in the texId to slice index dictionary @@ -134,7 +133,7 @@ public int ReserveSlice(Texture texture, uint textureHash, out bool needUpdate) { needUpdate = true; // if we are replacing an existing entry delete it from m_locatorInSliceArray. - if (m_SliceArray[idx].texId != g_InvalidTexID) + if (m_SliceArray[idx].texId != EntityId.None) { m_LocatorInSliceDictionnary.Remove(m_SliceArray[idx].texId); } @@ -246,10 +245,10 @@ public void NewFrame() // should not really be used in general. Assuming lights are culled properly entries will automatically be replaced efficiently. public void RemoveEntryFromSlice(Texture texture) { - var texId = (uint)texture.GetInstanceID(); + var texId = texture.GetEntityId(); //assert(TexID!=g_InvalidTexID); - if (texId == g_InvalidTexID) return; + if (texId == EntityId.None) return; // search for existing copy if (!m_LocatorInSliceDictionnary.ContainsKey(texId)) @@ -281,7 +280,7 @@ public void RemoveEntryFromSlice(Texture texture) // delete from m_locatorInSliceArray and m_pSliceArray. m_LocatorInSliceDictionnary.Remove(texId); m_SliceArray[sliceIndex].countLRU = g_MaxFrameCount; // never used before - m_SliceArray[sliceIndex].texId = g_InvalidTexID; + m_SliceArray[sliceIndex].texId = EntityId.None; } protected int GetNumMips(int width, int height) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs index 5ea69f4da34..7ded743ff74 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.cs @@ -2125,6 +2125,11 @@ void UnregisterRenderingDebug() internal void RegisterDebug() { +#if UNITY_EDITOR + if (UnityEditor.BuildPipeline.isBuildingPlayer) + return; +#endif + RegisterMaterialDebug(); RegisterLightingDebug(); RegisterRenderingDebug(); @@ -2142,6 +2147,9 @@ internal void UnregisterDebug() void UnregisterDebugItems(string panelName, DebugUI.Widget[] items) { + if (items == null || items.Length == 0) + return; + var panel = DebugManager.instance.GetPanel(panelName); if (panel != null) panel.children.Remove(items); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs index cebedfebd48..f101d41e210 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugLightVolumes.cs @@ -100,7 +100,7 @@ public void RenderLightVolumes(RenderGraph renderGraph, LightingDebugSettings li builder.UseTexture(passData.destination, AccessFlags.Write); builder.SetRenderFunc( - (RenderLightVolumesPassData data, UnsafeGraphContext ctx) => + static (RenderLightVolumesPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); @@ -111,7 +111,7 @@ public void RenderLightVolumes(RenderGraph renderGraph, LightingDebugSettings li if (data.lightOverlapEnabled) { // We only need the accumulation buffer, not the color (we only display the outline of the light shape in this mode). - CoreUtils.SetRenderTarget(natCmd, mrt[0], depthBuffer); + CoreUtils.SetRenderTarget(natCmd, mrt[0], data.depthBuffer); // The cull result doesn't contains overlapping lights so we use a custom list foreach (var overlappingHDLight in HDAdditionalLightData.s_overlappingHDLights) @@ -122,7 +122,7 @@ public void RenderLightVolumes(RenderGraph renderGraph, LightingDebugSettings li else { // Set the render target array - CoreUtils.SetRenderTarget(natCmd, mrt, depthBuffer); + CoreUtils.SetRenderTarget(natCmd, mrt, data.depthBuffer); // First of all let's do the regions for the light sources (we only support Punctual and Area) int numLights = data.cullResults.visibleLights.Length; @@ -190,7 +190,7 @@ public void RenderLightVolumes(RenderGraph renderGraph, LightingDebugSettings li natCmd.DispatchCompute(data.debugLightVolumeCS, data.debugLightVolumeKernel, numTilesX, numTilesY, data.hdCamera.viewCount); // Blit this into the camera target - CoreUtils.SetRenderTarget(natCmd, destination); + CoreUtils.SetRenderTarget(natCmd, data.destination); mpb.SetTexture(HDShaderIDs._BlitTexture, data.debugLightVolumesTexture); natCmd.DrawProcedural(Matrix4x4.identity, data.debugLightVolumeMaterial, 1, MeshTopology.Triangles, 3, 1, mpb); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs index 8dbe3cb690f..7117e788231 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/NVIDIADebugView.cs @@ -31,18 +31,12 @@ private enum DeviceState private GraphicsDeviceDebugView m_DebugView = null; - private class Container where T : struct - { - public T data = new T(); - } - private class Data { public DeviceState deviceState = DeviceState.Unknown; public bool dlssSupported = false; - public Container[] dlssFeatureInfos = null; + public DLSSDebugFeatureInfos[] dlssFeatureInfos = null; } - private Data m_Data = new Data(); private void InternalReset() @@ -92,39 +86,20 @@ private void InternalUpdate() bool isPluginLoaded = NVUnityPlugin.IsLoaded(); m_Data.deviceState = isPluginLoaded ? DeviceState.DeviceCreationFailed : DeviceState.MissingPluginDLL; m_Data.dlssSupported = false; - ClearFeatureStateContainer(m_Data.dlssFeatureInfos); } UpdateDebugUITable(); } - private static void ClearFeatureStateContainer(Container[] containerArray) - { - for (int i = 0; i < containerArray.Length; ++i) - { - containerArray[i].data = new DLSSDebugFeatureInfos(); - } - } - - private static void TranslateDlssFeatureArray(Container[] containerArray, in GraphicsDeviceDebugView debugView) + private static void TranslateDlssFeatureArray(DLSSDebugFeatureInfos[] featureArray, in GraphicsDeviceDebugView debugView) { - ClearFeatureStateContainer(containerArray); - if (!debugView.dlssFeatureInfos.Any()) - return; - - //copy data over - int i = 0; - foreach (var featureInfo in debugView.dlssFeatureInfos) - { - if (i == containerArray.Length) - break; - containerArray[i++].data = featureInfo; - } + new Span(featureArray).Clear(); // Clear the local array first. + debugView.dlssFeatureInfosSpan.CopyTo(featureArray); // Directly copy the data from the source span to the destination array. } -#endregion + #endregion -#region Debug User Interface + #region Debug User Interface private const int MaxDebugRows = 4; private DebugUI.Container m_DebugWidget = null; @@ -161,7 +136,7 @@ private DebugUI.Widget InternalCreateWidget() m_DlssViewStateTable = new DebugUI.Table() { - displayName = "DLSS Slot ID", + displayName = "Feature Slot ID", isReadOnly = true }; @@ -199,7 +174,7 @@ private DebugUI.Widget InternalCreateWidget() } }; - m_Data.dlssFeatureInfos = new Container[MaxDebugRows]; + m_Data.dlssFeatureInfos = new DLSSDebugFeatureInfos[MaxDebugRows]; m_DlssViewStateTableRows = new DebugUI.Table.Row[m_Data.dlssFeatureInfos.Length]; String resToString(uint a, uint b) @@ -209,22 +184,17 @@ String resToString(uint a, uint b) for (int r = 0; r < m_Data.dlssFeatureInfos.Length; ++r) { - var c = new Container() - { - data = new DLSSDebugFeatureInfos() - }; - m_Data.dlssFeatureInfos[r] = c; - - string GetPresetLabel(DLSSQuality quality) + int currentIndex = r; + string GetPresetLabel(DLSSQuality quality, int index) { DLSSPreset presetValue = DLSSPreset.Preset_Default; switch (quality) { - case DLSSQuality.DLAA: presetValue = c.data.initData.presetDlaaMode; break; - case DLSSQuality.Balanced: presetValue = c.data.initData.presetBalancedMode; break; - case DLSSQuality.MaximumQuality: presetValue = c.data.initData.presetQualityMode; break; - case DLSSQuality.UltraPerformance: presetValue = c.data.initData.presetUltraPerformanceMode; break; - case DLSSQuality.MaximumPerformance: presetValue = c.data.initData.presetPerformanceMode; break; + case DLSSQuality.DLAA: presetValue = m_Data.dlssFeatureInfos[index].initData.presetDlaaMode; break; + case DLSSQuality.Balanced: presetValue = m_Data.dlssFeatureInfos[index].initData.presetBalancedMode; break; + case DLSSQuality.MaximumQuality: presetValue = m_Data.dlssFeatureInfos[index].initData.presetQualityMode; break; + case DLSSQuality.UltraPerformance: presetValue = m_Data.dlssFeatureInfos[index].initData.presetUltraPerformanceMode; break; + case DLSSQuality.MaximumPerformance: presetValue = m_Data.dlssFeatureInfos[index].initData.presetPerformanceMode; break; } string presetLabel = presetValue.ToString(); int delimiterIndex = presetLabel.IndexOf(" - "); // trim explanation from explanation separator token @@ -239,28 +209,28 @@ string GetPresetLabel(DLSSQuality quality) { new DebugUI.Value() { - getter = () => c.data.validFeature ? "Valid" : "-" + getter = () => m_Data.dlssFeatureInfos[currentIndex].validFeature ? "Valid" : "-" }, new DebugUI.Value() { - getter = () => c.data.validFeature ? resToString(c.data.execData.subrectWidth, c.data.execData.subrectHeight) : "-" + getter = () => m_Data.dlssFeatureInfos[currentIndex].validFeature ? resToString(m_Data.dlssFeatureInfos[currentIndex].execData.subrectWidth, m_Data.dlssFeatureInfos[currentIndex].execData.subrectHeight) : "-" }, new DebugUI.Value() { - getter = () => c.data.validFeature ? resToString(c.data.initData.outputRTWidth, c.data.initData.outputRTHeight) : "-" + getter = () => m_Data.dlssFeatureInfos[currentIndex].validFeature ? resToString(m_Data.dlssFeatureInfos[currentIndex].initData.outputRTWidth, m_Data.dlssFeatureInfos[currentIndex].initData.outputRTHeight) : "-" }, new DebugUI.Value() { - getter = () => c.data.validFeature ? c.data.initData.quality.ToString() : "-" + getter = () => m_Data.dlssFeatureInfos[currentIndex].validFeature ? m_Data.dlssFeatureInfos[currentIndex].initData.quality.ToString() : "-" }, new DebugUI.Value() { - getter = () => c.data.validFeature ? GetPresetLabel(c.data.initData.quality) : "-" + getter = () => m_Data.dlssFeatureInfos[currentIndex].validFeature ? GetPresetLabel(m_Data.dlssFeatureInfos[currentIndex].initData.quality, currentIndex) : "-" } } }; - dlssStateRow.isHiddenCallback = () => !c.data.validFeature; - m_DlssViewStateTableRows[r] = dlssStateRow; + dlssStateRow.isHiddenCallback = () => !m_Data.dlssFeatureInfos[currentIndex].validFeature; + m_DlssViewStateTableRows[currentIndex] = dlssStateRow; } m_DlssViewStateTable.children.Add(m_DlssViewStateTableRows); m_DlssViewStateTable.isHiddenCallback = () => @@ -281,8 +251,32 @@ private void UpdateDebugUITable() { for (int r = 0; r < m_DlssViewStateTableRows.Length; ++r) { - var d = m_Data.dlssFeatureInfos[r].data; - m_DlssViewStateTableRows[r].displayName = d.validFeature ? Convert.ToString(d.featureSlot) : ""; + var d = m_Data.dlssFeatureInfos[r]; + m_DlssViewStateTableRows[r].displayName = ""; + if(d.validFeature) + { + // we know we dont support more than 16 features at one time on the plugin side. + // here's an allocation-free way to setup display name string values. + switch (d.featureSlot) + { + case 0: m_DlssViewStateTableRows[r].displayName = "0"; break; + case 1: m_DlssViewStateTableRows[r].displayName = "1"; break; + case 2: m_DlssViewStateTableRows[r].displayName = "2"; break; + case 3: m_DlssViewStateTableRows[r].displayName = "3"; break; + case 4: m_DlssViewStateTableRows[r].displayName = "4"; break; + case 5: m_DlssViewStateTableRows[r].displayName = "5"; break; + case 6: m_DlssViewStateTableRows[r].displayName = "6"; break; + case 7: m_DlssViewStateTableRows[r].displayName = "7"; break; + case 8: m_DlssViewStateTableRows[r].displayName = "8"; break; + case 9: m_DlssViewStateTableRows[r].displayName = "9"; break; + case 10: m_DlssViewStateTableRows[r].displayName = "10"; break; + case 11: m_DlssViewStateTableRows[r].displayName = "11"; break; + case 12: m_DlssViewStateTableRows[r].displayName = "12"; break; + case 13: m_DlssViewStateTableRows[r].displayName = "13"; break; + case 14: m_DlssViewStateTableRows[r].displayName = "14"; break; + case 15: m_DlssViewStateTableRows[r].displayName = "15"; break; + } + } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/RayCountManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/RayCountManager.cs index a5c34122668..992b10b2e6f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/RayCountManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/RayCountManager.cs @@ -151,7 +151,7 @@ public void EvaluateRayCount(RenderGraph renderGraph, HDCamera hdCamera, Texture PrepareEvaluateRayCountPassData(builder, passData, hdCamera, colorBuffer, depthBuffer, rayCountTexture); builder.SetRenderFunc( - (EvaluateRayCountPassData data, UnsafeGraphContext ctx) => + static (EvaluateRayCountPassData data, UnsafeGraphContext ctx) => { // Get the size of the viewport to process int currentWidth = data.width; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs index 8affa0cf57e..d52ac384ecc 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs @@ -2411,7 +2411,7 @@ internal void ReserveShadowMap(Camera camera, HDShadowManager shadowManager, HDS var requestIndices = shadowRequestIndices; for (int index = 0; index < count; index++) { - requestIndices[index] = shadowManager.ReserveShadowResolutions(viewportSize, shadowMapType, GetInstanceID(), index, updateType); + requestIndices[index] = shadowManager.ReserveShadowResolutions(viewportSize, shadowMapType, GetEntityId(), index, updateType); } } @@ -3522,7 +3522,7 @@ internal void CreateHDLightRenderEntity(bool autoDestroy = false) { HDLightRenderDatabase lightEntities = HDLightRenderDatabase.instance; lightEntity = lightEntities.CreateEntity(autoDestroy); - lightEntities.AttachGameObjectData(lightEntity, legacyLight.GetInstanceID(), this, legacyLight.gameObject); + lightEntities.AttachGameObjectData(lightEntity, legacyLight.GetEntityId(), this, legacyLight.gameObject); } UpdateRenderEntity(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDLightRenderDatabase.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDLightRenderDatabase.cs index d2316a86a14..a2772f22367 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDLightRenderDatabase.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDLightRenderDatabase.cs @@ -525,7 +525,7 @@ public bool IsValid(HDLightRenderEntity entity) // If the entity is invalid, it returns InvalidDataIndex public int FindEntityDataIndex(in Light light) { - if (light != null && m_LightsToEntityItem.TryGetValue(light.GetInstanceID(), out var foundEntity)) + if (light != null && m_LightsToEntityItem.TryGetValue(light.GetEntityId(), out var foundEntity)) return foundEntity.dataIndex; return -1; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs index d07f8010dda..2e9fb7452e6 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbe.cs @@ -913,7 +913,7 @@ private void ClearSHBaking() SphericalHarmonicsL2Utils.SetCoefficient(ref m_SHForNormalization, 7, Vector3.zero); SphericalHarmonicsL2Utils.SetCoefficient(ref m_SHForNormalization, 8, Vector3.zero); - AdditionalGIBakeRequestsManager.instance.DequeueRequest(GetInstanceID()); + AdditionalGIBakeRequestsManager.instance.DequeueRequest(GetEntityId()); QueueSHBaking(); } @@ -994,7 +994,7 @@ private void QueueSHBaking() Vector3 capturePositionWS = ComputeCapturePositionWS(); // If already enqueued this will just change the position, otherwise it'll enqueue the request. - AdditionalGIBakeRequestsManager.instance.UpdatePositionForRequest(GetInstanceID(), capturePositionWS); + AdditionalGIBakeRequestsManager.instance.UpdatePositionForRequest(GetEntityId(), capturePositionWS); ValidateSHNormalizationSourcePosition(transform.position); ValidateSHNormalizationCapturePosition(capturePositionWS); @@ -1050,7 +1050,7 @@ void UpdateProbeName() void DequeueSHRequest() { #if UNITY_EDITOR - AdditionalGIBakeRequestsManager.instance.DequeueRequest(GetInstanceID()); + AdditionalGIBakeRequestsManager.instance.DequeueRequest(GetEntityId()); #endif } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbeSystem.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbeSystem.cs index ac7f000f74e..a2fbd2394ba 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbeSystem.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/HDProbeSystem.cs @@ -343,7 +343,7 @@ int probeCount if (probes[i] == null || probes[i].Equals(null)) continue; - var instanceID = probes[i].GetInstanceID(); + var instanceID = probes[i].GetEntityId(); HashUtilities.ComputeHash128(ref instanceID, ref h); HashUtilities.AppendHash(ref h, ref result); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/ReflectionProbeTextureCache.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/ReflectionProbeTextureCache.cs index 615bc768738..f147e78a590 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/ReflectionProbeTextureCache.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/ReflectionProbeTextureCache.cs @@ -113,7 +113,7 @@ private static int GetTextureIDAndSize(HDProbe probe, out int textureSize) { textureSize = GetTextureSizeInAtlas(probe); - int textureID = probe.texture.GetInstanceID(); + int textureID = probe.texture.GetEntityId(); // Include texture size in ID using simple hash const int kPrime = 31; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.AmbientOcclusion.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.AmbientOcclusion.cs index ce95b9861df..dcc7a3cc64e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.AmbientOcclusion.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.AmbientOcclusion.cs @@ -231,7 +231,7 @@ TextureHandle RenderAO(RenderGraph renderGraph, in RenderAOParameters parameters builder.UseTexture(passData.normalBuffer, AccessFlags.Read); builder.SetRenderFunc( - (RenderAOPassData data, ComputeGraphContext ctx) => + static (RenderAOPassData data, ComputeGraphContext ctx) => { ConstantBuffer.Push(ctx.cmd, data.parameters.cb, data.gtaoCS, HDShaderIDs._ShaderVariablesAmbientOcclusion); ctx.cmd.SetComputeTextureParam(data.gtaoCS, data.gtaoKernel, HDShaderIDs._AOPackedData, data.packedData); @@ -290,7 +290,7 @@ TextureHandle SpatialDenoiseAO(RenderGraph renderGraph, in RenderAOParameters pa builder.UseTexture(passData.denoiseOutput, AccessFlags.Write); builder.SetRenderFunc( - (SpatialDenoiseAOPassData data, ComputeGraphContext ctx) => + static (SpatialDenoiseAOPassData data, ComputeGraphContext ctx) => { const int groupSizeX = 8; const int groupSizeY = 8; @@ -365,7 +365,7 @@ TextureHandle TemporalDenoiseAO(RenderGraph renderGraph, builder.UseTexture(passData.denoiseOutput, AccessFlags.Write); builder.SetRenderFunc( - (TemporalDenoiseAOPassData data, ComputeGraphContext ctx) => + static (TemporalDenoiseAOPassData data, ComputeGraphContext ctx) => { const int groupSizeX = 8; const int groupSizeY = 8; @@ -430,7 +430,7 @@ TextureHandle UpsampleAO(RenderGraph renderGraph, in RenderAOParameters paramete builder.UseTexture(passData.output, AccessFlags.Write); builder.SetRenderFunc( - (UpsampleAOPassData data, ComputeGraphContext ctx) => + static (UpsampleAOPassData data, ComputeGraphContext ctx) => { ConstantBuffer.Set(ctx.cmd, data.upsampleAndBlurAOCS, HDShaderIDs._ShaderVariablesAmbientOcclusion); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.ScreenSpaceGlobalIllumination.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.ScreenSpaceGlobalIllumination.cs index ee9d651b243..144e4843df1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.ScreenSpaceGlobalIllumination.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/HDRenderPipeline.ScreenSpaceGlobalIllumination.cs @@ -248,7 +248,7 @@ TextureHandle TraceSSGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllumi builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (TraceSSGIPassData data, UnsafeGraphContext ctx) => + static (TraceSSGIPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); int ssgiTileSize = 8; @@ -370,7 +370,7 @@ TextureHandle UpscaleSSGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllu builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (UpscaleSSGIPassData data, UnsafeGraphContext ctx) => + static (UpscaleSSGIPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Re-evaluate the dispatch parameters (we are evaluating the upsample in full resolution) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDDynamicShadowAtlas.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDDynamicShadowAtlas.cs index 9345af1ff61..6a3f99e54d5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDDynamicShadowAtlas.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDDynamicShadowAtlas.cs @@ -249,7 +249,7 @@ public unsafe void BlitCachedIntoAtlas(RenderGraph renderGraph, TextureHandle ca builder.UseTexture(passData.atlasTexture, AccessFlags.Write); builder.SetRenderFunc( - (BlitCachedShadowPassData data, UnsafeGraphContext ctx) => + static (BlitCachedShadowPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); NativeList requestStorage = HDShadowRequestDatabase.instance.hdShadowRequestStorage; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPIpeline.ScreenSpaceShadowsArea.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPIpeline.ScreenSpaceShadowsArea.cs index a2c8a5a4e2d..0a25f17fb5a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPIpeline.ScreenSpaceShadowsArea.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPIpeline.ScreenSpaceShadowsArea.cs @@ -345,7 +345,7 @@ void RenderAreaScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera builder.UseTexture(passData.outputShadowTexture, AccessFlags.ReadWrite); builder.SetRenderFunc( - (RTShadowAreaPassData data, UnsafeGraphContext ctx) => + static (RTShadowAreaPassData data, UnsafeGraphContext ctx) => { ExecuteSSSAreaRayTrace(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadows.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadows.cs index 21512b9b958..e16d5a649e3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadows.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadows.cs @@ -338,7 +338,7 @@ TextureHandle EvaluateShadowDebugView(RenderGraph renderGraph, HDCamera hdCamera builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (ScreenSpaceShadowDebugPassData data, UnsafeGraphContext ctx) => + static (ScreenSpaceShadowDebugPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Evaluate the dispatch parameters @@ -427,7 +427,7 @@ void WriteScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera, TextureH builder.UseTexture(passData.outputShadowArrayBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (WriteScreenSpaceShadowPassData data, UnsafeGraphContext ctx) => + static (WriteScreenSpaceShadowPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Evaluate the dispatch parameters diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsDirectional.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsDirectional.cs index 7b320a18103..1a20b68d5ac 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsDirectional.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsDirectional.cs @@ -151,7 +151,7 @@ void RenderRayTracedDirectionalScreenSpaceShadow(RenderGraph renderGraph, HDCame builder.UseTexture(passData.outputShadowBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (RTSDirectionalTracePassData data, UnsafeGraphContext ctx) => + static (RTSDirectionalTracePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Inject the ray-tracing sampling data @@ -280,7 +280,7 @@ void RenderDirectionalLightScreenSpaceShadow(RenderGraph renderGraph, HDCamera h builder.UseTexture(passData.screenSpaceShadowArray, AccessFlags.ReadWrite); builder.SetRenderFunc( - (SSSDirectionalTracePassData data, UnsafeGraphContext ctx) => + static (SSSDirectionalTracePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // If it is screen space but not ray traced, then we can rely on the shadow map diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsPunctual.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsPunctual.cs index 4bafd66c964..aa05b58c7be 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsPunctual.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDRenderPipeline.ScreenSpaceShadowsPunctual.cs @@ -237,7 +237,7 @@ void RenderPunctualScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera builder.UseTexture(passData.outputShadowBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (RTSPunctualTracePassData data, UnsafeGraphContext ctx) => + static (RTSPunctualTracePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Inject the ray-tracing sampling data diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs index 6d9eba6c82e..3eb21f3d0c5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAtlas.cs @@ -444,7 +444,7 @@ internal unsafe TextureHandle RenderShadowMaps(RenderGraph renderGraph, Scriptab passData.renderContext = renderContext; builder.SetRenderFunc( - (RenderShadowMapsPassData data, UnsafeGraphContext ctx) => + static (RenderShadowMapsPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); natCmd.SetRenderTarget(data.atlasTexture, RenderBufferLoadAction.DontCare, RenderBufferStoreAction.Store); @@ -527,7 +527,7 @@ unsafe TextureHandle EVSMBlurMoments(RenderGraph renderGraph, TextureHandle inpu builder.UseTexture(passData.momentAtlasTexture2, AccessFlags.Write); builder.SetRenderFunc( - (EVSMBlurMomentsPassData data, UnsafeGraphContext ctx) => + static (EVSMBlurMomentsPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); ComputeShader shadowBlurMomentsCS = data.evsmShadowBlurMomentsCS; @@ -659,7 +659,7 @@ unsafe TextureHandle IMBlurMoment(RenderGraph renderGraph, TextureHandle atlasTe builder.UseTexture(passData.summedAreaTexture, AccessFlags.Write); builder.SetRenderFunc( - (IMBlurMomentPassData data, UnsafeGraphContext ctx) => + static (IMBlurMomentPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // If the target kernel is not available diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs index d106abcb19b..3418ae84a04 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs @@ -1466,7 +1466,7 @@ void BindShadowGlobalResources(RenderGraph renderGraph, in ShadowResult shadowRe passData.shadowResult = ReadShadowResult(shadowResult, builder); builder.AllowGlobalStateModification(true); builder.SetRenderFunc( - (BindShadowGlobalResourcesPassData data, UnsafeGraphContext ctx) => + static (BindShadowGlobalResourcesPassData data, UnsafeGraphContext ctx) => { BindAtlasTexture(ctx, data.shadowResult.punctualShadowResult, HDShaderIDs._ShadowmapAtlas); BindAtlasTexture(ctx, data.shadowResult.directionalShadowResult, HDShaderIDs._ShadowmapCascadeAtlas); @@ -1483,7 +1483,7 @@ internal static void BindDefaultShadowGlobalResources(RenderGraph renderGraph) { builder.AllowGlobalStateModification(true); builder.SetRenderFunc( - (BindShadowGlobalResourcesPassData data, UnsafeGraphContext ctx) => + static (BindShadowGlobalResourcesPassData data, UnsafeGraphContext ctx) => { BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapAtlas); BindAtlasTexture(ctx, ctx.defaultResources.defaultShadowTexture, HDShaderIDs._ShadowmapCascadeAtlas); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricClouds.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricClouds.cs index 7d47f55781a..bdab302d0f2 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricClouds.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricClouds.cs @@ -620,7 +620,7 @@ internal void CombineVolumetricClouds(RenderGraph renderGraph, HDCamera hdCamera } builder.SetRenderFunc( - (VolumetricCloudsCombineOpaqueData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsCombineOpaqueData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); data.cloudsCombineMaterial.SetTexture(HDShaderIDs._VolumetricCloudsLightingTexture, data.volumetricCloudsLightingTexture); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsAccumulation.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsAccumulation.cs index 5c88eb71356..47fa25571c9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsAccumulation.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsAccumulation.cs @@ -240,7 +240,7 @@ VolumetricCloudsOutput RenderVolumetricClouds_Accumulation(RenderGraph renderGra CreateOutputTextures(renderGraph, builder, settings, out passData.cloudsLighting, out passData.cloudsDepth); builder.SetRenderFunc( - (VolumetricCloudsAccumulationData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsAccumulationData data, UnsafeGraphContext ctx) => { TraceVolumetricClouds_Accumulation(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.parameters, data.ambientProbeBuffer, data.colorBuffer, data.depthPyramid, diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsFullResolution.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsFullResolution.cs index c7e610e97e4..b1f92e89cf9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsFullResolution.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsFullResolution.cs @@ -110,7 +110,7 @@ VolumetricCloudsOutput RenderVolumetricClouds_FullResolution(RenderGraph renderG CreateOutputTextures(renderGraph, builder, settings, out passData.cloudsLighting, out passData.cloudsDepth); builder.SetRenderFunc( - (VolumetricCloudsFullResolutionData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsFullResolutionData data, UnsafeGraphContext ctx) => { TraceVolumetricClouds_FullResolution(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.parameters, data.ambientProbeBuffer, data.colorBuffer, data.depthPyramid, diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsLowResolution.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsLowResolution.cs index d54d6e9ed87..efb0ae4d1bf 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsLowResolution.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsLowResolution.cs @@ -154,7 +154,7 @@ VolumetricCloudsOutput RenderVolumetricClouds_LowResolution(RenderGraph renderGr CreateOutputTextures(renderGraph, builder, settings, out passData.cloudsLighting, out passData.cloudsDepth); builder.SetRenderFunc( - (VolumetricCloudsLowResolutionData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsLowResolutionData data, UnsafeGraphContext ctx) => { TraceVolumetricClouds_LowResolution(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.parameters, data.ambientProbeBuffer, data.colorBuffer, data.depthPyramid, diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsMap.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsMap.cs index a2f5576fcde..84896a40191 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsMap.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsMap.cs @@ -165,7 +165,7 @@ void PreRenderVolumetricCloudMap(RenderGraph renderGraph, HDCamera hdCamera, in builder.UseTexture(passData.cloudMapTexture, AccessFlags.Write); builder.SetRenderFunc( - (VolumetricCloudsMapData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsMapData data, UnsafeGraphContext ctx) => { EvaluateVolumetricCloudMap(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.parameters, data.cloudMapTexture); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsShadows.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsShadows.cs index 53dd6a62320..e416665e635 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsShadows.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsShadows.cs @@ -256,7 +256,7 @@ internal void RenderVolumetricCloudsShadows(RenderGraph renderGraph, HDCamera hd builder.UseTexture(passData.shadowTexture, AccessFlags.ReadWrite); // Evaluate the shadow - builder.SetRenderFunc((VolumetricCloudsShadowsData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (VolumetricCloudsShadowsData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsSky.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsSky.cs index e9da48813a7..da5f84ab467 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsSky.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricClouds/HDRenderPipeline.VolumetricCloudsSky.cs @@ -265,7 +265,7 @@ class VolumetricCloudsUpscalePassData public Matrix4x4[] pixelCoordToViewDir; } - unsafe internal void UpdatePixelCoordToViewDir(ref ShaderVariablesClouds cb, in Matrix4x4 pixelCoordToViewDir) + internal static unsafe void UpdatePixelCoordToViewDir(ref ShaderVariablesClouds cb, in Matrix4x4 pixelCoordToViewDir) { for (int j = 0; j < 16; ++j) cb._CloudsPixelCoordToViewDirWS[j] = pixelCoordToViewDir[j]; @@ -285,7 +285,7 @@ internal void RenderVolumetricClouds_Sky(RenderGraph renderGraph, HDCamera hdCam PrepareVolumetricCloudsSkyHighPassData(renderGraph, builder, hdCamera, width, height, pixelCoordToViewDir, CubemapFace.Unknown, settings, probeBuffer, skyboxCubemap, passData); builder.SetRenderFunc( - (VolumetricCloudsSkyHighPassData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsSkyHighPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); for (int faceIdx = 0; faceIdx < 6; ++faceIdx) @@ -309,7 +309,7 @@ internal void RenderVolumetricClouds_Sky(RenderGraph renderGraph, HDCamera hdCam PrepareVolumetricCloudsSkyLowPassData(renderGraph, builder, hdCamera, width, height, pixelCoordToViewDir, CubemapFace.Unknown, settings, probeBuffer, passData); builder.SetRenderFunc( - (VolumetricCloudsSkyLowPassData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsSkyLowPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); for (int faceIdx = 0; faceIdx < 6; ++faceIdx) @@ -336,7 +336,7 @@ internal void RenderVolumetricClouds_Sky(RenderGraph renderGraph, HDCamera hdCam builder.UseTexture(passData.output, AccessFlags.Write); builder.SetRenderFunc( - (VolumetricCloudsPreUpscalePassData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsPreUpscalePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); for (int faceIdx = 0; faceIdx < 6; ++faceIdx) @@ -373,7 +373,7 @@ internal void RenderVolumetricClouds_Sky(RenderGraph renderGraph, HDCamera hdCam } builder.SetRenderFunc( - (VolumetricCloudsUpscalePassData data, UnsafeGraphContext ctx) => + static (VolumetricCloudsUpscalePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); for (int faceIdx = 0; faceIdx < 6; ++faceIdx) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/HDRenderPipeline.VolumetricLighting.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/HDRenderPipeline.VolumetricLighting.cs index b90de28afbd..f67abafeee7 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/HDRenderPipeline.VolumetricLighting.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/VolumetricLighting/HDRenderPipeline.VolumetricLighting.cs @@ -584,7 +584,7 @@ TextureHandle GenerateMaxZPass(RenderGraph renderGraph, HDCamera hdCamera, Textu builder.UseTexture(passData.dilatedMaxZBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (GenerateMaxZMaskPassData data, UnsafeGraphContext ctx) => + static (GenerateMaxZMaskPassData data, UnsafeGraphContext ctx) => { // Downsample 8x8 with max operator @@ -1107,7 +1107,7 @@ unsafe TextureHandle ClearAndHeightFogVoxelizationPass(RenderGraph renderGraph, builder.EnableAsyncCompute(hdCamera.frameSettings.VolumeVoxelizationRunsAsync() && !passData.water); builder.SetRenderFunc( - (HeightFogVoxelizationPassData data, ComputeGraphContext ctx) => + static (HeightFogVoxelizationPassData data, ComputeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.voxelizationCS, data.voxelizationKernel, HDShaderIDs._VBufferDensity, data.densityBuffer); ctx.cmd.SetComputeBufferParam(data.voxelizationCS, data.voxelizationKernel, HDShaderIDs._VolumeAmbientProbeBuffer, data.volumetricAmbientProbeBuffer); @@ -1222,7 +1222,7 @@ unsafe TextureHandle FogVolumeAndVFXVoxelizationPass(RenderGraph renderGraph, passData.visibleVolumeGlobalIndices = m_VisibleVolumeGlobalIndices; builder.SetRenderFunc( - (VolumetricFogVoxelizationPassData data, UnsafeGraphContext ctx) => + static (VolumetricFogVoxelizationPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -1438,7 +1438,7 @@ TextureHandle VolumetricLightingPass(RenderGraph renderGraph, HDCamera hdCamera, HDShadowManager.ReadShadowResult(shadowResult, builder); builder.SetRenderFunc( - (VolumetricLightingPassData data, UnsafeGraphContext ctx) => + static (VolumetricLightingPassData data, UnsafeGraphContext ctx) => { if (data.tiledLighting) ctx.cmd.SetComputeBufferParam(data.volumetricLightingCS, data.volumetricLightingKernel, HDShaderIDs.g_vBigTileLightList, data.bigTileVolumetricLightListBuffer); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs index daa780fb05f..04edd353dc8 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/DecalSystem.cs @@ -1278,7 +1278,7 @@ public DecalHandle AddDecal(DecalProjector decalProjector) var material = decalProjector.material; DecalSet decalSet = null; - int key = material != null ? material.GetInstanceID() : kNullMaterialIndex; + int key = material != null ? material.GetEntityId() : kNullMaterialIndex; if (!m_DecalSets.TryGetValue(key, out decalSet)) { SetupMipStreamingSettings(material, true); @@ -1426,7 +1426,7 @@ public void AddTexture(CommandBuffer cmd, TextureScaleBias textureScaleBias) { if (!Atlas.IsCached(out textureScaleBias.m_ScaleBias, textureScaleBias.texture)) { - if (!Atlas.AllocateTextureWithoutBlit(textureScaleBias.texture.GetInstanceID(), textureScaleBias.width, textureScaleBias.height, ref textureScaleBias.m_ScaleBias)) + if (!Atlas.AllocateTextureWithoutBlit(textureScaleBias.texture.GetEntityId(), textureScaleBias.width, textureScaleBias.height, ref textureScaleBias.m_ScaleBias)) { m_AllocationSuccess = false; } @@ -1544,7 +1544,7 @@ public void UpdateShaderGraphAtlasTextures(RenderGraph renderGraph) updatePassData.shaderGraphVertexCount = m_ShaderGraphVertexCount; - builder.SetRenderFunc((UpdateShaderGraphTexturePassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (UpdateShaderGraphTexturePassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetRenderTarget(data.atlasTexture); @@ -1568,7 +1568,7 @@ public void UpdateShaderGraphAtlasTextures(RenderGraph renderGraph) passData.atlasTexture = renderGraph.ImportTexture(Atlas.AtlasTexture); builder.UseTexture(passData.atlasTexture, AccessFlags.Write); - builder.SetRenderFunc((UpdateAtlasMipmapsPassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (UpdateAtlasMipmapsPassData data, UnsafeGraphContext ctx) => { CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd).GenerateMips(data.atlasTexture); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/DenoisePass.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/DenoisePass.cs index c23a10fc6bc..1ba4a3be455 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/DenoisePass.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/DenoisePass.cs @@ -67,7 +67,7 @@ void RenderDenoisePass(RenderGraph renderGraph, ScriptableRenderContext renderCo } // copy camera params - passData.camID = hdCamera.camera.GetInstanceID(); + passData.camID = hdCamera.camera.GetEntityId(); passData.width = hdCamera.actualWidth; passData.height = hdCamera.actualHeight; passData.slices = hdCamera.viewCount; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs index 59701ab2598..dacb3ffa135 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Accumulation/SubFrameManager.cs @@ -322,7 +322,7 @@ float ShutterProfile(float time) else if (time > m_ShutterBeginsClosing) { float closingSlope = 1.0f / (1.0f - m_ShutterBeginsClosing); - // We are using max to prevent the weight from going negative due to numerical imprecision + // We are using max to prevent the weight from going negative due to numerical imprecision return Mathf.Max(0.0f, 1.0f - closingSlope * (time - m_ShutterBeginsClosing)); } else @@ -409,7 +409,7 @@ public void PrepareNewSubFrame() /// true if the accumulation is completed, false otherwise. public bool IsFrameCompleted(HDCamera hdCamera) { - int camID = hdCamera.camera.GetInstanceID(); + int camID = hdCamera.camera.GetEntityId(); CameraData camData = m_SubFrameManager.GetCameraData(camID); return camData.currentIteration >= m_SubFrameManager.subFrameCount; } @@ -436,7 +436,7 @@ class RenderAccumulationPassData void RenderAccumulation(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle inputTexture, TextureHandle outputTexture, List> AOVs, bool needExposure) { - int camID = hdCamera.camera.GetInstanceID(); + int camID = hdCamera.camera.GetEntityId(); Vector4 frameWeights = m_SubFrameManager.ComputeFrameWeights(camID); if (AOVs != null) @@ -485,7 +485,7 @@ void RenderAccumulation(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl } builder.SetRenderFunc( - (RenderAccumulationPassData data, UnsafeGraphContext ctx) => + static (RenderAccumulationPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); ComputeShader accumulationShader = data.accumulationCS; @@ -496,17 +496,17 @@ void RenderAccumulation(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl accumulationShader.shaderKeywords = null; if (data.useInputTexture) - natCmd.EnableKeyword(accumulationShader, passData.inputKeyword); + natCmd.EnableKeyword(accumulationShader, data.inputKeyword); else - natCmd.DisableKeyword(accumulationShader, passData.inputKeyword); + natCmd.DisableKeyword(accumulationShader, data.inputKeyword); if (data.useOutputTexture) - natCmd.EnableKeyword(accumulationShader, passData.outputKeyword); + natCmd.EnableKeyword(accumulationShader, data.outputKeyword); else - natCmd.DisableKeyword(accumulationShader, passData.outputKeyword); + natCmd.DisableKeyword(accumulationShader, data.outputKeyword); // Get the per-camera data - int camID = data.hdCamera.camera.GetInstanceID(); + int camID = data.hdCamera.camera.GetEntityId(); CameraData camData = data.subFrameManager.GetCameraData(camID); // Accumulate the path tracing results diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs index ce271d1c004..6db4b327f9a 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Camera/HDCamera.cs @@ -902,14 +902,14 @@ internal float probeRangeCompressionFactor internal bool ValidShadowHistory(HDAdditionalLightData lightData, int screenSpaceShadowIndex, GPULightType lightType) { - return shadowHistoryUsage[screenSpaceShadowIndex].lightInstanceID == lightData.GetInstanceID() + return shadowHistoryUsage[screenSpaceShadowIndex].lightInstanceID == lightData.GetEntityId() && (shadowHistoryUsage[screenSpaceShadowIndex].frameCount == (cameraFrameCount - 1)) && (shadowHistoryUsage[screenSpaceShadowIndex].lightType == lightType); } internal void PropagateShadowHistory(HDAdditionalLightData lightData, int screenSpaceShadowIndex, GPULightType lightType) { - shadowHistoryUsage[screenSpaceShadowIndex].lightInstanceID = lightData.GetInstanceID(); + shadowHistoryUsage[screenSpaceShadowIndex].lightInstanceID = lightData.GetEntityId(); shadowHistoryUsage[screenSpaceShadowIndex].frameCount = cameraFrameCount; shadowHistoryUsage[screenSpaceShadowIndex].lightType = lightType; shadowHistoryUsage[screenSpaceShadowIndex].transform = lightData.transform.localToWorldMatrix; @@ -1834,7 +1834,7 @@ internal void ExecuteCaptureActions(RenderGraph renderGraph, TextureHandle input builder.AllowPassCulling(false); builder.SetRenderFunc( - (ExecuteCaptureActionsPassData data, UnsafeGraphContext ctx) => + static (ExecuteCaptureActionsPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDAdditionalMeshRendererSettings.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDAdditionalMeshRendererSettings.cs index 58355ce9abb..38ae5eb578c 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDAdditionalMeshRendererSettings.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDAdditionalMeshRendererSettings.cs @@ -620,7 +620,7 @@ float Smoothstep(float edge0, float edge1, float x) lodMode = m_RendererLODMode, lod = strandLOD, shadingFraction = m_ShadingSampleFraction, - hash = GetInstanceID() + hash = GetEntityId().GetHashCode() }; } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs index 0d1531d0149..2443c5b4c35 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Debug.cs @@ -517,7 +517,7 @@ void RenderTransparencyOverdraw(RenderGraph renderGraph, TextureHandle depthBuff builder.SetRenderAttachment(transparencyOverdrawOutput, 0); builder.SetRenderFunc( - (TransparencyOverdrawPassData data, UnsafeGraphContext ctx) => + static (TransparencyOverdrawPassData data, UnsafeGraphContext ctx) => { data.constantBuffer._DebugTransparencyOverdrawWeight = 1.0f; ConstantBuffer.PushGlobal(ctx.cmd, data.constantBuffer, HDShaderIDs._ShaderVariablesDebugDisplay); @@ -571,7 +571,7 @@ void RenderFullScreenDebug(RenderGraph renderGraph, TextureHandle colorBuffer, T passData.viewCount = hdCamera.viewCount; builder.SetRenderFunc( - (FullScreenDebugPassData data, UnsafeGraphContext ctx) => + static (FullScreenDebugPassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeVectorParam(data.clearBufferCS, HDShaderIDs._QuadOverdrawClearBuffParams, new Vector4(data.width, data.height, 0.0f, 0.0f)); ctx.cmd.SetComputeBufferParam(data.clearBufferCS, data.clearBufferCSKernel, HDShaderIDs._FullScreenDebugBuffer, data.debugBuffer); @@ -648,7 +648,7 @@ TextureHandle ResolveFullScreenDebug(RenderGraph renderGraph, TextureHandle inpu builder.UseTexture(passData.output, AccessFlags.Write); builder.SetRenderFunc( - (ResolveFullScreenDebugPassData data, UnsafeGraphContext ctx) => + static (ResolveFullScreenDebugPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); @@ -709,7 +709,7 @@ TextureHandle ResolveColorPickerDebug(RenderGraph renderGraph, TextureHandle inp builder.UseTexture(passData.output, AccessFlags.Write); builder.SetRenderFunc( - (ResolveColorPickerDebugPassData data, UnsafeGraphContext ctx) => + static (ResolveColorPickerDebugPassData data, UnsafeGraphContext ctx) => { var falseColorDebugSettings = data.debugDisplaySettings.data.falseColorDebugSettings; var colorPickerDebugSettings = data.debugDisplaySettings.data.colorPickerDebugSettings; @@ -769,7 +769,7 @@ void RenderSkyReflectionOverlay(RenderGraph renderGraph, TextureHandle colorBuff passData.debugLatlongMaterial = m_DebugDisplayLatlong; builder.SetRenderFunc( - (SkyReflectionOverlayPassData data, UnsafeGraphContext ctx) => + static (SkyReflectionOverlayPassData data, UnsafeGraphContext ctx) => { var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); @@ -797,6 +797,8 @@ class RenderAtlasDebugOverlayPassData public Texture atlasTexture; public int mipLevel; public Material debugBlitMaterial; + public bool applyExposure; + public int slice; } void RenderAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, TextureHandle depthBuffer, Texture atlas, int slice, int mipLevel, bool applyExposure, string passName, HDProfileId profileID) @@ -811,9 +813,11 @@ void RenderAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, passData.debugBlitMaterial = m_DebugBlitMaterial; passData.mipLevel = mipLevel; passData.atlasTexture = atlas; + passData.applyExposure = applyExposure; + passData.slice = slice; builder.SetRenderFunc( - (RenderAtlasDebugOverlayPassData data, UnsafeGraphContext ctx) => + static (RenderAtlasDebugOverlayPassData data, UnsafeGraphContext ctx) => { Debug.Assert(data.atlasTexture.dimension == TextureDimension.Tex2D || data.atlasTexture.dimension == TextureDimension.Tex2DArray); @@ -821,7 +825,7 @@ void RenderAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, int shaderPass; var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); - mpb.SetFloat(HDShaderIDs._ApplyExposure, applyExposure ? 1.0f : 0.0f); + mpb.SetFloat(HDShaderIDs._ApplyExposure, data.applyExposure ? 1.0f : 0.0f); mpb.SetFloat(HDShaderIDs._Mipmap, data.mipLevel); if (data.atlasTexture.dimension == TextureDimension.Tex2D) { @@ -832,7 +836,7 @@ void RenderAtlasDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, { shaderPass = 1; mpb.SetTexture(HDShaderIDs._InputTextureArray, data.atlasTexture); - mpb.SetInt(HDShaderIDs._ArrayIndex, slice); + mpb.SetInt(HDShaderIDs._ArrayIndex, data.slice); } ctx.cmd.DrawProcedural(Matrix4x4.identity, data.debugBlitMaterial, shaderPass, MeshTopology.Triangles, 3, 1, mpb); @@ -904,7 +908,7 @@ void RenderTileClusterDebugOverlay(RenderGraph renderGraph, TextureHandle colorB passData.lightingViewportSize = new Vector4(hdCamera.actualWidth, hdCamera.actualHeight, 1.0f / (float)hdCamera.actualWidth, 1.0f / (float)hdCamera.actualHeight); builder.SetRenderFunc( - (RenderTileClusterDebugOverlayPassData data, UnsafeGraphContext ctx) => + static (RenderTileClusterDebugOverlayPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -1003,7 +1007,7 @@ void RenderShadowsDebugOverlay(RenderGraph renderGraph, TextureHandle colorBuffe passData.debugShadowMapMaterial = m_DebugHDShadowMapMaterial; builder.SetRenderFunc( - (RenderShadowsDebugOverlayPassData data, UnsafeGraphContext ctx) => + static (RenderShadowsDebugOverlayPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var lightingDebug = data.lightingDebugSettings; @@ -1088,7 +1092,7 @@ void RenderDecalOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, Text passData.hdCamera = hdCamera; builder.SetRenderFunc( - (RenderDecalOverlayPassData data, UnsafeGraphContext ctx) => + static (RenderDecalOverlayPassData data, UnsafeGraphContext ctx) => { DecalSystem.instance.RenderDebugOverlay(data.hdCamera, CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.mipLevel, data.debugOverlay); }); @@ -1100,7 +1104,7 @@ void RenderOcclusionOverlay(RenderGraph renderGraph, TextureHandle colorBuffer, GPUResidentDrawer.RenderDebugOcclusionTestOverlay( renderGraph, HDDebugDisplaySettings.Instance?.gpuResidentDrawerSettings ?? null, - hdCamera.camera.GetInstanceID(), + hdCamera.camera.GetEntityId(), colorBuffer); } @@ -1193,7 +1197,7 @@ void GenerateDebugImageHistogram(RenderGraph renderGraph, HDCamera hdCamera, Tex builder.UseTexture(passData.source, AccessFlags.Read); builder.SetRenderFunc( - (DebugImageHistogramData data, UnsafeGraphContext ctx) => + static (DebugImageHistogramData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.debugImageHistogramCS, data.debugImageHistogramKernel, HDShaderIDs._SourceTexture, data.source); ctx.cmd.SetComputeBufferParam(data.debugImageHistogramCS, data.debugImageHistogramKernel, HDShaderIDs._HistogramBuffer, data.imageHistogram); @@ -1244,7 +1248,7 @@ TextureHandle GenerateDebugHDRxyMapping(RenderGraph renderGraph, HDCamera hdCame passData.debugParameters = new Vector4(k_SizeOfHDRXYMapping, k_SizeOfHDRXYMapping, 0, 0); builder.SetRenderFunc( - (GenerateHDRDebugData data, UnsafeGraphContext ctx) => + static (GenerateHDRDebugData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.generateXYMappingCS, data.debugXYGenKernel, HDShaderIDs._SourceTexture, data.source); ctx.cmd.SetComputeVectorParam(data.generateXYMappingCS, HDShaderIDs._HDRxyBufferDebugParams, data.debugParameters); @@ -1312,7 +1316,7 @@ TextureHandle RenderHDRDebug(RenderGraph renderGraph, HDCamera hdCamera, Texture } builder.SetRenderFunc( - (DebugHDRData data, UnsafeGraphContext ctx) => + static (DebugHDRData data, UnsafeGraphContext ctx) => { data.debugHDRMaterial.SetTexture(HDShaderIDs._DebugFullScreenTexture, data.debugFullScreenTexture); data.debugHDRMaterial.SetTexture(HDShaderIDs._xyBuffer, data.xyTexture); @@ -1374,7 +1378,7 @@ TextureHandle RenderExposureDebug(RenderGraph renderGraph, HDCamera hdCamera, Te passData.histogramBuffer = passData.lightingDebugSettings.exposureDebugMode == ExposureDebugMode.FinalImageHistogramView ? GetDebugImageHistogramBuffer() : GetHistogramBuffer(); builder.SetRenderFunc( - (DebugExposureData data, UnsafeGraphContext ctx) => + static (DebugExposureData data, UnsafeGraphContext ctx) => { // Grab exposure parameters var exposureSettings = data.hdCamera.volumeStack.GetComponent(); @@ -1539,7 +1543,7 @@ void WriteApvPositionNormalDebugBuffer(RenderGraph renderGraph, GraphicsBuffer r passData.computeShader = m_ComputePositionNormal; builder.SetRenderFunc( - (WriteApvData data, UnsafeGraphContext ctx) => + static (WriteApvData data, UnsafeGraphContext ctx) => { int kernelHandle = data.computeShader.FindKernel("ComputePositionNormal"); ctx.cmd.SetComputeTextureParam(data.computeShader, kernelHandle, "_CameraDepthTexture", data.depthBuffer); @@ -1603,7 +1607,7 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu builder.UseTexture(passData.depthBuffer, AccessFlags.Read); builder.SetRenderFunc( - (DebugViewMaterialData data, UnsafeGraphContext ctx) => + static (DebugViewMaterialData data, UnsafeGraphContext ctx) => { var gbufferHandles = data.gbuffer; for (int i = 0; i < gbufferHandles.gBufferCount; ++i) @@ -1672,7 +1676,7 @@ TextureHandle RenderDebugViewMaterial(RenderGraph renderGraph, CullingResults cu passData.clearDepth = hdCamera.clearDepth; builder.SetRenderFunc( - (DebugViewMaterialData data, UnsafeGraphContext ctx) => + static (DebugViewMaterialData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // If we are doing camera stacking, then we want to clear the debug color and depth buffer using the data from the previous camera on the stack @@ -1788,7 +1792,7 @@ void PushFullScreenDebugTexture(RenderGraph renderGraph, TextureHandle input, bo builder.SetRenderAttachment(passData.output, 0); builder.SetRenderFunc( - (PushFullScreenDebugPassData data, UnsafeGraphContext ctx) => + static (PushFullScreenDebugPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); if (data.useCustomScaleBias) @@ -1902,7 +1906,7 @@ TextureHandle PushColorPickerDebugTexture(RenderGraph renderGraph, TextureHandle builder.SetRenderAttachment(passData.output, 0); builder.SetRenderFunc( - (PushFullScreenDebugPassData data, UnsafeGraphContext ctx) => + static (PushFullScreenDebugPassData data, UnsafeGraphContext ctx) => { Blitter.BlitCameraTexture(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.input, data.output); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs index d4870e20e4c..930f5f52eb1 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.LightLoop.cs @@ -678,7 +678,7 @@ BuildGPULightListOutput BuildGPULightList( PrepareBuildGPULightListPassData(renderGraph, builder, hdCamera, tileAndClusterData, ref constantBuffer, totalLightCount, depthStencilBuffer, stencilBufferCopy, gBuffer, passData); builder.SetRenderFunc( - (BuildGPULightListPassData data, ComputeGraphContext context) => + static (BuildGPULightListPassData data, ComputeGraphContext context) => { bool tileFlagsWritten = false; @@ -711,7 +711,7 @@ void PushGlobalCameraParams(RenderGraph renderGraph, HDCamera hdCamera) passData.xrCB = m_ShaderVariablesXRCB; builder.SetRenderFunc( - (PushGlobalCameraParamPassData data, UnsafeGraphContext ctx) => + static (PushGlobalCameraParamPassData data, UnsafeGraphContext ctx) => { ConstantBuffer.PushGlobal(ctx.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal); ConstantBuffer.PushGlobal(ctx.cmd, data.xrCB, HDShaderIDs._ShaderVariablesXR); @@ -958,7 +958,7 @@ LightingOutput RenderDeferredLighting( output.colorBuffer = passData.colorBuffer; builder.SetRenderFunc( - (DeferredLightingPassData data, UnsafeGraphContext ctx) => + static (DeferredLightingPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var colorBuffers = ctx.renderGraphPool.GetTempArray(2); @@ -1266,7 +1266,7 @@ TextureHandle RenderSSR(RenderGraph renderGraph, builder.AllowGlobalStateModification(true); builder.SetRenderFunc( - (RenderSSRPassData data, ComputeGraphContext ctx) => + static (RenderSSRPassData data, ComputeGraphContext ctx) => { var cs = data.ssrCS; ConstantBuffer.Push(ctx.cmd, data.cb, cs, HDShaderIDs._ShaderVariablesScreenSpaceReflection); @@ -1537,7 +1537,7 @@ TextureHandle RenderContactShadows(RenderGraph renderGraph, HDCamera hdCamera, T result = passData.contactShadowsTexture; builder.SetRenderFunc( - (RenderContactShadowPassData data, ComputeGraphContext ctx) => + static (RenderContactShadowPassData data, ComputeGraphContext ctx) => { ctx.cmd.SetComputeVectorParam(data.contactShadowsCS, HDShaderIDs._ContactShadowParamsParameters, data.params1); ctx.cmd.SetComputeVectorParam(data.contactShadowsCS, HDShaderIDs._ContactShadowParamsParameters2, data.params2); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs index a3699be0007..6f23e082a26 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.PostProcess.cs @@ -846,7 +846,7 @@ void RestoreNonjitteredMatrices(RenderGraph renderGraph, HDCamera hdCamera) builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((RestoreNonJitteredPassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (RestoreNonJitteredPassData data, UnsafeGraphContext ctx) => { ConstantBuffer.PushGlobal(ctx.cmd, data.globalCB, HDShaderIDs._ShaderVariablesGlobal); }); @@ -883,7 +883,7 @@ TextureHandle UpscalerColorMaskPass(RenderGraph renderGraph, HDCamera hdCamera, passData.destHeight = hdCamera.actualHeight; builder.SetRenderFunc( - (UpscalerColorMaskPassData data, UnsafeGraphContext ctx) => + static (UpscalerColorMaskPassData data, UnsafeGraphContext ctx) => { Rect targetViewport = new Rect(0.0f, 0.0f, data.destWidth, data.destHeight); data.colorMaskMaterial.SetInt(HDShaderIDs._StencilMask, (int)StencilUsage.ExcludeFromTUAndAA); @@ -969,7 +969,7 @@ TextureHandle DoDLSSPass( passData.pass = m_DLSSPass; builder.SetRenderFunc( - (DLSSData data, UnsafeGraphContext ctx) => + static (DLSSData data, UnsafeGraphContext ctx) => { data.pass.Render(data.parameters, UpscalerResources.GetCameraResources(data.resourceHandles), CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -1041,7 +1041,7 @@ TextureHandle DoFSR2Pass( passData.pass = m_FSR2Pass; builder.SetRenderFunc( - (FSR2Data data, UnsafeGraphContext ctx) => + static (FSR2Data data, UnsafeGraphContext ctx) => { data.pass.Render(data.parameters, UpscalerResources.GetCameraResources(data.resourceHandles), CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -1076,7 +1076,7 @@ TextureHandle inputStencil io.previousPreUpscaleResolution = hdCamera.historyRTHandleProperties.previousViewportSize; io.postUpscaleResolution = new Vector2Int((int)hdCamera.finalViewport.width, (int)hdCamera.finalViewport.height); io.enableTexArray = TextureXR.useTexArray; - io.cameraInstanceID = hdCamera.camera.GetInstanceID(); + io.cameraInstanceID = hdCamera.camera.GetEntityId(); io.nearClipPlane = hdCamera.camera.nearClipPlane; io.farClipPlane = hdCamera.camera.farClipPlane; io.fieldOfViewDegrees = hdCamera.camera.fieldOfView; @@ -1185,7 +1185,7 @@ TextureHandle DoCopyAlpha(RenderGraph renderGraph, HDCamera hdCamera, TextureHan builder.UseTexture(passData.outputAlpha, AccessFlags.Write); builder.SetRenderFunc( - (AlphaCopyPassData data, UnsafeGraphContext ctx) => + static (AlphaCopyPassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.copyAlphaCS, data.copyAlphaKernel, HDShaderIDs._InputTexture, data.source); ctx.cmd.SetComputeTextureParam(data.copyAlphaCS, data.copyAlphaKernel, HDShaderIDs._OutputTexture, data.outputAlpha); @@ -1243,7 +1243,7 @@ TextureHandle StopNaNsPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHa builder.UseTexture(passData.destination, AccessFlags.Write); builder.SetRenderFunc( - (StopNaNPassData data, UnsafeGraphContext ctx) => + static (StopNaNPassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.nanKillerCS, data.nanKillerKernel, HDShaderIDs._InputTexture, data.source); ctx.cmd.SetComputeTextureParam(data.nanKillerCS, data.nanKillerKernel, HDShaderIDs._OutputTexture, data.destination); @@ -1738,7 +1738,7 @@ TextureHandle DynamicExposurePass(RenderGraph renderGraph, HDCamera hdCamera, Te passData.exposureDebugData = renderGraph.ImportTexture(m_DebugExposureData); builder.UseTexture(passData.exposureDebugData, AccessFlags.Write); builder.SetRenderFunc( - (DynamicExposureData data, UnsafeGraphContext ctx) => + static (DynamicExposureData data, UnsafeGraphContext ctx) => { DoHistogramBasedExposure(data, CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -1752,7 +1752,7 @@ TextureHandle DynamicExposurePass(RenderGraph renderGraph, HDCamera hdCamera, Te { format = GraphicsFormat.R16G16_SFloat, enableRandomWrite = true, name = "Average Luminance Temp 32" }); builder.SetRenderFunc( - (DynamicExposureData data, UnsafeGraphContext ctx) => + static (DynamicExposureData data, UnsafeGraphContext ctx) => { DoDynamicExposure(data, CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -1785,7 +1785,7 @@ TextureHandle DynamicExposurePass(RenderGraph renderGraph, HDCamera hdCamera, Te builder.UseTexture(passData.destination, AccessFlags.Write); builder.SetRenderFunc( - (ApplyExposureData data, UnsafeGraphContext ctx) => + static (ApplyExposureData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.applyExposureCS, data.applyExposureKernel, HDShaderIDs._ExposureTexture, data.prevExposure); ctx.cmd.SetComputeTextureParam(data.applyExposureCS, data.applyExposureKernel, HDShaderIDs._InputTexture, data.source); @@ -1878,7 +1878,7 @@ bool DoCustomPostProcess(RenderGraph renderGraph, HDCamera hdCamera, ref Texture passData.postProcessScales = new Vector4(hdCamera.postProcessRTScales.x, hdCamera.postProcessRTScales.y, hdCamera.postProcessRTScalesHistory.z, hdCamera.postProcessRTScalesHistory.w); passData.postProcessViewportSize = postProcessViewportSize; builder.SetRenderFunc( - (CustomPostProcessData data, UnsafeGraphContext ctx) => + static (CustomPostProcessData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var srcRt = (RTHandle)data.source; @@ -2245,7 +2245,7 @@ TextureHandle DoTemporalAntialiasing(RenderGraph renderGraph, HDCamera hdCamera, PrepareTAAPassData(renderGraph, builder, passData, hdCamera, depthBuffer, motionVectors, depthBufferMipChain, sourceTexture, stencilBuffer, postDoF, outputName); builder.SetRenderFunc( - (TemporalAntiAliasingData data, UnsafeGraphContext ctx) => + static (TemporalAntiAliasingData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); RTHandle source = data.source; @@ -2400,7 +2400,7 @@ TextureHandle SMAAPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle builder.AllowGlobalStateModification(true); builder.SetRenderFunc( - (SMAAData data, UnsafeGraphContext ctx) => + static (SMAAData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); data.smaaMaterial.SetVector(HDShaderIDs._SMAARTMetrics, data.smaaRTMetrics); @@ -3676,7 +3676,7 @@ TextureHandle DepthOfFieldPass(RenderGraph renderGraph, HDCamera hdCamera, Textu passData.farBokehTileList = builder.CreateTransientBuffer(new BufferDesc(dofParameters.threadGroup8.x * dofParameters.threadGroup8.y, sizeof(uint), GraphicsBuffer.Target.Append) { name = "Bokeh Far Tile List" }); builder.SetRenderFunc( - (DepthofFieldData data, UnsafeGraphContext ctx) => + static (DepthofFieldData data, UnsafeGraphContext ctx) => { var mipsHandles = ctx.renderGraphPool.GetTempArray(4); @@ -3730,7 +3730,7 @@ TextureHandle DepthOfFieldPass(RenderGraph renderGraph, HDCamera hdCamera, Textu passData.debugTileClassification = m_CurrentDebugDisplaySettings.data.fullScreenDebugMode == FullScreenDebugMode.DepthOfFieldTileClassification; builder.SetRenderFunc( - (DepthofFieldData data, UnsafeGraphContext ctx) => + static (DepthofFieldData data, UnsafeGraphContext ctx) => { DoPhysicallyBasedDepthOfField(data.parameters, CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.source, data.destination, data.fullresCoC, data.prevCoC, data.nextCoC, data.motionVecTexture, data.pingFarRGB, data.depthBuffer, data.pingNearRGB, data.pongNearRGB, data.pongFarRGB, data.taaEnabled, data.depthMinMaxAvgMSAA, data.apertureShapeTable, data.debugTileClassification); }); @@ -3824,7 +3824,7 @@ void LensFlareComputeOcclusionDataDrivenPass(RenderGraph renderGraph, HDCamera h passData.taaEnabled = taaEnabled; builder.SetRenderFunc( - (LensFlareData data, UnsafeGraphContext ctx) => + static (LensFlareData data, UnsafeGraphContext ctx) => { float width = (float)data.viewport.x; float height = (float)data.viewport.y; @@ -3906,7 +3906,7 @@ void LensFlareMergeOcclusionDataDrivenPass(RenderGraph renderGraph, HDCamera hdC passData.viewport = new Vector2Int(LensFlareCommonSRP.maxLensFlareWithOcclusion, 1); builder.SetRenderFunc( - (LensFlareData data, UnsafeGraphContext ctx) => + static (LensFlareData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.parameters.lensFlareMergeOcclusion, data.parameters.mergeOcclusionKernel, HDShaderIDs._LensFlareOcclusion, LensFlareCommonSRP.occlusionRT); if (data.hdCamera.xr.enabled && data.hdCamera.xr.singlePassEnabled) @@ -3943,7 +3943,7 @@ TextureHandle LensFlareDataDrivenPass(RenderGraph renderGraph, HDCamera hdCamera TextureHandle dest = GetPostprocessUpsampledOutputHandle(hdCamera, renderGraph, "Lens Flare Destination"); builder.SetRenderFunc( - (LensFlareData data, UnsafeGraphContext ctx) => + static (LensFlareData data, UnsafeGraphContext ctx) => { float width = (float)data.viewport.x; float height = (float)data.viewport.y; @@ -4173,7 +4173,7 @@ TextureHandle LensFlareScreenSpacePass(RenderGraph renderGraph, HDCamera hdCamer } builder.SetRenderFunc( - (LensFlareScreenSpaceData data, UnsafeGraphContext ctx) => + static (LensFlareScreenSpaceData data, UnsafeGraphContext ctx) => { float width = (float)data.viewport.x; float height = (float)data.viewport.y; @@ -4527,7 +4527,7 @@ TextureHandle MotionBlurPass(RenderGraph renderGraph, HDCamera hdCamera, Texture PrepareMotionBlurPassData(renderGraph, builder, passData, hdCamera, source, motionVectors, depthTexture); builder.SetRenderFunc( - (MotionBlurData data, UnsafeGraphContext ctx) => + static (MotionBlurData data, UnsafeGraphContext ctx) => { DoMotionBlur(data, CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd)); }); @@ -4661,7 +4661,7 @@ TextureHandle PaniniProjectionPass(RenderGraph renderGraph, HDCamera hdCamera, T builder.UseTexture(passData.destination, AccessFlags.Write); builder.SetRenderFunc( - (PaniniProjectionData data, UnsafeGraphContext ctx) => + static (PaniniProjectionData data, UnsafeGraphContext ctx) => { var cs = data.paniniProjectionCS; int kernel = data.paniniProjectionKernel; @@ -4859,7 +4859,7 @@ TextureHandle BloomPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl PrepareBloomData(renderGraph, builder, passData, hdCamera, source, screenSpaceLensFlareBloomMipBias); builder.SetRenderFunc( - (BloomData data, UnsafeGraphContext ctx) => + static (BloomData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); RTHandle sourceRT = data.source; @@ -5271,7 +5271,7 @@ TextureHandle ColorGradingPass(RenderGraph renderGraph, HDCamera hdCamera) builder.UseTexture(passData.logLut, AccessFlags.Write); builder.SetRenderFunc( - (ColorGradingPassData data, UnsafeGraphContext ctx) => + static (ColorGradingPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var builderCS = data.builderCS; @@ -5628,7 +5628,7 @@ TextureHandle UberPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle builder.UseTexture(passData.destination, AccessFlags.Write); builder.SetRenderFunc( - (UberPostPassData data, UnsafeGraphContext ctx) => + static (UberPostPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Color grading @@ -5722,7 +5722,7 @@ TextureHandle FXAAPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle passData.fxaaCS.EnableKeyword("HDR_INPUT"); builder.SetRenderFunc( - (FXAAData data, UnsafeGraphContext ctx) => + static (FXAAData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeTextureParam(data.fxaaCS, data.fxaaKernel, HDShaderIDs._InputTexture, data.source); ctx.cmd.SetComputeTextureParam(data.fxaaCS, data.fxaaKernel, HDShaderIDs._OutputTexture, data.destination); @@ -5770,7 +5770,7 @@ TextureHandle SharpeningPass(RenderGraph renderGraph, HDCamera hdCamera, Texture CoreUtils.SetKeyword(passData.sharpenCS, "CLAMP_RINGING", hdCamera.taaRingingReduction > 0); builder.SetRenderFunc( - (SharpenData data, UnsafeGraphContext ctx) => + static (SharpenData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); natCmd.SetComputeVectorParam(data.sharpenCS, "_SharpenParams", data.sharpenParam); @@ -5845,7 +5845,7 @@ TextureHandle ContrastAdaptiveSharpeningPass(RenderGraph renderGraph, HDCamera h } builder.SetRenderFunc( - (CASData data, UnsafeGraphContext ctx) => + static (CASData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeFloatParam(data.casCS, HDShaderIDs._Sharpness, 1); ctx.cmd.SetComputeTextureParam(data.casCS, data.mainKernel, HDShaderIDs._InputTexture, data.source); @@ -5920,7 +5920,7 @@ TextureHandle EdgeAdaptiveSpatialUpsampling(RenderGraph renderGraph, HDCamera hd } builder.SetRenderFunc( - (EASUData data, UnsafeGraphContext ctx) => + static (EASUData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var sourceTexture = (RenderTexture)data.source; @@ -6042,7 +6042,7 @@ void FinalPass(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle afterPo } builder.SetRenderFunc( - (FinalPassData data, UnsafeGraphContext ctx) => + static (FinalPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Final pass has to be done in a pixel shader as it will be the one writing straight diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs index de466c82090..60d8b1f4f3d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.Prepass.cs @@ -238,7 +238,7 @@ OccluderPass GetOccluderPass(HDCamera hdCamera) void UpdateInstanceOccluders(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthTexture) { bool isSinglePassXR = hdCamera.xr.enabled && hdCamera.xr.singlePassEnabled; - var occluderParams = new OccluderParameters(hdCamera.camera.GetInstanceID()) + var occluderParams = new OccluderParameters(hdCamera.camera.GetEntityId()) { subviewCount = isSinglePassXR ? 2 : 1, depthTexture = depthTexture, @@ -264,7 +264,7 @@ void InstanceOcclusionTest(RenderGraph renderGraph, HDCamera hdCamera, Occlusion { bool isSinglePassXR = hdCamera.xr.enabled && hdCamera.xr.singlePassEnabled; int subviewCount = isSinglePassXR ? 2 : 1; - var settings = new OcclusionCullingSettings(hdCamera.camera.GetInstanceID(), occlusionTest) + var settings = new OcclusionCullingSettings(hdCamera.camera.GetEntityId(), occlusionTest) { instanceMultiplier = (isSinglePassXR && !SystemInfo.supportsMultiview) ? 2 : 1, }; @@ -470,7 +470,7 @@ void RenderRayTracingDepthPrepass(RenderGraph renderGraph, CullingResults cull, builder.UseRendererList(passData.transparentRenderList); builder.SetRenderFunc( - (RayTracingDepthPrepassData data, UnsafeGraphContext ctx) => + static (RayTracingDepthPrepassData data, UnsafeGraphContext ctx) => { DrawOpaqueRendererList(ctx, data.frameSettings, data.opaqueRenderList); DrawTransparentRendererList(ctx, data.frameSettings, data.transparentRenderList); @@ -601,7 +601,7 @@ bool RenderDepthPrepass(RenderGraph renderGraph, CullingResults cull, uint batch builder.SetRenderAttachment(output.renderingLayersBuffer, 0); builder.SetRenderFunc( - (DrawRendererListPassData data, UnsafeGraphContext ctx) => + static (DrawRendererListPassData data, UnsafeGraphContext ctx) => { DrawOpaqueRendererList(ctx, data.frameSettings, data.rendererList); }); @@ -644,7 +644,7 @@ bool RenderDepthPrepass(RenderGraph renderGraph, CullingResults cull, uint batch } builder.SetRenderFunc( - (DrawRendererListPassData data, UnsafeGraphContext ctx) => + static (DrawRendererListPassData data, UnsafeGraphContext ctx) => { DrawOpaqueRendererList(ctx, data.frameSettings, data.rendererList); }); @@ -704,7 +704,7 @@ void RenderObjectsMotionVectors(RenderGraph renderGraph, CullingResults cull, ui builder.UseRendererList(passData.rendererList); builder.SetRenderFunc( - (DrawRendererListPassData data, UnsafeGraphContext ctx) => + static (DrawRendererListPassData data, UnsafeGraphContext ctx) => { DrawOpaqueRendererList(ctx, data.frameSettings, data.rendererList); }); @@ -766,7 +766,7 @@ void SetupGBufferTargets(RenderGraph renderGraph, HDCamera hdCamera, TextureHand name = "GBuffer2" #if UNITY_2020_2_OR_NEWER , fastMemoryDesc = gbufferFastMemDesc -#endif +#endif }); builder.SetRenderAttachment(prepassOutput.gbuffer.mrt[currentIndex], currentIndex++); prepassOutput.gbuffer.mrt[currentIndex] = renderGraph.CreateTexture( @@ -860,7 +860,7 @@ void RenderGBuffer(RenderGraph renderGraph, TextureHandle sssBuffer, TextureHand passData.dBuffer = ReadDBuffer(prepassOutput.dbuffer, builder); builder.SetRenderFunc( - (GBufferPassData data, UnsafeGraphContext ctx) => + static (GBufferPassData data, UnsafeGraphContext ctx) => { BindDBufferGlobalData(data.dBuffer, ctx); DrawOpaqueRendererList(ctx, data.frameSettings, data.rendererList); @@ -1049,7 +1049,7 @@ void RenderThickness(RenderGraph renderGraph, CullingResults cullingResults, Tex } builder.SetRenderFunc( - (ThicknessPassData data, UnsafeGraphContext ctx) => + static (ThicknessPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); int idx = 0; @@ -1156,7 +1156,7 @@ void ResolvePrepassBuffers(RenderGraph renderGraph, HDCamera hdCamera, ref Prepa } builder.SetRenderFunc( - (ResolvePrepassData data, UnsafeGraphContext ctx) => + static (ResolvePrepassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); data.depthResolveMaterial.SetTexture(HDShaderIDs._NormalTextureMS, data.normalBufferMSAA); @@ -1216,7 +1216,7 @@ void CopyDepthBufferIfNeeded(RenderGraph renderGraph, HDCamera hdCamera, ref Pre output.depthPyramidTexture = passData.outputDepth; builder.SetRenderFunc( - (CopyDepthPassData data, UnsafeGraphContext ctx) => + static (CopyDepthPassData data, UnsafeGraphContext ctx) => { // TODO: maybe we don't actually need the top MIP level? // That way we could avoid making the copy, and build the MIP hierarchy directly. @@ -1273,7 +1273,7 @@ void BuildCoarseStencilAndResolveIfNeeded(RenderGraph renderGraph, HDCamera hdCa passData.resolvedStencil = output.stencilBuffer; builder.SetRenderFunc( - (ResolveStencilPassData data, UnsafeGraphContext ctx) => + static (ResolveStencilPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); if (data.resolveOnly && !data.resolveIsNecessary) @@ -1445,7 +1445,7 @@ void RenderDBuffer(RenderGraph renderGraph, HDCamera hdCamera, ref PrepassOutput builder.AllowGlobalStateModification(true); builder.SetRenderFunc( - (RenderDBufferPassData data, UnsafeGraphContext ctx) => + static (RenderDBufferPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); natCmd.SetGlobalTexture(HDShaderIDs._DecalPrepassTexture, data.decalBuffer); @@ -1511,7 +1511,7 @@ void DecalNormalPatch(RenderGraph renderGraph, HDCamera hdCamera, ref PrepassOut builder.SetRenderAttachmentDepth(passData.depthStencilBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (DBufferNormalPatchData data, UnsafeGraphContext ctx) => + static (DBufferNormalPatchData data, UnsafeGraphContext ctx) => { data.decalNormalBufferMaterial.SetInt(HDShaderIDs._DecalNormalBufferStencilReadMask, data.stencilMask); data.decalNormalBufferMaterial.SetInt(HDShaderIDs._DecalNormalBufferStencilRef, data.stencilRef); @@ -1588,7 +1588,7 @@ void DownsampleDepthForLowResTransparency(RenderGraph renderGraph, HDCamera hdCa builder.SetRenderAttachmentDepth(passData.downsampledDepthBuffer, AccessFlags.Write); builder.SetRenderFunc( - (DownsampleDepthForLowResPassData data, UnsafeGraphContext ctx) => + static (DownsampleDepthForLowResPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); Vector4 scaleBias = Vector4.zero; @@ -1641,7 +1641,7 @@ void GenerateDepthPyramid(RenderGraph renderGraph, HDCamera hdCamera, ref Prepas passData.mipGenerator = m_MipGenerator; builder.SetRenderFunc( - (GenerateDepthPyramidPassData data, UnsafeGraphContext ctx) => + static (GenerateDepthPyramidPassData data, UnsafeGraphContext ctx) => { data.mipGenerator.RenderMinDepthPyramid(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.depthTexture, data.mipInfo); }); @@ -1680,7 +1680,7 @@ void RenderCameraMotionVectors(RenderGraph renderGraph, HDCamera hdCamera, Textu builder.SetRenderAttachment(passData.motionVectorsBuffer, 0); builder.SetRenderFunc( - (CameraMotionVectorsPassData data, UnsafeGraphContext ctx) => + static (CameraMotionVectorsPassData data, UnsafeGraphContext ctx) => { data.cameraMotionVectorsMaterial.SetInt(HDShaderIDs._StencilMask, (int)StencilUsage.ObjectMotionVector); data.cameraMotionVectorsMaterial.SetInt(HDShaderIDs._StencilRef, (int)StencilUsage.ObjectMotionVector); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs index 94f9ddd8122..33d57c6d587 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs @@ -548,7 +548,7 @@ void BlitFinalCameraTexture(RenderGraph renderGraph, HDCamera hdCamera, TextureH } builder.SetRenderFunc( - (FinalBlitPassData data, UnsafeGraphContext ctx) => + static (FinalBlitPassData data, UnsafeGraphContext ctx) => { var propertyBlock = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); RTHandle sourceTexture = data.source; @@ -619,7 +619,7 @@ void UpdateParentExposure(RenderGraph renderGraph, HDCamera hdCamera) builder.AllowPassCulling(false); builder.SetRenderFunc( - (UpdateParentExposureData data, UnsafeGraphContext ctx) => + static (UpdateParentExposureData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); if (data.textures.useFetchedExposure) @@ -690,7 +690,7 @@ void SetFinalTarget(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle de } builder.SetRenderFunc( - (SetFinalTargetPassData data, UnsafeGraphContext ctx) => + static (SetFinalTargetPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // We need to make sure the viewport is correctly set for the editor rendering. It might have been changed by debug overlay rendering just before. @@ -743,7 +743,7 @@ void CopyDepth(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBu passData.flipY = copyForXR; builder.SetRenderFunc( - (CopyXRDepthPassData data, UnsafeGraphContext ctx) => + static (CopyXRDepthPassData data, UnsafeGraphContext ctx) => { var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); @@ -980,7 +980,7 @@ void RenderForwardOpaque(RenderGraph renderGraph, builder.UseTexture(prepassOutput.renderingLayersBuffer, AccessFlags.Read); builder.SetRenderFunc( - (ForwardOpaquePassData data, UnsafeGraphContext ctx) => + static (ForwardOpaquePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); BindGlobalLightListBuffers(data, ctx); @@ -1021,7 +1021,7 @@ void RenderForwardError(RenderGraph renderGraph, builder.UseRendererList(passData.rendererList); builder.SetRenderFunc( - (ForwardPassData data, UnsafeGraphContext ctx) => + static (ForwardPassData data, UnsafeGraphContext ctx) => { ctx.cmd.DrawRendererList(data.rendererList); }); @@ -1064,12 +1064,12 @@ TextureHandle RenderTransparentUI(RenderGraph renderGraph, HDCamera hdCamera, Sc builder.UseRendererList(passData.rendererList); passData.viewport = new Rect(0.0f, 0.0f, hdCamera.finalViewport.width, hdCamera.finalViewport.height); - builder.SetRenderFunc((RenderOffscreenUIData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (RenderOffscreenUIData data, UnsafeGraphContext ctx) => { ctx.cmd.SetViewport(data.viewport); ctx.cmd.ClearRenderTarget(false, true, Color.clear); if (data.camera.targetTexture == null) - ctx.cmd.DrawRendererList(passData.rendererList); + ctx.cmd.DrawRendererList(data.rendererList); }); } } @@ -1123,7 +1123,7 @@ TextureHandle RenderAfterPostProcessObjects(RenderGraph renderGraph, HDCamera hd builder.SetRenderAttachmentDepth(prepassOutput.resolvedDepthBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (AfterPostProcessPassData data, UnsafeGraphContext ctx) => + static (AfterPostProcessPassData data, UnsafeGraphContext ctx) => { // Disable camera jitter. See coment in RestoreNonjitteredMatrices if (data.hdCamera.RequiresCameraJitter()) @@ -1292,7 +1292,7 @@ void RenderForwardTransparent(RenderGraph renderGraph, builder.UseTexture(passData.normalBuffer, AccessFlags.Read); builder.SetRenderFunc( - (ForwardTransparentPassData data, UnsafeGraphContext ctx) => + static (ForwardTransparentPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Bind all global data/parameters for transparent forward pass @@ -1349,7 +1349,7 @@ void RenderTransparentDepthPrepass(RenderGraph renderGraph, HDCamera hdCamera, i } builder.SetRenderFunc( - (ForwardPassData data, UnsafeGraphContext ctx) => + static (ForwardPassData data, UnsafeGraphContext ctx) => { DrawTransparentRendererList(ctx, data.frameSettings, data.rendererList); }); @@ -1370,7 +1370,7 @@ void RenderTransparentDepthPostpass(RenderGraph renderGraph, HDCamera hdCamera, builder.UseRendererList(passData.rendererList); builder.SetRenderFunc( - (ForwardPassData data, UnsafeGraphContext ctx) => + static (ForwardPassData data, UnsafeGraphContext ctx) => { DrawTransparentRendererList(ctx, data.frameSettings, data.rendererList); }); @@ -1404,7 +1404,7 @@ TextureHandle RenderLowResTransparent(RenderGraph renderGraph, HDCamera hdCamera builder.SetRenderAttachment(output, 0); builder.SetRenderFunc( - (RenderLowResTransparentPassData data, UnsafeGraphContext ctx) => + static (RenderLowResTransparentPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); UpdateOffscreenRenderingConstants(ref data.globalCB, true, 1.0f / data.lowResScale); @@ -1460,7 +1460,7 @@ void CombineTransparents(RenderGraph renderGraph, HDCamera hdCamera, TextureHand builder.SetRenderAttachment(colorBuffer, 0); builder.SetRenderFunc( - (CombineTransparentPassData data, UnsafeGraphContext ctx) => + static (CombineTransparentPassData data, UnsafeGraphContext ctx) => { data.upsampleMaterial.SetTexture(HDShaderIDs._BeforeRefraction, data.beforeRefraction); data.upsampleMaterial.SetTexture(HDShaderIDs._BeforeRefractionAlpha, data.beforeRefractionAlpha); @@ -1514,7 +1514,7 @@ void CombineAndUpsampleTransparent(RenderGraph renderGraph, HDCamera hdCamera, T } builder.SetRenderFunc( - (CombineTransparentPassData data, UnsafeGraphContext ctx) => + static (CombineTransparentPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); data.upsampleMaterial.SetVector(HDShaderIDs._Params, data.shaderParams); @@ -1542,7 +1542,7 @@ void SetGlobalColorForCustomPass(RenderGraph renderGraph, TextureHandle colorBuf passData.colorBuffer = colorBuffer; builder.AllowGlobalStateModification(true); builder.UseTexture(passData.colorBuffer, AccessFlags.Read); - builder.SetRenderFunc((SetGlobalColorPassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (SetGlobalColorPassData data, UnsafeGraphContext ctx) => { RTHandle colorPyramid = data.colorBuffer; if (colorPyramid != null) @@ -1588,7 +1588,7 @@ TextureHandle RenderRayTracingFlagMask(RenderGraph renderGraph, CullingResults c builder.UseRendererList(passData.transparentRenderList); builder.SetRenderFunc( - (RayTracingFlagMaskPassData data, UnsafeGraphContext ctx) => + static (RayTracingFlagMaskPassData data, UnsafeGraphContext ctx) => { DrawOpaqueRendererList(ctx, data.frameSettings, data.opaqueRenderList); DrawTransparentRendererList(ctx, data.frameSettings, data.transparentRenderList); @@ -1690,7 +1690,7 @@ TransparentPrepassOutput RenderTransparentPrepass(RenderGraph renderGraph, Culli builder.SetRenderAttachmentDepth(output.resolvedDepthBufferPreRefraction , AccessFlags.Write); builder.SetRenderFunc( - (ResolvePrepassData data, UnsafeGraphContext ctx) => + static (ResolvePrepassData data, UnsafeGraphContext ctx) => { CoreUtils.SetKeyword(ctx.cmd, "_HAS_MOTION_VECTORS", false); data.depthResolveMaterial.SetTexture(HDShaderIDs._DepthTextureMS, data.depthAsColorBufferMSAA); @@ -1885,7 +1885,7 @@ void SendGeometryGraphicsBuffers(RenderGraph renderGraph, TextureHandle inputNor builder.UseTexture(passData.depthBuffer, AccessFlags.Read); builder.SetRenderFunc( - (SendGeometryBuffersPassData data, UnsafeGraphContext ctx) => + static (SendGeometryBuffersPassData data, UnsafeGraphContext ctx) => { var hdCamera = data.parameters.hdCamera; @@ -1967,7 +1967,7 @@ void SendColorGraphicsBuffer(RenderGraph renderGraph, HDCamera hdCamera) passData.hdCamera = hdCamera; builder.SetRenderFunc( - (SendColorGraphicsBufferPassData data, UnsafeGraphContext ctx) => + static (SendColorGraphicsBufferPassData data, UnsafeGraphContext ctx) => { // Figure out which client systems need which buffers VFXCameraBufferTypes neededVFXBuffers = VFXManager.IsCameraBufferNeeded(data.hdCamera.camera); @@ -2000,7 +2000,7 @@ void ClearStencilBuffer(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl builder.UseTexture(passData.depthBuffer, AccessFlags.Write); builder.SetRenderFunc( - (ClearStencilPassData data, UnsafeGraphContext ctx) => + static (ClearStencilPassData data, UnsafeGraphContext ctx) => { data.clearStencilMaterial.SetInt(HDShaderIDs._StencilMask, (int)StencilUsage.HDRPReservedBits); HDUtils.DrawFullScreen(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.clearStencilMaterial, data.depthBuffer); @@ -2078,7 +2078,7 @@ void GenerateColorPyramid(RenderGraph renderGraph, HDCamera hdCamera, TextureHan passData.mipGenerator = m_MipGenerator; builder.SetRenderFunc( - (GenerateColorPyramidData data, UnsafeGraphContext ctx) => + static (GenerateColorPyramidData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); Vector2Int pyramidSize = new Vector2Int(data.hdCamera.actualWidth, data.hdCamera.actualHeight); @@ -2121,7 +2121,7 @@ TextureHandle AccumulateDistortion(RenderGraph renderGraph, passData.distortionRendererList = distortionRendererList; builder.SetRenderFunc( - (AccumulateDistortionPassData data, UnsafeGraphContext ctx) => + static (AccumulateDistortionPassData data, UnsafeGraphContext ctx) => { DrawTransparentRendererList(ctx, data.frameSettings, data.distortionRendererList); }); @@ -2176,7 +2176,7 @@ void RenderDistortion(RenderGraph renderGraph, passData.size = new Vector4(hdCamera.actualWidth, hdCamera.actualHeight, 1f / hdCamera.actualWidth, 1f / hdCamera.actualHeight); builder.SetRenderFunc( - (RenderDistortionPassData data, UnsafeGraphContext ctx) => + static (RenderDistortionPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); if (!data.roughDistortion) @@ -2310,7 +2310,7 @@ TextureHandle ResolveMSAAColor(RenderGraph renderGraph, HDCamera hdCamera, Textu passData.passIndex = SampleCountToPassIndex(hdCamera.msaaSamples); builder.SetRenderFunc( - (ResolveColorData data, UnsafeGraphContext ctx) => + static (ResolveColorData data, UnsafeGraphContext ctx) => { var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); mpb.SetTexture(HDShaderIDs._ColorTextureMS, data.input); @@ -2348,7 +2348,7 @@ TextureHandle ResolveMotionVector(RenderGraph renderGraph, HDCamera hdCamera, Te passData.passIndex = SampleCountToPassIndex(hdCamera.msaaSamples); builder.SetRenderFunc( - (ResolveMotionVectorData data, UnsafeGraphContext ctx) => + static (ResolveMotionVectorData data, UnsafeGraphContext ctx) => { var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); mpb.SetTexture(HDShaderIDs._MotionVectorTextureMS, data.input); @@ -2394,7 +2394,7 @@ void RenderGizmos(RenderGraph renderGraph, HDCamera hdCamera, GizmoSubset gizmoS builder.AllowPassCulling(false); builder.SetRenderFunc( - (RenderGizmosPassData data, UnsafeGraphContext ctx) => + static (RenderGizmosPassData data, UnsafeGraphContext ctx) => { Gizmos.exposure = data.exposureTexture; ctx.cmd.DrawRendererList(data.gizmoRendererList); @@ -2468,7 +2468,7 @@ internal void UpdatePostProcessScreenSize(RenderGraph renderGraph, HDCamera hdCa passData.postProcessHeight = postProcessHeight; builder.SetRenderFunc( - (UpdatePostProcessScreenSizePassData data, UnsafeGraphContext ctx) => + static (UpdatePostProcessScreenSizePassData data, UnsafeGraphContext ctx) => { data.hdCamera.SetPostProcessScreenSize(data.postProcessWidth, data.postProcessHeight); data.hdCamera.UpdateScalesAndScreenSizesCB(ref data.shaderVariablesGlobal); @@ -2494,7 +2494,7 @@ void ResetCameraDataAfterPostProcess(RenderGraph renderGraph, HDCamera hdCamera, builder.AllowPassCulling(false); builder.SetRenderFunc( - (ResetCameraSizeForAfterPostProcessPassData data, UnsafeGraphContext ctx) => + static (ResetCameraSizeForAfterPostProcessPassData data, UnsafeGraphContext ctx) => { var screenSize = new Vector4(data.hdCamera.finalViewport.width, data.hdCamera.finalViewport.height, 1.0f / data.hdCamera.finalViewport.width, 1.0f / data.hdCamera.finalViewport.height); data.shaderVariablesGlobal._ScreenSize = screenSize; @@ -2527,7 +2527,7 @@ void RenderWireOverlay(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle builder.UseRendererList(passData.wireOverlayRendererList); builder.SetRenderFunc( - (RenderWireOverlayPassData data, UnsafeGraphContext ctx) => + static (RenderWireOverlayPassData data, UnsafeGraphContext ctx) => { ctx.cmd.DrawRendererList(data.wireOverlayRendererList); }); @@ -2553,7 +2553,7 @@ void RenderScreenSpaceOverlayUI(RenderGraph renderGraph, HDCamera hdCamera, Text builder.UseRendererList(passData.rendererList); builder.SetRenderFunc( - (RenderScreenSpaceOverlayData data, UnsafeGraphContext ctx) => + static (RenderScreenSpaceOverlayData data, UnsafeGraphContext ctx) => { ctx.cmd.DrawRendererList(data.rendererList); }); @@ -2593,7 +2593,7 @@ void ScreenSpaceFogMultipleScattering(RenderGraph renderGraph, HDCamera hdCamera float finalIntensity = intensity * Mathf.Clamp01(hdCamera.actualHeight / 1080f); passData.intensity = finalIntensity; builder.SetRenderFunc( - (ScreenSpaceFogMultipleScatteringData data, UnsafeGraphContext ctx) => + static (ScreenSpaceFogMultipleScatteringData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // lerp the color buffer and color pyramid using fog opacity factor diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraphUtils.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraphUtils.cs index 49d117b0f71..09947415d74 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraphUtils.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraphUtils.cs @@ -23,7 +23,7 @@ internal static void GenerateMipmaps(RenderGraph renderGraph, TextureHandle text builder.UseTexture(passData.texture, AccessFlags.ReadWrite); builder.SetRenderFunc( - (GenerateMipmapsPassData data, UnsafeGraphContext ctx) => + static (GenerateMipmapsPassData data, UnsafeGraphContext ctx) => { RTHandle tex = data.texture; Debug.Assert(tex.rt.autoGenerateMips == false); @@ -48,7 +48,7 @@ internal static void SetGlobalTexture(RenderGraph renderGraph, int shaderID, Tex passData.texture = texture; builder.SetRenderFunc( - (SetGlobalTexturePassData data, UnsafeGraphContext ctx) => + static (SetGlobalTexturePassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetGlobalTexture(data.shaderID, data.texture); }); @@ -71,7 +71,7 @@ internal static void SetGlobalBuffer(RenderGraph renderGraph, int shaderID, Grap passData.buffer = buffer; builder.SetRenderFunc( - (SetGlobalBufferPassData data, UnsafeGraphContext ctx) => + static (SetGlobalBufferPassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetGlobalBuffer(data.shaderID, data.buffer); }); @@ -165,7 +165,7 @@ internal static void StartXRSinglePass(RenderGraph renderGraph, HDCamera hdCamer builder.AllowPassCulling(false); builder.SetRenderFunc( - (XRRenderingPassData data, UnsafeGraphContext ctx) => + static (XRRenderingPassData data, UnsafeGraphContext ctx) => { data.xr.StartSinglePass(ctx.cmd); }); @@ -184,7 +184,7 @@ internal static void StopXRSinglePass(RenderGraph renderGraph, HDCamera hdCamera builder.AllowPassCulling(false); builder.SetRenderFunc( - (XRRenderingPassData data, UnsafeGraphContext ctx) => + static (XRRenderingPassData data, UnsafeGraphContext ctx) => { data.xr.StopSinglePass(ctx.cmd); }); @@ -216,7 +216,7 @@ void RenderXROcclusionMeshes(RenderGraph renderGraph, HDCamera hdCamera, Texture builder.AllowPassCulling(false); builder.SetRenderFunc( - (RenderOcclusionMeshesPassData data, UnsafeGraphContext ctx) => + static (RenderOcclusionMeshesPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -249,7 +249,7 @@ static internal void BlitCameraTexture(RenderGraph renderGraph, TextureHandle so passData.mipLevel = mipLevel; passData.bilinear = bilinear; builder.SetRenderFunc( - (BlitCameraTextureData data, UnsafeGraphContext ctx) => + static (BlitCameraTextureData data, UnsafeGraphContext ctx) => { Blitter.BlitCameraTexture(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.source, data.destination, data.mipLevel, data.bilinear); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs index e1ccfb3d4d5..9d23982e932 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.SubsurfaceScattering.cs @@ -301,7 +301,7 @@ TextureHandle RenderSubsurfaceScatteringScreenSpace(RenderGraph renderGraph, HDC } builder.SetRenderFunc( - (SubsurfaceScaterringPassData data, UnsafeGraphContext ctx) => + static (SubsurfaceScaterringPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); CoreUtils.SetKeyword(natCmd, "USE_DOWNSAMPLE", data.downsampleSteps > 0); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index a1c16e3eac7..f51c0e5f40d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -706,8 +706,7 @@ public HDRenderPipeline(HDRenderPipelineAsset asset) m_DepthPyramidMipLevelOffsetsBuffer = new ComputeBuffer(15, sizeof(int) * 2); - m_CustomPassColorBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); - m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.None, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: CoreUtils.GetDefaultDepthBufferBits())); + AllocateCustomPassBuffers(); // For debugging MousePositionDebug.instance.Build(); @@ -2265,6 +2264,14 @@ protected override void Render(ScriptableRenderContext renderContext, List(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GetCustomBufferFormat(), enableRandomWrite: true, useDynamicScale: true, name: "CustomPassColorBuffer")); + m_CustomPassDepthBuffer = new Lazy(() => RTHandles.Alloc(Vector2.one, TextureXR.slices, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.None, useDynamicScale: true, name: "CustomPassDepthBuffer", depthBufferBits: CoreUtils.GetDefaultDepthBufferBits())); + } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs index 96c29e131fe..ee6140f1233 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/Core/LineRendering.cs @@ -216,7 +216,7 @@ RendererData[] ImportRenderDatas() countVertexMaxPerRenderer = renderDatas.Max(o => o.mesh.vertexCount), }); - builder.SetRenderFunc((GeometryPassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (GeometryPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -280,7 +280,7 @@ RendererData[] ImportRenderDatas() countWorkQUeue = ComputeWorkQueueCapacity(args.settings.memoryBudget) }); - builder.SetRenderFunc((RasterizationPassData data, ComputeGraphContext ctx) => + builder.SetRenderFunc(static (RasterizationPassData data, ComputeGraphContext ctx) => { ExecuteRasterizationPass(ctx.cmd, data); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/HDRenderPipeline.LineRendering.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/HDRenderPipeline.LineRendering.cs index 30564490ba4..87899750985 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/HDRenderPipeline.LineRendering.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/LineRendering/HDRenderPipeline.LineRendering.cs @@ -126,6 +126,9 @@ class LineRendererCompositeData public TextureHandle lineTargetMV; public float writeDepthAndMovecAlphaTreshold; + public int lineCompositePassColorIndex; + public int lineCompositePassDepthMovecIndex; + public int lineCompositePassAllIndex; } internal static bool LineRenderingIsEnabled(HDCamera hdCamera, out HighQualityLineRenderingVolumeComponent settings) @@ -175,7 +178,7 @@ void RenderLines(RenderGraph renderGraph, TextureHandle depthPrepassTexture, HDC passData.targetMV = m_LineMVBuffer; builder.UseTexture(passData.targetMV, AccessFlags.Write); - builder.SetRenderFunc((LineRendererSetupData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (LineRendererSetupData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -273,8 +276,11 @@ void ComposeLines(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colo passData.lineTargetMV = m_LineMVBuffer; builder.UseTexture(passData.lineTargetMV, AccessFlags.Read); passData.writeDepthAndMovecAlphaTreshold = settings.writeDepthAlphaThreshold.value; + passData.lineCompositePassColorIndex = m_LineCompositePassColorIndex; + passData.lineCompositePassDepthMovecIndex = m_LineCompositePassDepthMovecIndex; + passData.lineCompositePassAllIndex = m_LineCompositePassAllIndex; - builder.SetRenderFunc((LineRendererCompositeData passData, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (LineRendererCompositeData passData, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); passData.compositePass.SetTexture(HDShaderIDs._LineColorTexture, passData.lineTargetColor); @@ -283,12 +289,12 @@ void ComposeLines(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colo passData.compositePass.SetFloat(HDShaderIDs._LineAlphaDepthWriteThreshold, passData.writeDepthAndMovecAlphaTreshold ); if (passData.writeDepthAndMovecAlphaTreshold > 0) { - HDUtils.DrawFullScreen(natCmd, passData.compositePass, new RenderTargetIdentifier[] { passData.mainTargetColor}, passData.mainTargetDepth, null, m_LineCompositePassColorIndex); //color composite - HDUtils.DrawFullScreen(natCmd, passData.compositePass, new RenderTargetIdentifier[] { passData.mainTargetMV }, passData.mainTargetDepth, null, m_LineCompositePassDepthMovecIndex); //depth & movec composite + HDUtils.DrawFullScreen(natCmd, passData.compositePass, new RenderTargetIdentifier[] { passData.mainTargetColor}, passData.mainTargetDepth, null, passData.lineCompositePassColorIndex); //color composite + HDUtils.DrawFullScreen(natCmd, passData.compositePass, new RenderTargetIdentifier[] { passData.mainTargetMV }, passData.mainTargetDepth, null, passData.lineCompositePassDepthMovecIndex); //depth & movec composite } else { - HDUtils.DrawFullScreen(natCmd, passData.compositePass, new RenderTargetIdentifier[] { passData.mainTargetColor, passData.mainTargetMV }, passData.mainTargetDepth, null, m_LineCompositePassAllIndex); //composite all + HDUtils.DrawFullScreen(natCmd, passData.compositePass, new RenderTargetIdentifier[] { passData.mainTargetColor, passData.mainTargetMV }, passData.mainTargetDepth, null, passData.lineCompositePassAllIndex); //composite all } }); } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs index a22091d0856..ceb4eb14f0b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/PathTracing/PathTracing.cs @@ -335,7 +335,7 @@ public void ResetPathTracing() /// Camera for which the accumulation is reset. public void ResetPathTracing(HDCamera hdCamera) { - int camID = hdCamera.camera.GetInstanceID(); + int camID = hdCamera.camera.GetEntityId(); CameraData camData = m_SubFrameManager.GetCameraData(camID); ResetPathTracing(camID, camData); } @@ -417,7 +417,7 @@ private UndoPropertyModification[] OnUndoRecorded(UndoPropertyModification[] mod private void OnSceneGui(SceneView sv) { if (Event.current.type == EventType.MouseDrag) - m_SubFrameManager.Reset(sv.camera.GetInstanceID()); + m_SubFrameManager.Reset(sv.camera.GetEntityId()); } #endif // UNITY_EDITOR @@ -636,7 +636,7 @@ void RenderPathTracingFrame(RenderGraph renderGraph, HDCamera hdCamera, in Camer passData.enableDecals = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals); builder.SetRenderFunc( - (RenderPathTracingData data, UnsafeGraphContext ctx) => + static (RenderPathTracingData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Define the shader pass to use for the path tracing pass @@ -751,7 +751,7 @@ void RenderSkySamplingData(RenderGraph renderGraph, HDCamera hdCamera) builder.UseTexture(passData.outputMarginal, AccessFlags.Write); builder.SetRenderFunc( - (RenderSkySamplingPassData data, UnsafeGraphContext ctx) => + static (RenderSkySamplingPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); natCmd.SetComputeIntParam(data.shader, HDShaderIDs._PathTracingSkyTextureWidth, data.size * 2); @@ -831,7 +831,7 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, ScriptableRenderContext pathTracedAOVs.Clear(); #endif - int camID = hdCamera.camera.GetInstanceID(); + int camID = hdCamera.camera.GetEntityId(); CameraData camData = m_SubFrameManager.GetCameraData(camID); ImportPathTracingTargetsToRenderGraph(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs index a9d590c6d4d..26789b49265 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs @@ -126,7 +126,7 @@ public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, Diffuse builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (DiffuseDenoiserPassData data, UnsafeGraphContext ctx) => + static (DiffuseDenoiserPassData data, UnsafeGraphContext ctx) => { // Generate the point distribution if needed (this is only ran once) if (data.needInit) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseShadowDenoiser.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseShadowDenoiser.cs index 3ebb08448d9..92005c9bd23 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseShadowDenoiser.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseShadowDenoiser.cs @@ -132,7 +132,7 @@ public TextureHandle DenoiseBufferDirectional(RenderGraph renderGraph, HDCamera builder.SetRenderFunc( - (DiffuseShadowDenoiserDirectionalPassData data, UnsafeGraphContext ctx) => + static (DiffuseShadowDenoiserDirectionalPassData data, UnsafeGraphContext ctx) => { // Raise the distance based denoiser keyword CoreUtils.SetKeyword(ctx.cmd, "DISTANCE_BASED_DENOISER", true); @@ -283,7 +283,7 @@ public TextureHandle DenoiseBufferSphere(RenderGraph renderGraph, HDCamera hdCam builder.SetRenderFunc( - (DiffuseShadowDenoiserSpherePassData data, UnsafeGraphContext ctx) => + static (DiffuseShadowDenoiserSpherePassData data, UnsafeGraphContext ctx) => { // Evaluate the dispatch parameters int shadowTileSize = 8; @@ -295,7 +295,7 @@ public TextureHandle DenoiseBufferSphere(RenderGraph renderGraph, HDCamera hdCam // Bind input uniforms for both dispatches ctx.cmd.SetComputeIntParam(data.diffuseShadowDenoiserCS, HDShaderIDs._RaytracingTargetLight, data.properties.lightIndex); - switch(properties.lightType) + switch(data.properties.lightType) { case GPULightType.Spot: { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs index 22a8992cce0..d1cff0abb12 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingLightCluster.cs @@ -253,7 +253,7 @@ public void EvaluateClusterDebugView(RenderGraph renderGraph, HDCamera hdCamera, passData.clusterLightCategory = m_RenderPipeline.m_CurrentDebugDisplaySettings.data.lightClusterCategoryDebug; builder.SetRenderFunc( - (LightClusterDebugPassData data, UnsafeGraphContext ctx) => + static (LightClusterDebugPassData data, UnsafeGraphContext ctx) => { var debugMaterialProperties = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs index 694898524bf..e57a08e1bad 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs @@ -288,7 +288,7 @@ private static AccelerationStructureStatus AddRegularInstanceToRAS(RayTracingAcc // Check if the material has changed since last time we were here if (!materialsDirty) { - materialsDirty |= UpdateMaterialCRC(currentMaterial.GetInstanceID(), currentMaterial.ComputeCRC()); + materialsDirty |= UpdateMaterialCRC(currentMaterial.GetEntityId(), currentMaterial.ComputeCRC()); } } } @@ -369,7 +369,7 @@ private static AccelerationStructureStatus AddVFXInstanceToRAS(RayTracingAcceler // Check if the material has changed since last time we were here if (!materialsDirty) { - materialsDirty |= UpdateMaterialCRC(currentMaterial.GetInstanceID(), currentMaterial.ComputeCRC()); + materialsDirty |= UpdateMaterialCRC(currentMaterial.GetEntityId(), currentMaterial.ComputeCRC()); } } } @@ -667,7 +667,7 @@ internal void BuildRayTracingAccelerationStructure(HDCamera hdCamera) for (int i = 0; i < cullingResults.materialsCRC.Length; i++) { RayTracingInstanceMaterialCRC matCRC = cullingResults.materialsCRC[i]; - m_RTASManager.materialsDirty |= UpdateMaterialCRC(matCRC.instanceID, matCRC.crc); + m_RTASManager.materialsDirty |= UpdateMaterialCRC(matCRC.entityId, matCRC.crc); } } @@ -770,7 +770,7 @@ internal void EvaluateRTASDebugView(RenderGraph renderGraph, HDCamera hdCamera) builder.UseTexture(passData.outputTexture, AccessFlags.Write); builder.SetRenderFunc( - (RTASDebugPassData data, UnsafeGraphContext ctx) => + static (RTASDebugPassData data, UnsafeGraphContext ctx) => { // Define the shader pass to use for the reflection pass ctx.cmd.SetRayTracingShaderPass(data.debugRTASRT, "DebugDXR"); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs index 9b97397cff3..4209edec26e 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDReflectionDenoiser.cs @@ -123,7 +123,7 @@ public TextureHandle DenoiseRTR(RenderGraph renderGraph, HDCamera hdCamera, floa passData.noisyToOutputSignal = lightingTexture; builder.UseTexture(passData.noisyToOutputSignal, AccessFlags.ReadWrite); - builder.SetRenderFunc((ReflectionDenoiserPassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (ReflectionDenoiserPassData data, UnsafeGraphContext ctx) => { // Evaluate the dispatch parameters int tileSize = 8; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs index 4c8f076dfc4..aa159f76ca5 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingAmbientOcclusion.cs @@ -129,7 +129,7 @@ TraceAmbientOcclusionResult TraceAO(RenderGraph renderGraph, HDCamera hdCamera, builder.UseTexture(passData.velocityBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (TraceRTAOPassData data, UnsafeGraphContext ctx) => + static (TraceRTAOPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -241,7 +241,7 @@ TextureHandle ComposeAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl builder.UseTexture(passData.outputTexture, AccessFlags.ReadWrite); builder.SetRenderFunc( - (ComposeRTAOPassData data, UnsafeGraphContext ctx) => + static (ComposeRTAOPassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetComputeFloatParam(data.aoShaderCS, HDShaderIDs._RaytracingAOIntensity, data.intensity); ctx.cmd.SetComputeTextureParam(data.aoShaderCS, data.intensityKernel, HDShaderIDs._AmbientOcclusionTextureRW, data.outputTexture); @@ -274,7 +274,7 @@ static RTHandle RequestAmbientOcclusionHistoryTexture(RenderGraph renderGraph, H builder.UseTexture(passData.aoTexture, AccessFlags.ReadWrite); builder.SetRenderFunc( - (ClearRTAOHistoryData data, UnsafeGraphContext ctx) => + static (ClearRTAOHistoryData data, UnsafeGraphContext ctx) => { CoreUtils.SetRenderTarget(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.aoTexture, clearFlag: ClearFlag.Color, Color.black); }); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingDeferredLightLoop.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingDeferredLightLoop.cs index fd6e2a76634..7b40817b901 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingDeferredLightLoop.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingDeferredLightLoop.cs @@ -299,7 +299,7 @@ RayTracingDefferedLightLoopOutput DeferredLightingRT(RenderGraph renderGraph, passData.enableDecals = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals); builder.SetRenderFunc( - (DeferredLightingRTRPassData data, UnsafeGraphContext ctx) => + static (DeferredLightingRTRPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Compute the input texture dimension diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs index f498e47d2e9..bdb548c0405 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingIndirectDiffuse.cs @@ -150,7 +150,7 @@ TextureHandle DirGenRTGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllum builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (DirGenRTGIPassData data, UnsafeGraphContext ctx) => + static (DirGenRTGIPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Inject the ray-tracing sampling data @@ -237,7 +237,7 @@ TextureHandle UpscaleRTGI(RenderGraph renderGraph, HDCamera hdCamera, GlobalIllu builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (UpscaleRTGIPassData data, UnsafeGraphContext ctx) => + static (UpscaleRTGIPassData data, UnsafeGraphContext ctx) => { // Inject all the parameters for the compute ctx.cmd.SetComputeTextureParam(data.upscaleCS, data.upscaleKernel, HDShaderIDs._DepthTexture, data.depthBuffer); @@ -398,7 +398,7 @@ TextureHandle QualityRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHan passData.enableDecals = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals); builder.SetRenderFunc( - (TraceQualityRTGIPassData data, UnsafeGraphContext ctx) => + static (TraceQualityRTGIPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Define the shader pass to use for the indirect diffuse pass diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs index 6b2900008ce..d5642308283 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingRecursiveRenderer.cs @@ -144,7 +144,7 @@ TextureHandle RaytracingRecursiveRender(RenderGraph renderGraph, HDCamera hdCame passData.enableDecals = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals); builder.SetRenderFunc( - (RecursiveRenderingPassData data, UnsafeGraphContext ctx) => + static (RecursiveRenderingPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Define the shader pass to use for the reflection pass diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs index 9ee426690e3..0be20d84295 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingReflection.cs @@ -168,7 +168,7 @@ TextureHandle DirGenRTR(RenderGraph renderGraph, HDCamera hdCamera, ScreenSpaceR builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (DirGenRTRPassData data, UnsafeGraphContext ctx) => + static (DirGenRTRPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // TODO: check if this is required, i do not think so @@ -266,7 +266,7 @@ TextureHandle AdjustWeightRTR(RenderGraph renderGraph, HDCamera hdCamera, Screen builder.UseTexture(passData.outputTexture, AccessFlags.Write); builder.SetRenderFunc( - (AdjustWeightRTRPassData data, UnsafeGraphContext ctx) => + static (AdjustWeightRTRPassData data, UnsafeGraphContext ctx) => { // Bind all the required scalars to the CB data.shaderVariablesRayTracingCB._RaytracingReflectionMinSmoothness = data.minSmoothness; @@ -334,7 +334,7 @@ TextureHandle UpscaleRTR(RenderGraph renderGraph, HDCamera hdCamera, TextureHand builder.UseTexture(passData.outputTexture, AccessFlags.Write); builder.SetRenderFunc( - (UpscaleRTRPassData data, UnsafeGraphContext ctx) => + static (UpscaleRTRPassData data, UnsafeGraphContext ctx) => { // Input textures ctx.cmd.SetComputeTextureParam(data.reflectionFilterCS, data.upscaleKernel, HDShaderIDs._DepthTexture, data.depthStencilBuffer); @@ -594,7 +594,7 @@ RayTracingReflectionsQualityOutput QualityRTR(RenderGraph renderGraph, HDCamera passData.enableDecals = hdCamera.frameSettings.IsEnabled(FrameSettingsField.Decals); builder.SetRenderFunc( - (TraceQualityRTRPassData data, UnsafeGraphContext ctx) => + static (TraceQualityRTRPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Define the shader pass to use for the reflection pass diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs index e9f66d8e70c..d72b0e6247d 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRenderPipeline.RaytracingSubsurfaceScattering.cs @@ -126,7 +126,7 @@ TextureHandle TraceRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHand builder.UseTexture(passData.outputBuffer, AccessFlags.Write); builder.SetRenderFunc( - (TraceRTSSSPassData data, UnsafeGraphContext ctx) => + static (TraceRTSSSPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Evaluate the dispatch parameters @@ -278,7 +278,7 @@ TextureHandle CombineRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHa builder.UseTexture(passData.colorBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (ComposeRTSSSPassData data, UnsafeGraphContext ctx) => + static (ComposeRTSSSPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Evaluate the dispatch parameters diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs index e21db837a37..ff1ec328f85 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs @@ -144,7 +144,7 @@ public TextureHandle HistoryValidity(RenderGraph renderGraph, HDCamera hdCamera, builder.UseTexture(passData.validationBuffer, AccessFlags.Write); builder.SetRenderFunc( - (HistoryValidityPassData data, UnsafeGraphContext ctx) => + static (HistoryValidityPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); RTHandle historyDepthTexture = data.historyDepthTexture; @@ -274,7 +274,7 @@ internal TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, Tempo builder.UseTexture(passData.outputBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (TemporalFilterPassData data, UnsafeGraphContext ctx) => + static (TemporalFilterPassData data, UnsafeGraphContext ctx) => { // Evaluate the dispatch parameters int areaTileSize = 8; @@ -458,7 +458,7 @@ public TemporalDenoiserArrayOutputData DenoiseBuffer(RenderGraph renderGraph, HD passData.outputDistanceSignal = new TextureHandle(); builder.SetRenderFunc( - (TemporalFilterArrayPassData data, UnsafeGraphContext ctx) => + static (TemporalFilterArrayPassData data, UnsafeGraphContext ctx) => { // Evaluate the dispatch parameters int tfTileSize = 8; diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/ReblurDenoiser.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/ReblurDenoiser.cs index 1ac93388c4b..2462c1a0954 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/ReblurDenoiser.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/ReblurDenoiser.cs @@ -333,7 +333,7 @@ public TextureHandle DenoiseIndirectSpecular(RenderGraph renderGraph, HDCamera h passData.stabilizationHistory = renderGraph.ImportTexture(stabilizationHistory); builder.UseTexture(passData.stabilizationHistory, AccessFlags.ReadWrite); - builder.SetRenderFunc((ReblurIndirectSpecularPassData data, UnsafeGraphContext ctx) => + builder.SetRenderFunc(static (ReblurIndirectSpecularPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/AOV/AOVRequestData.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/AOV/AOVRequestData.cs index 6714526a69c..7f6e0419f7f 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/AOV/AOVRequestData.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/AOV/AOVRequestData.cs @@ -226,7 +226,7 @@ List targets builder.AllowPassCulling(false); builder.SetRenderFunc( - (PushCameraTexturePassData data, UnsafeGraphContext ctx) => + static (PushCameraTexturePassData data, UnsafeGraphContext ctx) => { Blitter.BlitCameraTexture(CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd), data.source, data.target); }); @@ -284,7 +284,7 @@ List targets builder.AllowPassCulling(false); builder.SetRenderFunc( - (PushCustomPassTexturePassData data, UnsafeGraphContext ctx) => + static (PushCustomPassTexturePassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); if (data.customPassSource != null) diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs index 9c21adc7bbc..79ef8444e1b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/DLSSPass.cs @@ -78,7 +78,7 @@ public void Render( #region private members, nvidia specific code #if ENABLE_NVIDIA && ENABLE_NVIDIA_MODULE - private static uint s_ExpectedDeviceVersion = 0x05; + private static uint s_ExpectedDeviceVersion = 0x06; private UpscalerCameras m_CameraStates = new UpscalerCameras(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/UpscalerUtils.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/UpscalerUtils.cs index 1ba70c8bb9d..62613371f22 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/UpscalerUtils.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/UpscalerUtils.cs @@ -18,7 +18,7 @@ public class State : IDisposable public object data; public UInt64 lastFrameId { set; get; } - public static int GetKey(Camera camera) => camera.GetInstanceID(); + public static int GetKey(Camera camera) => camera.GetEntityId(); public void Init(Camera camera) { diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.cs index 6398d886a07..11637641c5b 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture3DAtlas.cs @@ -178,7 +178,7 @@ protected int GetTextureHash(Texture texture) #if UNITY_EDITOR hash = 23 * hash + texture.imageContentsHash.GetHashCode(); #endif - hash = 23 * hash + texture.GetInstanceID().GetHashCode(); + hash = 23 * hash + texture.GetEntityId().GetHashCode(); hash = 23 * hash + texture.graphicsFormat.GetHashCode(); hash = 23 * hash + texture.width.GetHashCode(); hash = 23 * hash + texture.height.GetHashCode(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs index aba1505a238..a5dea7b77a9 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs @@ -387,7 +387,7 @@ void SetGlobalSkyData(RenderGraph renderGraph, SkyUpdateContext skyContext, Buil new BufferDesc(1, System.Runtime.InteropServices.Marshal.SizeOf(typeof(CelestialBodyData)))); builder.SetRenderFunc( - (SetGlobalSkyDataPassData data, UnsafeGraphContext ctx) => + static (SetGlobalSkyDataPassData data, UnsafeGraphContext ctx) => { data.builtinParameters.commandBuffer = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); data.skyRenderer.SetGlobalSkyData(data.builtinParameters.commandBuffer, data.builtinParameters); @@ -799,7 +799,7 @@ void RenderSkyToCubemap(RenderGraph renderGraph, SkyUpdateContext skyContext, HD builder.UseTexture(passData.output, AccessFlags.Write); builder.SetRenderFunc( - (RenderSkyToCubemapPassData data, UnsafeGraphContext ctx) => + static (RenderSkyToCubemapPassData data, UnsafeGraphContext ctx) => { data.builtinParameters.commandBuffer = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -866,7 +866,7 @@ internal void UpdateAmbientProbe(RenderGraph renderGraph, TextureHandle skyCubem passData.callback = callback; builder.SetRenderFunc( - (UpdateAmbientProbePassData data, UnsafeGraphContext ctx) => + static (UpdateAmbientProbePassData data, UnsafeGraphContext ctx) => { if (data.ambientProbeResult != null) ctx.cmd.SetComputeBufferParam(data.computeAmbientProbeCS, data.computeAmbientProbeKernel, s_AmbientProbeOutputBufferParam, data.ambientProbeResult); @@ -933,7 +933,7 @@ void RenderCubemapGGXConvolution(RenderGraph renderGraph, TextureHandle input, C { format = GraphicsFormat.R16G16B16A16_SFloat, dimension = TextureDimension.Cube, useMipMap = true, autoGenerateMips = false, filterMode = FilterMode.Trilinear, name = "SkyboxBSDFIntermediate" }); builder.SetRenderFunc( - (SkyEnvironmentConvolutionPassData data, UnsafeGraphContext ctx) => + static (SkyEnvironmentConvolutionPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); @@ -1361,7 +1361,7 @@ public void PreRenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHand m_CurrentDebugDisplaySettings); builder.SetRenderFunc( - (RenderSkyPassData data, UnsafeGraphContext ctx) => + static (RenderSkyPassData data, UnsafeGraphContext ctx) => { data.builtinParameters.colorBuffer = data.colorBuffer; data.builtinParameters.depthBuffer = data.depthBuffer; @@ -1422,7 +1422,7 @@ public void RenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle m_CurrentDebugDisplaySettings); builder.SetRenderFunc( - (RenderSkyPassData data, UnsafeGraphContext ctx) => + static (RenderSkyPassData data, UnsafeGraphContext ctx) => { data.builtinParameters.colorBuffer = data.colorBuffer; data.builtinParameters.depthBuffer = data.depthBuffer; @@ -1478,7 +1478,7 @@ public void RenderClouds(RenderGraph renderGraph, HDCamera hdCamera, TextureHand passData.builtinParameters.cloudAmbientProbe = cachedContext.renderingContext.cloudAmbientProbeBuffer; builder.SetRenderFunc( - (RenderSkyPassData data, UnsafeGraphContext ctx) => + static (RenderSkyPassData data, UnsafeGraphContext ctx) => { data.builtinParameters.colorBuffer = data.colorBuffer; data.builtinParameters.depthBuffer = data.depthBuffer; @@ -1598,7 +1598,7 @@ public TextureHandle RenderOpaqueAtmosphericScattering(RenderGraph renderGraph, } builder.SetRenderFunc( - (OpaqueAtmosphericScatteringPassData data, UnsafeGraphContext ctx) => + static (OpaqueAtmosphericScatteringPassData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); var mpb = ctx.renderGraphPool.GetTempMaterialPropertyBlock(); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs index 6c766025b68..d070f3a59bb 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Utilities/DiffusionProfileHashTable.cs @@ -82,7 +82,7 @@ public static void UpdateDiffusionProfileHashNow(DiffusionProfileSettings profil // We can't move the asset } // If the asset is not in the list, we regenerate it's hash using the GUID (which leads to the same result every time) - else if (!diffusionProfileHashes.ContainsKey(profile.GetInstanceID())) + else if (!diffusionProfileHashes.ContainsKey(profile.GetEntityId())) { uint newHash = GenerateUniqueHash(profile); if (newHash != profile.profile.hash) @@ -92,7 +92,7 @@ public static void UpdateDiffusionProfileHashNow(DiffusionProfileSettings profil } } else // otherwise, no issue, we don't change the hash and we keep it to check for collisions - diffusionProfileHashes.Add(profile.GetInstanceID(), profile.profile.hash); + diffusionProfileHashes.Add(profile.GetEntityId(), profile.profile.hash); } } } diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Debug.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Debug.cs index 60fb26a1165..8b47680e6f3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Debug.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Debug.cs @@ -65,7 +65,7 @@ internal void RenderWaterDebug(RenderGraph renderGraph, HDCamera hdCamera, Textu // Request the output textures builder.SetRenderFunc( - (WaterRenderingMaskData data, UnsafeGraphContext ctx) => + static (WaterRenderingMaskData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); natCmd.SetGlobalTexture(HDShaderIDs._WaterSectorData, data.sectorDataBuffer); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Underwater.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Underwater.cs index 910ba5bdba7..8ceceaa69d3 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Underwater.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.Underwater.cs @@ -267,7 +267,7 @@ internal void RenderWaterLine(RenderGraph renderGraph, HDCamera hdCamera, Textur passData.reductionSize = m_ReductionSize; builder.SetRenderFunc( - (WaterLineRenderingData data, UnsafeGraphContext ctx) => + static (WaterLineRenderingData data, UnsafeGraphContext ctx) => { // Clear water line buffer ctx.cmd.SetComputeBufferParam(data.underWaterCS, data.clearKernel, HDShaderIDs._WaterLineBufferRW, data.waterLine); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs index 8ba7b0c24f0..dc64aee5828 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/HDRenderPipeline.WaterSystem.cs @@ -1054,7 +1054,7 @@ internal WaterGBuffer RenderWaterGBuffer(RenderGraph renderGraph, CullingResults builder.SetRenderAttachmentDepth(depthBuffer, AccessFlags.ReadWrite); builder.SetRenderFunc( - (WaterGBufferData data, UnsafeGraphContext ctx) => + static (WaterGBufferData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); if (data.decalsEnabled) @@ -1200,7 +1200,7 @@ void PrepareWaterLighting(RenderGraph renderGraph, HDCamera hdCamera, TextureHan builder.UseBuffer(passData.tileBuffer, AccessFlags.Write); builder.SetRenderFunc( - (WaterPrepareLightingData data, UnsafeGraphContext ctx) => + static (WaterPrepareLightingData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); // Clear indirect args @@ -1354,7 +1354,7 @@ internal void RenderWaterLighting(RenderGraph renderGraph, HDCamera hdCamera, // Run the deferred lighting builder.SetRenderFunc( - (WaterRenderingDeferredData data, UnsafeGraphContext ctx) => + static (WaterRenderingDeferredData data, UnsafeGraphContext ctx) => { var natCmd = CommandBufferHelpers.GetNativeCommandBuffer(ctx.cmd); for (int variantIdx = 0; variantIdx < data.parameters.numVariants; ++variantIdx) @@ -1434,7 +1434,7 @@ void WaterRejectionTag(RenderGraph renderGraph, CullingResults cull, HDCamera hd builder.UseRendererList(passData.opaqueRendererList); builder.SetRenderFunc( - (WaterExclusionPassData data, UnsafeGraphContext ctx) => + static (WaterExclusionPassData data, UnsafeGraphContext ctx) => { ctx.cmd.SetGlobalInteger(HDShaderIDs._StencilWriteMaskStencilTag, (int)StencilUsage.WaterExclusion); ctx.cmd.SetGlobalInteger(HDShaderIDs._StencilRefMaskStencilTag, (int)StencilUsage.WaterExclusion); diff --git a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/WaterDecal/WaterDecal.cs b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/WaterDecal/WaterDecal.cs index b484492171f..02353dc6437 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/WaterDecal/WaterDecal.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Runtime/Water/WaterDecal/WaterDecal.cs @@ -112,7 +112,7 @@ internal bool IsValidMaterial() internal int GetMaterialAtlasingId() { // If material has a property block, we can't reuse the atlas slot - return HasPropertyBlock() ? GetInstanceID(): material.GetInstanceID(); + return HasPropertyBlock() ? GetEntityId(): material.GetEntityId(); } #endregion diff --git a/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/ProbeCameraCacheTest.cs b/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/ProbeCameraCacheTest.cs index ab447ba6787..ebd77a19a05 100644 --- a/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/ProbeCameraCacheTest.cs +++ b/Packages/com.unity.render-pipelines.high-definition/Tests/Editor/Utilities/ProbeCameraCacheTest.cs @@ -17,13 +17,13 @@ public void GetOrCreate_And_Dispose_Works() var sameCamera = cache.GetOrCreate(0, 0); Assert.IsNotNull(sameCamera); Assert.True(ReferenceEquals(camera, sameCamera)); - Assert.AreEqual(camera.GetInstanceID(), sameCamera.GetInstanceID()); + Assert.AreEqual(camera.GetEntityId(), sameCamera.GetEntityId()); // Get another camera var otherCamera = cache.GetOrCreate(1, 0); Assert.IsNotNull(otherCamera); Assert.False(ReferenceEquals(camera, otherCamera)); - Assert.AreNotEqual(camera.GetInstanceID(), otherCamera.GetInstanceID()); + Assert.AreNotEqual(camera.GetEntityId(), otherCamera.GetEntityId()); // Clear the cameras cache.Dispose(); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/Light2DEditor.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/Light2DEditor.cs index 900aac1bd01..04ffda3cf10 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/Light2DEditor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/Light2DEditor.cs @@ -313,7 +313,7 @@ void OnEnable() internal void SendModifiedAnalytics(Analytics.Renderer2DAnalytics analytics, Light2D light) { - Analytics.LightDataAnalytic lightData = new Analytics.LightDataAnalytic(light.GetInstanceID(), false, light.lightType); + Analytics.LightDataAnalytic lightData = new Analytics.LightDataAnalytic(light.GetEntityId(), false, light.lightType); Analytics.Renderer2DAnalytics.instance.SendData(lightData); } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DDataEditor.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DDataEditor.cs index ced1ddbee80..7a35e6e7926 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DDataEditor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DDataEditor.cs @@ -79,7 +79,7 @@ void SendModifiedAnalytics(Analytics.IAnalytics analytics) { if (m_WasModified) { - Analytics.RenderAssetAnalytic modifiedData = new Analytics.RenderAssetAnalytic(m_Renderer2DData.GetInstanceID(), false, 0, 0); + Analytics.RenderAssetAnalytic modifiedData = new Analytics.RenderAssetAnalytic(m_Renderer2DData.GetEntityId(), false, 0, 0); analytics.SendData(modifiedData); } } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs index f5614e03e86..5b820c95531 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/Renderer2DMenus.cs @@ -113,7 +113,7 @@ static Light2D CreateLight(MenuCommand menuCommand, Light2D.LightType type, Vect var parent = menuCommand.context as GameObject; Place(go, parent); - Analytics.LightDataAnalytic lightData = new Analytics.LightDataAnalytic(light2D.GetInstanceID(), true, light2D.lightType); + Analytics.LightDataAnalytic lightData = new Analytics.LightDataAnalytic(light2D.GetEntityId(), true, light2D.lightType); Analytics.Renderer2DAnalytics.instance.SendData(lightData); return light2D; @@ -208,7 +208,7 @@ static void Create2DRendererData() { Renderer2DMenus.Create2DRendererData((instance) => { - Analytics.RenderAssetAnalytic modifiedData = new Analytics.RenderAssetAnalytic(instance.GetInstanceID(), true, 1, 2); + Analytics.RenderAssetAnalytic modifiedData = new Analytics.RenderAssetAnalytic(instance.GetEntityId(), true, 1, 2); Analytics.Renderer2DAnalytics.instance.SendData(modifiedData); }); } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteNormalPass.hlsl b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteNormalPass.hlsl index 27e4957eee7..dc7e96bf0c3 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteNormalPass.hlsl +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Includes/SpriteNormalPass.hlsl @@ -3,6 +3,9 @@ PackedVaryings vert(Attributes input) { Varyings output = (Varyings)0; + UNITY_SETUP_INSTANCE_ID(input); + + SetUpSpriteInstanceProperties(); input.positionOS = UnityFlipSprite(input.positionOS, unity_SpriteProps.xy); output = BuildVaryings(input); output.color *= unity_SpriteColor; diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Nodes/SpriteSkinningNode.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Nodes/SpriteSkinningNode.cs index 33bedac0e30..c9a8e716d99 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Nodes/SpriteSkinningNode.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Nodes/SpriteSkinningNode.cs @@ -7,21 +7,13 @@ namespace UnityEditor.ShaderGraph { [Title("Input", "Mesh Deformation", "Sprite Skinning")] - class SpriteSkinningNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireVertexSkinning, IMayRequirePosition, IMayRequireNormal, IMayRequireTangent + class SpriteSkinningNode : AbstractMaterialNode, IGeneratesBodyCode, IGeneratesFunction, IMayRequireVertexSkinning, IMayRequirePosition { public const int kPositionSlotId = 0; - public const int kNormalSlotId = 1; - public const int kTangentSlotId = 2; public const int kPositionOutputSlotId = 3; - public const int kNormalOutputSlotId = 4; - public const int kTangentOutputSlotId = 5; public const string kSlotPositionName = "Vertex Position"; - public const string kSlotNormalName = "Vertex Normal"; - public const string kSlotTangentName = "Vertex Tangent"; public const string kOutputSlotPositionName = "Skinned Position"; - public const string kOutputSlotNormalName = "Skinned Normal"; - public const string kOutputSlotTangentName = "Skinned Tangent"; public SpriteSkinningNode() { @@ -33,12 +25,8 @@ public SpriteSkinningNode() public sealed override void UpdateNodeAfterDeserialization() { AddSlot(new PositionMaterialSlot(kPositionSlotId, kSlotPositionName, kSlotPositionName, CoordinateSpace.Object, ShaderStageCapability.Vertex)); - AddSlot(new NormalMaterialSlot(kNormalSlotId, kSlotNormalName, kSlotNormalName, CoordinateSpace.Object, ShaderStageCapability.Vertex)); - AddSlot(new TangentMaterialSlot(kTangentSlotId, kSlotTangentName, kSlotTangentName, CoordinateSpace.Object, ShaderStageCapability.Vertex)); AddSlot(new Vector3MaterialSlot(kPositionOutputSlotId, kOutputSlotPositionName, kOutputSlotPositionName, SlotType.Output, Vector3.zero, ShaderStageCapability.Vertex)); - AddSlot(new Vector3MaterialSlot(kNormalOutputSlotId, kOutputSlotNormalName, kOutputSlotNormalName, SlotType.Output, Vector3.zero, ShaderStageCapability.Vertex)); - AddSlot(new Vector3MaterialSlot(kTangentOutputSlotId, kOutputSlotTangentName, kOutputSlotTangentName, SlotType.Output, Vector3.zero, ShaderStageCapability.Vertex)); - RemoveSlotsNameNotMatching(new[] { kPositionSlotId, kNormalSlotId, kTangentSlotId, kPositionOutputSlotId, kNormalOutputSlotId, kTangentOutputSlotId }); + RemoveSlotsNameNotMatching(new[] { kPositionSlotId, kPositionOutputSlotId }); } bool IsSpriteSubTarget() @@ -91,22 +79,6 @@ public NeededCoordinateSpace RequiresPosition(ShaderStageCapability stageCapabil return NeededCoordinateSpace.None; } - public NeededCoordinateSpace RequiresNormal(ShaderStageCapability stageCapability = ShaderStageCapability.All) - { - if (stageCapability == ShaderStageCapability.Vertex || stageCapability == ShaderStageCapability.All) - return NeededCoordinateSpace.Object; - else - return NeededCoordinateSpace.None; - } - - public NeededCoordinateSpace RequiresTangent(ShaderStageCapability stageCapability = ShaderStageCapability.All) - { - if (stageCapability == ShaderStageCapability.Vertex || stageCapability == ShaderStageCapability.All) - return NeededCoordinateSpace.Object; - else - return NeededCoordinateSpace.None; - } - public override void CollectShaderProperties(PropertyCollector properties, GenerationMode generationMode) { base.CollectShaderProperties(properties, generationMode); @@ -117,23 +89,16 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo if (generationMode.IsPreview() || !IsSpriteSubTarget()) { sb.AppendLine("$precision3 {0} = 0;", GetVariableNameForSlot(kPositionOutputSlotId)); - sb.AppendLine("$precision3 {0} = 0;", GetVariableNameForSlot(kNormalOutputSlotId)); - sb.AppendLine("$precision3 {0} = 0;", GetVariableNameForSlot(kTangentOutputSlotId)); } else { sb.AppendLine("$precision3 {0} = {1};", GetVariableNameForSlot(kPositionOutputSlotId), GetSlotValue(kPositionSlotId, generationMode)); - sb.AppendLine("$precision3 {0} = {1};", GetVariableNameForSlot(kNormalOutputSlotId), GetSlotValue(kNormalSlotId, generationMode)); - sb.AppendLine("$precision3 {0} = {1};", GetVariableNameForSlot(kTangentOutputSlotId), GetSlotValue(kTangentSlotId, generationMode)); sb.AppendLine($"{GetFunctionName()}(" + $"IN.BoneIndices, " + $"IN.BoneWeights, " + $"{GetSlotValue(kPositionSlotId, generationMode)}, " + - $"{GetSlotValue(kNormalSlotId, generationMode)}, " + - $"{GetSlotValue(kTangentSlotId, generationMode)}, " + $"{GetVariableNameForSlot(kPositionOutputSlotId)}, " + - $"{GetVariableNameForSlot(kNormalOutputSlotId)}, " + - $"{GetVariableNameForSlot(kTangentOutputSlotId)}, unity_SpriteProps.z);"); + $"unity_SpriteProps.z);"); } } @@ -145,19 +110,14 @@ public void GenerateNodeFunction(FunctionRegistry registry, GenerationMode gener "uint4 indices, " + "$precision4 weights, " + "$precision3 positionIn, " + - "$precision3 normalIn, " + - "$precision3 tangentIn, " + "out $precision3 positionOut, " + - "out $precision3 normalOut, " + - "out $precision3 tangentOut, in float offset)"); + "in float offset)"); sb.AppendLine("{"); using (sb.IndentScope()) { if (generationMode.IsPreview() || !IsSpriteSubTarget()) { sb.AppendLine("positionOut = positionIn;"); - sb.AppendLine("normalOut = normalIn;"); - sb.AppendLine("tangentOut = tangentIn;"); } else { @@ -166,8 +126,6 @@ public void GenerateNodeFunction(FunctionRegistry registry, GenerationMode gener using (sb.IndentScope()) { sb.AppendLine("positionOut = UnitySkinSprite(positionIn, indices, weights, offset, 1.0f );"); - sb.AppendLine("normalOut = UnitySkinSprite(normalIn, indices, weights, offset, 0 );"); - sb.AppendLine("tangentOut = UnitySkinSprite(tangentIn, indices, weights, offset, 0 );"); } sb.AppendLine("}"); sb.AppendLine("#else"); @@ -175,8 +133,6 @@ public void GenerateNodeFunction(FunctionRegistry registry, GenerationMode gener using (sb.IndentScope()) { sb.AppendLine("positionOut = positionIn;"); - sb.AppendLine("normalOut = normalIn;"); - sb.AppendLine("tangentOut = tangentIn;"); } sb.AppendLine("}"); sb.AppendLine("#endif"); diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/Universal2DSubTargetDescriptors.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/Universal2DSubTargetDescriptors.cs index bdb5955cfa4..a1d6fd3eee3 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/Universal2DSubTargetDescriptors.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/Universal2DSubTargetDescriptors.cs @@ -27,6 +27,8 @@ internal static class RenderStateCollections { RenderState.Cull(Cull.Back) }, { RenderState.Stencil(new StencilDescriptor() { Ref = "128", + ReadMask = "127", + WriteMask = "128", Comp = "Always", Pass = "Replace", })}, diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs index 6ea3d606033..24f5e85e858 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteCustomLitSubTarget.cs @@ -159,6 +159,7 @@ public static PassDescriptor Normal(UniversalTarget target) renderStates = target.sort3DAs2DCompatible ? Universal2DSubTargetDescriptors.RenderStateCollections.Sort3DAs2DCompatible : CoreRenderStates.Default, pragmas = CorePragmas._2DDefault, defines = new DefineCollection(), + keywords = SpriteCustomLitKeywords.Normal, includes = target.sort3DAs2DCompatible ? UniversalMeshLitInfo.Includes.Normal : SpriteCustomLitIncludes.Normal, // Custom Interpolator Support @@ -284,6 +285,11 @@ static class SpriteCustomLitKeywords { CoreKeywordDescriptors.UseSkinnedSprite }, }; + public static KeywordCollection Normal = new KeywordCollection + { + { CoreKeywordDescriptors.UseSkinnedSprite }, + }; + public static KeywordCollection Forward = new KeywordCollection { { CoreKeywordDescriptors.DebugDisplay }, diff --git a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs index 9ac3fa8e090..e508428815b 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/2D/ShaderGraph/Targets/UniversalSpriteLitSubTarget.cs @@ -182,6 +182,7 @@ public static PassDescriptor Normal(UniversalTarget target) renderStates = target.sort3DAs2DCompatible ? Universal2DSubTargetDescriptors.RenderStateCollections.Sort3DAs2DCompatible : CoreRenderStates.Default, pragmas = CorePragmas._2DDefault, defines = new DefineCollection(), + keywords = SpriteLitKeywords.Normal, includes = target.sort3DAs2DCompatible ? UniversalMeshLitInfo.Includes.Normal : SpriteLitIncludes.Normal, // Custom Interpolator Support @@ -303,6 +304,11 @@ static class SpriteLitKeywords { CoreKeywordDescriptors.UseSkinnedSprite }, }; + public static KeywordCollection Normal = new KeywordCollection + { + { CoreKeywordDescriptors.UseSkinnedSprite }, + }; + public static KeywordCollection Forward = new KeywordCollection { { CoreKeywordDescriptors.DebugDisplay }, diff --git a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUISubTarget.cs b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUISubTarget.cs index fe6a61cbae9..d86aad86f18 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUISubTarget.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/ShaderGraph/Targets/UniversalUISubTarget.cs @@ -84,10 +84,10 @@ public override PassDescriptor GenerateUIPassDescriptor(bool isSRP) result.Add(RenderState.Blend(Blend.One, Blend.OneMinusSrcAlpha, Blend.One, Blend.OneMinusSrcAlpha)); break; case AlphaMode.Additive: - result.Add(RenderState.Blend(Blend.SrcAlpha, Blend.One, Blend.One, Blend.One)); + result.Add(RenderState.Blend(Blend.SrcAlpha, Blend.One, Blend.One, Blend.OneMinusSrcAlpha)); break; case AlphaMode.Multiply: - result.Add(RenderState.Blend(Blend.DstColor, Blend.OneMinusSrcAlpha, Blend.Zero, Blend.One)); + result.Add(RenderState.Blend(Blend.DstColor, Blend.Zero, Blend.Zero, Blend.One)); break; } diff --git a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRendererDataEditor.cs b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRendererDataEditor.cs index 3f5299f742b..50a3190c48f 100644 --- a/Packages/com.unity.render-pipelines.universal/Editor/UniversalRendererDataEditor.cs +++ b/Packages/com.unity.render-pipelines.universal/Editor/UniversalRendererDataEditor.cs @@ -42,7 +42,8 @@ private static class Styles public static readonly GUIContent defaultStencilStateLabel = EditorGUIUtility.TrTextContent("Default Stencil State", "Configure the stencil state for the opaque and transparent render passes."); public static readonly GUIContent shadowTransparentReceiveLabel = EditorGUIUtility.TrTextContent("Transparent Receive Shadows", "When disabled, none of the transparent objects will receive shadows."); public static readonly GUIContent invalidStencilOverride = EditorGUIUtility.TrTextContent("Error: When using the deferred rendering path, the Renderer requires the control over the 4 highest bits of the stencil buffer to store Material types. The current combination of the stencil override options prevents the Renderer from controlling the required bits. Try changing one of the options to Replace."); - public static readonly GUIContent intermediateTextureMode = EditorGUIUtility.TrTextContent("Intermediate Texture", "Controls when URP renders via an intermediate texture."); + public static readonly GUIContent intermediateTextureMode = EditorGUIUtility.TrTextContent("Intermediate Texture (Obsolete)", "Should be set to Auto. Controls when URP renders via an intermediate texture."); + public static readonly GUIContent warningIntermediateTextureMode = EditorGUIUtility.TrTextContent("'Always' is Obsolete. Change it to Auto. This can improve performance. The setting will disappear once it is corrected to 'Auto'."); public static readonly GUIContent deferredPlusIncompatibleWarning = EditorGUIUtility.TrTextContent("Deferred+ is only available with Render Graph. In compatibility mode, Deferred+ falls back to Forward+."); } @@ -263,13 +264,18 @@ public override void OnInspectorGUI() EditorGUI.indentLevel--; EditorGUILayout.Space(); - EditorGUILayout.LabelField("Compatibility", EditorStyles.boldLabel); - EditorGUI.indentLevel++; + //Hide the obsolete setting if the value is Auto. This is the only valid setting from now. Users that still have it at Always can still see it and change it to Auto. + if( m_IntermediateTextureMode.enumValueIndex != 0) { - EditorGUILayout.PropertyField(m_IntermediateTextureMode, Styles.intermediateTextureMode); + EditorGUILayout.LabelField("Compatibility", EditorStyles.boldLabel); + EditorGUI.indentLevel++; + { + EditorGUILayout.PropertyField(m_IntermediateTextureMode, Styles.intermediateTextureMode); + EditorGUILayout.HelpBox(Styles.warningIntermediateTextureMode.text, MessageType.Warning); + } + EditorGUI.indentLevel--; + EditorGUILayout.Space(); } - EditorGUI.indentLevel--; - EditorGUILayout.Space(); serializedObject.ApplyModifiedProperties(); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data.meta b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data.meta deleted file mode 100644 index 26a85017b70..00000000000 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e0c762e8dad9af640925a542761eb35a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures.meta b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures.meta deleted file mode 100644 index cc178fb5874..00000000000 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fea15e5ce57d36d489e00e9111e1c9ae -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures/FalloffLookupTexture.png b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures/FalloffLookupTexture.png deleted file mode 100644 index 048656222c1..00000000000 Binary files a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures/FalloffLookupTexture.png and /dev/null differ diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures/FalloffLookupTexture.png.meta b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures/FalloffLookupTexture.png.meta deleted file mode 100644 index a1fc702fac5..00000000000 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Data/Textures/FalloffLookupTexture.png.meta +++ /dev/null @@ -1,120 +0,0 @@ -fileFormatVersion: 2 -guid: 5688ab254e4c0634f8d6c8e0792331ca -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 11 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapU: 1 - wrapV: 1 - wrapW: 1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 0 - platformSettings: - - serializedVersion: 3 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 4 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 4 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 3 - buildTarget: Windows Store Apps - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: 4 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spritePackingTag: - pSDRemoveMatte: 0 - pSDShowRemoveMatteOption: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Light2D.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Light2D.cs index 3ee0b4fcdd4..3d77a64b56c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Light2D.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Light2D.cs @@ -182,7 +182,7 @@ private enum ComponentVersions int m_BatchSlotIndex = 0; internal int batchSlotIndex { get { return m_BatchSlotIndex; } set { m_BatchSlotIndex = value; } } - private int lightCookieSpriteInstanceID => lightCookieSprite?.GetInstanceID() ?? 0; + private int lightCookieSpriteInstanceID => lightCookieSprite?.GetEntityId() ?? EntityId.None; internal bool useCookieSprite => (lightType == LightType.Point || lightType == LightType.Sprite) && (lightCookieSprite != null && lightCookieSprite.texture != null); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/CopyCameraSortingLayerPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/CopyCameraSortingLayerPass.cs index 57bfad80571..3a596ec74e9 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/CopyCameraSortingLayerPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/CopyCameraSortingLayerPass.cs @@ -64,7 +64,7 @@ public void Render(RenderGraph graph, ContextContainer frameData) builder.UseTexture(passData.source); builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { Execute(context.cmd, data.source); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs index 6ef2abb06e7..0e57d261dd9 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawLight2DPass.cs @@ -209,7 +209,7 @@ internal void Render(RenderGraph graph, ContextContainer frameData, int batchInd passData.lightTextureIndex = i; - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { Execute(context.cmd, data, data.layerBatch, data.lightTextureIndex); }); @@ -232,7 +232,7 @@ internal void Render(RenderGraph graph, ContextContainer frameData, int batchInd for (var i = 0; i < lightTextures.Length; i++) builder.SetRenderAttachment(lightTextures[i], i); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { for (var i = 0; i < data.layerBatch.activeBlendStylesIndices.Length; ++i) Execute(context.cmd, data, data.layerBatch, i); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawNormal2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawNormal2DPass.cs index 17a1b37d4c0..2c66a936cc5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawNormal2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawNormal2DPass.cs @@ -62,7 +62,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex passData.rendererList = graph.CreateRendererList(param); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { Execute(context.cmd, data); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs index cdd7cae77d2..359156f4704 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawRenderer2DPass.cs @@ -121,7 +121,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((SetGlobalPassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (SetGlobalPassData data, RasterGraphContext context) => { }); } @@ -187,7 +187,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex if (nextBatch < universal2DResourceData.lightTextures.Length) SetGlobalLightTextures(graph, builder, frameData, nextBatch, isLitView); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { Execute(context, data); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawShadow2DPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawShadow2DPass.cs index 60a55054b95..5d985a8ebe9 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawShadow2DPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/DrawShadow2DPass.cs @@ -64,7 +64,7 @@ public void Render(RenderGraph graph, ContextContainer frameData, int batchIndex builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext context) => { for (int i = 0; i < data.layerBatch.shadowIndices.Count; ++i) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/GlobalPropertiesPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/GlobalPropertiesPass.cs index d25d7585667..e29bab78274 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/GlobalPropertiesPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/GlobalPropertiesPass.cs @@ -41,7 +41,7 @@ internal static void Setup(RenderGraph graph, ContextContainer frameData, bool u builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { if (data.screenParams != Vector2Int.zero) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/UpscalePass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/UpscalePass.cs index 1ffbaa1eb5a..e45564211b2 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/UpscalePass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Rendergraph/UpscalePass.cs @@ -67,7 +67,7 @@ public void Render(RenderGraph graph, Camera camera, in TextureHandle cameraColo builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.source); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowProvider/ShadowMesh2D.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowProvider/ShadowMesh2D.cs index a0c9a165228..2ff85eca9ee 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowProvider/ShadowMesh2D.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/Shadows/ShadowProvider/ShadowMesh2D.cs @@ -320,7 +320,7 @@ public override void SetShape(NativeArray vertices, NativeArray in { if (AreDegenerateVertices(vertices) || indices == null || indices.Length == 0) { - m_Mesh.Clear(); + m_Mesh?.Clear(); return; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/URP2D_GraphicsExtensions.cs b/Packages/com.unity.render-pipelines.universal/Runtime/2D/URP2D_GraphicsExtensions.cs new file mode 100644 index 00000000000..4de8027b452 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/URP2D_GraphicsExtensions.cs @@ -0,0 +1,38 @@ +using UnityEngine; + +namespace UnityEngine.Rendering.Universal +{ + /// + /// Class URP2D_GraphicsExtensions provides additional functions to extend built in graphics classes in URP2D + /// + public static class URP2D_GraphicsExtensions + { + /// + /// Gets the SpriteMaskInteraction state for MeshRenderer + /// + /// The instance to query. + /// Returns the SpriteMaskInteraction + public static SpriteMaskInteraction GetSpriteMaskInteraction(this MeshRenderer meshRenderer) { return meshRenderer.Internal_GetSpriteMaskInteraction(); } + + /// + /// Gets the SpriteMaskInteraction state for SkinnedMeshRenderer + /// + /// The instance to query. + /// Returns the SpriteMaskInteraction + public static SpriteMaskInteraction GetSpriteMaskInteraction(this SkinnedMeshRenderer skinnedMeshRenderer) { return skinnedMeshRenderer.Internal_GetSpriteMaskInteraction(); } + + /// + /// Sets the SpriteMaskInteraction state for SkinnedMeshRenderer + /// + /// The instance to modify. + /// The mask interaction state to set. + public static void SetSpriteMaskInteraction(this MeshRenderer meshRenderer, SpriteMaskInteraction maskInteraction) { meshRenderer.Internal_SetSpriteMaskInteraction(maskInteraction); } + + /// + /// Sets the SpriteMaskInteraction state for SkinnedMeshRenderer + /// + /// The instance to modify. + /// The mask interaction state to set. + public static void SetSpriteMaskInteraction(this SkinnedMeshRenderer skinnedMeshRenderer, SpriteMaskInteraction maskInteraction) { skinnedMeshRenderer.Internal_SetSpriteMaskInteraction(maskInteraction); } + } +} diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/2D/URP2D_GraphicsExtensions.cs.meta b/Packages/com.unity.render-pipelines.universal/Runtime/2D/URP2D_GraphicsExtensions.cs.meta new file mode 100644 index 00000000000..002f7c35532 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Runtime/2D/URP2D_GraphicsExtensions.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9d9379906932aeb42948429db294542e \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs index 05c90eb8f21..71a76fd3f72 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Data/UniversalRenderPipelineAsset.cs @@ -300,8 +300,9 @@ public enum ColorGradingMode } /// - /// Defines if Unity discards or stores the render targets of the DrawObjects Passes. Selecting the Store option significantly increases the memory bandwidth on mobile and tile-based GPUs. + /// Obsolete from 6000.3. /// + [Obsolete("#from(6000.0) #breakingFrom(6000.4)", true)] public enum StoreActionsOptimization { /// Unity uses the Discard option by default, and falls back to the Store option if it detects any injected Passes. @@ -575,8 +576,8 @@ public partial class UniversalRenderPipelineAsset : RenderPipelineAsset m_SupportsTerrainHoles; /// - /// Returns the active store action optimization value. + /// Obsolete from 6000.0. /// /// Returns the active store action optimization value. + [Obsolete("#from(6000.0) #breakingFrom(6000.4)", true)] public StoreActionsOptimization storeActionsOptimization { get => m_StoreActionsOptimization; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferDepthCopyPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferDepthCopyPass.cs index 6b6802001a5..9642a4b242f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferDepthCopyPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferDepthCopyPass.cs @@ -36,7 +36,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer if (!hasCompatibleDepth) { //Here we assume that when using depth priming, there is no prepass to the cameraDepthTexture but a copy, so that the texture is a color format. - var source = (useDepthPriming) ? resourceData.cameraDepth : resourceData.cameraDepthTexture; + var source = (useDepthPriming || universalRenderer.usesDeferredLighting) ? resourceData.cameraDepth : resourceData.cameraDepthTexture; Debug.Assert(source.IsValid(), "DBufferCopyDepthPass needs a valid cameraDepth or cameraDepth texture to copy from. You might be using depth priming, with MSAA and direct to backbuffer rendering, which is not supported."); Debug.Assert(GraphicsFormatUtility.IsDepthFormat(source.GetDescriptor(renderGraph).format), "DBufferCopyDepthPass assumes source has a depth format."); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs index 2e3cd33e486..b0d36283ac3 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DBufferRenderPass.cs @@ -164,7 +164,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { SetKeywords(rgContext.cmd, data); ExecutePass(rgContext.cmd, data, data.rendererList, true); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DecalForwardEmissivePass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DecalForwardEmissivePass.cs index 48dd314c7a7..e601b385b58 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DecalForwardEmissivePass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DBuffer/DecalForwardEmissivePass.cs @@ -74,7 +74,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.SetRenderAttachment(resourceData.activeColorTexture, 0, AccessFlags.Write); builder.SetRenderAttachmentDepth(resourceData.activeDepthTexture, AccessFlags.Read); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { ExecutePass(rgContext.cmd, data, data.rendererList); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalPreviewPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalPreviewPass.cs index 8944503ba51..0e8114f9c35 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalPreviewPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/DecalPreviewPass.cs @@ -55,7 +55,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.rendererList = renderGraph.CreateRendererList(param); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { ExecutePass(rgContext.cmd, data, data.rendererList); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs index a98bc6d2776..0d908674510 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalGBufferRenderPass.cs @@ -123,7 +123,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { ExecutePass(rgContext.cmd, data, data.rendererList); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs index c39b4161b6f..40322518f27 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Decal/ScreenSpace/DecalScreenSpaceRenderPass.cs @@ -123,7 +123,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { RenderingUtils.SetScaleBiasRt(rgContext.cmd, in data.cameraData, data.colorTarget); ExecutePass(rgContext.cmd, data, data.rendererList); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/DeferredLights.cs b/Packages/com.unity.render-pipelines.universal/Runtime/DeferredLights.cs index 0308b05d64f..4ab5e97816b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/DeferredLights.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/DeferredLights.cs @@ -320,7 +320,7 @@ internal void SetupRenderGraphLights(RenderGraph renderGraph, UniversalCameraDat builder.AllowPassCulling(false); - builder.SetRenderFunc((SetupLightPassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (SetupLightPassData data, UnsafeGraphContext rgContext) => { data.deferredLights.SetupLights(CommandBufferHelpers.GetNativeCommandBuffer(rgContext.cmd), data.cameraData, data.cameraTargetSizeCopy, data.lightData, true); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Deprecated.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Deprecated.cs index e08751d6bb2..92df847674f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Deprecated.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Deprecated.cs @@ -14,35 +14,6 @@ public abstract partial class ScriptableRenderPass /// Use this CommandBuffer to cleanup any generated data. [EditorBrowsable(EditorBrowsableState.Never)] public virtual void FrameCleanup(CommandBuffer cmd) => OnCameraCleanup(cmd); - - - /// - /// This method is obsolete. - /// - [Obsolete("This method is obsolete.")] - public virtual void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) - { } - - /// - /// This method is obsolete. - /// - [Obsolete("This method is obsolete.")] - public virtual void Execute(ScriptableRenderContext context, ref RenderingData renderingData) - { } - - /// - /// This method is obsolete. - /// - [Obsolete("This method is obsolete.")] - public virtual void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData) - { } - - /// - /// This method is obsolete. - /// - [Obsolete("This method is obsolete.")] - public void ConfigureClear(ClearFlag clearFlag, Color clearColor) - { } } namespace Internal @@ -232,17 +203,7 @@ public IntermediateTextureMode intermediateTextureMode public abstract partial class ScriptableRenderer { - // Deprecated in 10.x - /// - /// The render target identifier for camera depth. - /// This is obsolete, cameraDepth has been renamed to cameraDepthTarget. - /// - [Obsolete("cameraDepth has been renamed to cameraDepthTarget. #from(2021.1) #breakingFrom(2023.1) (UnityUpgradable) -> cameraDepthTarget", true)] - [EditorBrowsable(EditorBrowsableState.Never)] - public RenderTargetIdentifier cameraDepth - { - get => m_CameraDepthTarget.nameID; - } + } public abstract partial class ScriptableRendererData diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ForwardLights.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ForwardLights.cs index aacb2c9ff08..a48c611e092 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ForwardLights.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ForwardLights.cs @@ -186,6 +186,8 @@ out float4 viewToViewportScaleBias /// but also in unit testing. ///
internal static JobHandle ScheduleClusteringJobs( + bool hasMainLight, + bool supportsAdditionalLights, NativeArray lights, NativeArray probes, NativeArray zBins, @@ -207,7 +209,7 @@ internal static JobHandle ScheduleClusteringJobs( out int wordsPerTile ) { - localLightCount = lights.Length; + localLightCount = supportsAdditionalLights ? lights.Length: 0; // The lights array first has directional lights, and then local lights. We traverse the list to find the // index of the first local light. var firstLocalLightIdx = 0; @@ -217,8 +219,18 @@ out int wordsPerTile } localLightCount -= firstLocalLightIdx; - // If there's 1 or more directional lights, one of them must be the main light - directionalLightCount = firstLocalLightIdx > 0 ? firstLocalLightIdx - 1 : 0; + // If there's 1 or more directional lights, one of them could be the main light + if (firstLocalLightIdx > 0) + { + + directionalLightCount = firstLocalLightIdx; + if (hasMainLight) + directionalLightCount -= 1; + } + else + { + directionalLightCount = 0; + } var localLights = lights.GetSubArray(firstLocalLightIdx, localLightCount); @@ -404,6 +416,8 @@ internal void PreSetup(UniversalRenderingData renderingData, UniversalCameraData var viewToClips = new Fixed2(cameraData.GetProjectionMatrix(0), cameraData.GetProjectionMatrix(math.min(1, viewCount - 1))); m_CullingHandle = ScheduleClusteringJobs( + lightData.mainLightIndex != -1, + lightData.supportsAdditionalLights, lightData.visibleLights, renderingData.cullResults.visibleReflectionProbes, m_ZBins, @@ -452,7 +466,7 @@ internal void SetupRenderGraphLights(RenderGraph renderGraph, UniversalRendering builder.AllowPassCulling(false); - builder.SetRenderFunc((SetupLightPassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (SetupLightPassData data, UnsafeGraphContext rgContext) => { data.forwardLights.SetupLights(rgContext.cmd, data.renderingData, data.cameraData, data.lightData); }); @@ -649,12 +663,13 @@ void SetupAdditionalLightConstants(UnsafeCommandBuffer cmd, ref CullingResults c int additionalLightsCount = SetupPerObjectLightIndices(cullResults, lightData); if (additionalLightsCount > 0) { + int mainLight = lightData.mainLightIndex; if (m_UseStructuredBuffer) { NativeArray additionalLightsData = new NativeArray(additionalLightsCount, Allocator.Temp); for (int i = 0, lightIter = 0; i < lights.Length && lightIter < maxAdditionalLightsCount; ++i) { - if (lightData.mainLightIndex != i) + if (mainLight != i) { ShaderInput.LightData data; InitializeLightConstants(lights, i, supportsLightLayers, @@ -681,7 +696,7 @@ void SetupAdditionalLightConstants(UnsafeCommandBuffer cmd, ref CullingResults c { for (int i = 0, lightIter = 0; i < lights.Length && lightIter < maxAdditionalLightsCount; ++i) { - if (lightData.mainLightIndex != i) + if (mainLight != i) { InitializeLightConstants( lights, diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/Universal2DResourceData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/Universal2DResourceData.cs index da8fa938434..967d9d868ff 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/Universal2DResourceData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/Universal2DResourceData.cs @@ -1,12 +1,11 @@ -using System; using UnityEngine.Rendering.RenderGraphModule; namespace UnityEngine.Rendering.Universal { /// - /// Class that holds settings related to texture resources. + /// Class that holds settings related to texture resources for the 2D renderer. /// - internal class Universal2DResourceData : UniversalResourceDataBase + public class Universal2DResourceData : UniversalResourceDataBase { TextureHandle[][] CheckAndGetTextureHandle(ref TextureHandle[][] handle) { @@ -28,35 +27,50 @@ void CheckAndSetTextureHandle(ref TextureHandle[][] handle, TextureHandle[][] ne handle[i] = newHandle[i]; } - internal TextureHandle[][] lightTextures + /// + /// Light textures per sorting layer. Written to by the Light2D pass. + /// + public TextureHandle[][] lightTextures { get => CheckAndGetTextureHandle(ref _lightTextures); set => CheckAndSetTextureHandle(ref _lightTextures, value); } private TextureHandle[][] _lightTextures = new TextureHandle[0][]; - internal TextureHandle[] normalsTexture + /// + /// Normal textures per sorting layer. Written to by the Normal pass. + /// + public TextureHandle[] normalsTexture { get => CheckAndGetTextureHandle(ref _cameraNormalsTexture); set => CheckAndSetTextureHandle(ref _cameraNormalsTexture, value); } private TextureHandle[] _cameraNormalsTexture = new TextureHandle[0]; - internal TextureHandle normalsDepth + /// + /// Normal depth texture. Written to by the Normal pass. + /// + public TextureHandle normalsDepth { get => CheckAndGetTextureHandle(ref _normalsDepth); set => CheckAndSetTextureHandle(ref _normalsDepth, value); } private TextureHandle _normalsDepth; - internal TextureHandle[][] shadowTextures + /// + /// Shadow textures per sorting layer. Written to by the Light2D pass. + /// + public TextureHandle[][] shadowTextures { get => CheckAndGetTextureHandle(ref _shadowTextures); set => CheckAndSetTextureHandle(ref _shadowTextures, value); } private TextureHandle[][] _shadowTextures = new TextureHandle[0][]; - internal TextureHandle shadowDepth + /// + /// Shadow depth texture. Written to by the Shadow pass. + /// + public TextureHandle shadowDepth { get => CheckAndGetTextureHandle(ref _shadowDepth); set => CheckAndSetTextureHandle(ref _shadowDepth, value); @@ -70,7 +84,10 @@ internal TextureHandle upscaleTexture } private TextureHandle _upscaleTexture; - internal TextureHandle cameraSortingLayerTexture + /// + /// Camera Sorting Layer Texture. Written to by the CopyCameraSortingLayerPass pass. + /// + public TextureHandle cameraSortingLayerTexture { get => CheckAndGetTextureHandle(ref _cameraSortingLayerTexture); set => CheckAndSetTextureHandle(ref _cameraSortingLayerTexture, value); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs index 84c1fdb4605..e38caeb3e7d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/FrameData/UniversalResourceData.cs @@ -39,7 +39,7 @@ public TextureHandle activeColorTexture /// /// Switch the active color and depth texture to the backbuffer. Once switched, isActiveTargetBackBuffer will return true. /// The activeColorTexture and activeDepthTexture will then return the backbuffer. This should be called after a render pass - /// that blits/copies the cameraColor to the backbuffer is recorded in the render graph. The following passes will then + /// that blits/copies the cameraColor to the backbuffer is recorded in the render graph. The following passes will then /// automatically use the backbuffer as active color and depth. URP will not add the final blit pass if this method is called before /// that render pass. /// @@ -241,6 +241,10 @@ public TextureHandle internalColorLut } private TextureHandle _internalColorLut; + /// + /// Bloom. A glow for very bright highlights. Written to by the Bloom pass. Additively composited in the Uber pass. + /// It does not contain bloom specific alpha information and can be considered as a premultiplied alpha texture for advanced compositing. + /// internal TextureHandle bloom { get => CheckAndGetTextureHandle(ref _bloom); @@ -334,7 +338,7 @@ internal TextureHandle stpDebugView private TextureHandle _stpDebugView; //Due to camera stacking, we sometimes need to set a specific (persistent) target texture as destination. - //We cannot create an RG managed texture for the destination in that case as output/destination. + //We cannot create an RG managed texture for the destination in that case as output/destination. //If we woulnd't have camera stacking, then the backbuffer would be the only other persistent destination. //The usage of this destination is currently limited to the Uberpost processing pass. internal TextureHandle destinationCameraColor diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs index 6762336f3fe..6507b71a1a1 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/LightCookieManager.cs @@ -86,8 +86,8 @@ private struct LightCookieMapping if (d == 0) { // Sort by texture ID if "undecided" to batch fetches to the same cookie texture. - int ai = alc.GetInstanceID(); - int bi = blc.GetInstanceID(); + int ai = alc.GetEntityId(); + int bi = blc.GetEntityId(); return ai - bi; } return d; @@ -633,7 +633,7 @@ uint ComputeCookieRequestPixelCount(ref WorkSlice validLight { var lcm = validLightMappings[i]; Texture cookie = lcm.light.cookie; - int cookieID = cookie.GetInstanceID(); + int cookieID = cookie.GetEntityId(); // Consider only unique textures as atlas request pixels // NOTE: relies on same cookies being sorted together diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs index 52b00fc619d..ae941941cfe 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs @@ -943,7 +943,7 @@ internal TextureHandle Render(RenderGraph graph, ContextContainer frameData) if (shadowTexture.IsValid()) builder.SetGlobalTextureAfterPass(shadowTexture, AdditionalShadowsConstantBuffer._AdditionalLightsShadowmapID); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { RasterCommandBuffer rasterCommandBuffer = context.cmd; if (!data.emptyShadowmap) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs index d546667f5d5..1067501a9ef 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CapturePass.cs @@ -42,7 +42,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer // Setup up the builder builder.AllowPassCulling(false); builder.UseTexture(resourceData.cameraColor); - builder.SetRenderFunc((UnsafePassData data, UnsafeGraphContext unsafeContext) => + builder.SetRenderFunc(static (UnsafePassData data, UnsafeGraphContext unsafeContext) => { var nativeCommandBuffer = CommandBufferHelpers.GetNativeCommandBuffer(unsafeContext.cmd); var captureActions = data.captureActions; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs index 244d5b501f4..c23eb0d6eb6 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyColorPass.cs @@ -216,7 +216,7 @@ private void AddDownsampleAndCopyColorRenderPass(RenderGraph renderGraph, in Tex builder.SetGlobalTextureAfterPass(destination, Shader.PropertyToID("_CameraOpaqueTexture")); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.source, data.useProceduralBlit); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs index b2580f64bb2..6d4bade9a37 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/CopyDepthPass.cs @@ -271,7 +271,7 @@ public void Render(RenderGraph renderGraph, TextureHandle destination, TextureHa builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { bool yflip = context.GetTextureUVOrigin(in data.source) != context.GetTextureUVOrigin(in data.destination); ExecutePass(context.cmd, data, data.source, yflip); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs index 4df68f9df43..dfe9f0f73b5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DeferredPass.cs @@ -71,7 +71,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { data.deferredLights.ExecuteDeferredPass(context.cmd, data.cameraData, data.lightData, data.shadowData); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs index 6ae6f6677f3..cefc96f514e 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthNormalOnlyPass.cs @@ -17,6 +17,8 @@ public partial class DepthNormalOnlyPass : ScriptableRenderPass // Statics private static readonly List k_DepthNormals = new List { new ShaderTagId("DepthNormals"), new ShaderTagId("DepthNormalsOnly") }; + private static readonly List k_DepthNormalsOnly = new List { new ShaderTagId("DepthNormalsOnly") }; + internal static readonly string k_CameraNormalsTextureName = "_CameraNormalsTexture"; private static readonly int s_CameraDepthTextureID = Shader.PropertyToID("_CameraDepthTexture"); private static readonly int s_CameraNormalsTextureID = Shader.PropertyToID(k_CameraNormalsTextureName); @@ -120,8 +122,17 @@ private RendererListParams InitRendererListParams(UniversalRenderingData renderi return new RendererListParams(renderingData.cullResults, drawSettings, m_FilteringSettings); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, TextureHandle cameraNormalsTexture, TextureHandle cameraDepthTexture, TextureHandle renderingLayersTexture, uint batchLayerMask, bool setGlobalDepth, bool setGlobalTextures) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle cameraNormalsTexture, in TextureHandle depthTexture, in TextureHandle renderingLayersTexture, uint batchLayerMask, bool setGlobalDepth, bool setGlobalNormalAndRenderingLayers, bool allowPartialPass) { + if (allowPartialPass) + { + this.shaderTagIds = k_DepthNormalsOnly; + } + else + { + this.shaderTagIds = k_DepthNormals; + } + UniversalRenderingData renderingData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); UniversalLightData lightData = frameData.Get(); @@ -129,7 +140,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { builder.SetRenderAttachment(cameraNormalsTexture, 0, AccessFlags.Write); - builder.SetRenderAttachmentDepth(cameraDepthTexture, AccessFlags.ReadWrite); + builder.SetRenderAttachmentDepth(depthTexture, AccessFlags.ReadWrite); passData.enableRenderingLayers = enableRenderingLayers; @@ -153,7 +164,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur } } - if (setGlobalTextures) + if (setGlobalNormalAndRenderingLayers) { builder.SetGlobalTextureAfterPass(cameraNormalsTexture, s_CameraNormalsTextureID); @@ -162,12 +173,12 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur } if (setGlobalDepth) - builder.SetGlobalTextureAfterPass(cameraDepthTexture, s_CameraDepthTextureID); + builder.SetGlobalTextureAfterPass(depthTexture, s_CameraDepthTextureID); // Required here because of RenderingLayerUtils.SetupProperties builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { RenderingLayerUtils.SetupProperties(context.cmd, data.maskSize); ExecutePass(context.cmd, data, data.rendererList); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs index ffe91a574b1..69894d85f51 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DepthOnlyPass.cs @@ -73,7 +73,7 @@ private RendererListParams InitRendererListParams(UniversalRenderingData renderi return new RendererListParams(renderingData.cullResults, drawSettings, m_FilteringSettings); } - internal void Render(RenderGraph renderGraph, ContextContainer frameData, ref TextureHandle cameraDepthTexture, uint batchLayerMask, bool setGlobalDepth) + internal void Render(RenderGraph renderGraph, ContextContainer frameData, in TextureHandle depthTexture, uint batchLayerMask, bool setGlobalDepth) { UniversalRenderingData renderingData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); @@ -86,10 +86,10 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, ref Te passData.rendererList = renderGraph.CreateRendererList(param); builder.UseRendererList(passData.rendererList); - builder.SetRenderAttachmentDepth(cameraDepthTexture, AccessFlags.ReadWrite); + builder.SetRenderAttachmentDepth(depthTexture, AccessFlags.ReadWrite); if (setGlobalDepth) - builder.SetGlobalTextureAfterPass(cameraDepthTexture, s_CameraDepthTextureID); + builder.SetGlobalTextureAfterPass(depthTexture, s_CameraDepthTextureID); builder.AllowGlobalStateModification(true); if (cameraData.xr.enabled) @@ -102,7 +102,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, ref Te } } - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.rendererList); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs index 9eadc1adfd9..6f6969c2ad5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawObjectsPass.cs @@ -302,7 +302,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur #endif } - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { // Currently we only need to call this additional pass when the user // doesn't want transparent objects to receive shadows @@ -421,7 +421,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur } } - builder.SetRenderFunc((RenderingLayersPassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (RenderingLayersPassData data, RasterGraphContext context) => { // Enable Rendering Layers context.cmd.SetKeyword(ShaderGlobalKeywords.WriteRenderingLayers, true); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs index 78782b7013f..013c0b37ff5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawScreenSpaceUIPass.cs @@ -134,7 +134,7 @@ internal void RenderOffscreen(RenderGraph renderGraph, ContextContainer frameDat if (output.IsValid()) builder.SetGlobalTextureAfterPass(output, ShaderPropertyId.overlayUITexture); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.rendererList); }); @@ -151,7 +151,7 @@ internal void RenderOffscreen(RenderGraph renderGraph, ContextContainer frameDat passData.rendererList = renderGraph.CreateUIOverlayRendererList(cameraData.camera, UISubset.LowLevel); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((UnsafePassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (UnsafePassData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(data.colorTarget); ExecutePass(context.cmd, data, data.rendererList); @@ -177,7 +177,7 @@ internal void RenderOverlay(RenderGraph renderGraph, ContextContainer frameData, passData.rendererList = renderGraph.CreateUIOverlayRendererList(cameraData.camera, UISubset.UIToolkit_UGUI); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.rendererList); }); @@ -194,7 +194,7 @@ internal void RenderOverlay(RenderGraph renderGraph, ContextContainer frameData, passData.rendererList = renderGraph.CreateUIOverlayRendererList(cameraData.camera, UISubset.LowLevel); builder.UseRendererList(passData.rendererList); - builder.SetRenderFunc((UnsafePassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (UnsafePassData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(data.colorTarget); ExecutePass(context.cmd, data, data.rendererList); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs index ace645a9a60..85e2f64f57b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/DrawSkyboxPass.cs @@ -115,7 +115,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Script } } - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.xr, data.skyRendererListHandle); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs index e80cb8082f1..62681361765 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/FinalBlitPass.cs @@ -197,7 +197,7 @@ override public void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { data.blitMaterialData.material.enabledKeywords = null; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs index 3eab752f673..1dac9a8f512 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/GBufferPass.cs @@ -172,7 +172,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data, data.rendererListHdl, data.objectsWithErrorRendererListHdl); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs index 581d3ebfdbe..1bec4cc3762 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/HDRDebugViewPass.cs @@ -171,7 +171,7 @@ internal void RenderHDRDebug(RenderGraph renderGraph, UniversalCameraData camera passData.passThrough = intermediateRT; builder.UseTexture(intermediateRT, AccessFlags.Write); - builder.SetRenderFunc((PassDataCIExy data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (PassDataCIExy data, UnsafeGraphContext context) => { ExecuteCIExyPrepass(CommandBufferHelpers.GetNativeCommandBuffer(context.cmd), data, data.srcColor, data.xyBuffer, data.passThrough); }); @@ -201,7 +201,7 @@ internal void RenderHDRDebug(RenderGraph renderGraph, UniversalCameraData camera builder.UseTexture(overlayUITexture); } - builder.SetRenderFunc((PassDataDebugView data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassDataDebugView data, RasterGraphContext context) => { data.material.enabledKeywords = null; Vector4 scaleBias = RenderingUtils.GetFinalBlitScaleBias(in context, in data.srcColor, in data.dstColor); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs index f1bd1fdf9b5..3615900d1b6 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/InvokeOnRenderObjectCallbackPass.cs @@ -25,10 +25,12 @@ internal void Render(RenderGraph renderGraph, TextureHandle colorTarget, Texture { using (var builder = renderGraph.AddUnsafePass(passName, out var passData, profilingSampler)) { + passData.colorTarget = colorTarget; builder.UseTexture(colorTarget, AccessFlags.Write); + passData.depthTarget = depthTarget; builder.UseTexture(depthTarget, AccessFlags.Write); builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(data.colorTarget, data.depthTarget); context.cmd.InvokeOnRenderObjectCallbacks(); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs index 6149bd16a93..45ad05f4fb1 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MainLightShadowCasterPass.cs @@ -412,7 +412,7 @@ internal TextureHandle Render(RenderGraph graph, ContextContainer frameData) if (shadowTexture.IsValid()) builder.SetGlobalTextureAfterPass(shadowTexture, MainLightShadowConstantBuffer._MainLightShadowmapID); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { RasterCommandBuffer rasterCommandBuffer = context.cmd; if (!data.emptyShadowmap) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs index de405fb5f15..c12e5c54574 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/MotionVectorRenderPass.cs @@ -182,7 +182,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur if (motionVectorDepth.IsValid()) builder.SetGlobalTextureAfterPass(motionVectorDepth, Shader.PropertyToID(k_MotionVectorDepthTextureName)); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { if (data.cameraMaterial != null) data.cameraMaterial.SetTexture(s_CameraDepthTextureID, data.cameraDepth); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs index 1647590ddb6..572ea5087a0 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/BloomPostProcessPass.cs @@ -4,7 +4,7 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class BloomPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class BloomPostProcessPass : PostProcessPass { public const int k_MaxPyramidSize = 16; @@ -18,15 +18,6 @@ internal sealed class BloomPostProcessPass : ScriptableRenderPass, IDisposable bool m_IsValid; - // Settings - public Bloom bloom { get; set; } - - // Input - public TextureHandle sourceTexture {get; set;} - - // Output - public TextureHandle destinationTexture { get; private set; } // Bloom destination is a mip pyramid, hard to set the exact destination texture without an extra blit. - public BloomMipPyramid mipPyramid => m_MipPyramid; public BloomPostProcessPass(Shader shader) @@ -50,19 +41,13 @@ public BloomPostProcessPass(Shader shader) m_MipPyramid = new BloomMipPyramid(k_MaxPyramidSize); } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); for(int i = 0; i < k_MaxPyramidSize; i++) CoreUtils.Destroy(m_MaterialPyramid[i]); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; - } - private class BloomPassData { internal Material material; @@ -75,11 +60,16 @@ private class BloomPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for BloomPostProcessPass."); + if (!m_IsValid) + return; + UniversalResourceData resourceData = frameData.Get(); UniversalCameraData cameraData = frameData.Get(); - var srcDesc = sourceTexture.GetDescriptor(renderGraph); + var sourceTexture = resourceData.cameraColor; + var sourceDesc = sourceTexture.GetDescriptor(renderGraph); + + var bloom = volumeStack.GetComponent(); // Setup // Materials are set up beforehand. @@ -87,7 +77,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer // They should remain unchanged between graph build and execution. using(new ProfilingScope(ProfilingSampler.Get(URPProfileId.RG_BloomSetup))) { - m_MipPyramid.Update(renderGraph, bloom, in srcDesc); + m_MipPyramid.Update(renderGraph, bloom, in sourceDesc); int mipCount = m_MipPyramid.mipCount; // Pre-filtering parameters @@ -144,14 +134,14 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer switch (bloom.filter.value) { case BloomFilterMode.Dual: - destinationTexture = BloomDual(renderGraph, sourceTexture); + resourceData.bloom = BloomDual(renderGraph, sourceTexture); break; case BloomFilterMode.Kawase: - destinationTexture = BloomKawase(renderGraph, sourceTexture); + resourceData.bloom = BloomKawase(renderGraph, sourceTexture); break; case BloomFilterMode.Gaussian: goto default; default: - destinationTexture = BloomGaussian(renderGraph, sourceTexture); + resourceData.bloom = BloomGaussian(renderGraph, sourceTexture); break; } } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs index 8e4a141fc62..98dea3778c2 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldBokehProcessPass.cs @@ -4,8 +4,11 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class DepthOfFieldBokehPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class DepthOfFieldBokehPostProcessPass : PostProcessPass { + public const string k_TargetName = "_DoFTarget"; + const int k_DownSample = 2; + Material m_Material; bool m_IsValid; @@ -16,15 +19,7 @@ internal sealed class DepthOfFieldBokehPostProcessPass : ScriptableRenderPass, I float m_BokehMaxRadius; float m_BokehRcpAspect; - // Settings - public DepthOfField depthOfField { get; set; } - public bool useFastSRGBLinearConversion { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } + bool m_UseFastSRGBLinearConversion; public DepthOfFieldBokehPostProcessPass(Shader shader) { @@ -35,15 +30,16 @@ public DepthOfFieldBokehPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public void Setup(bool useFastSRGBLinearConversion) { - return m_IsValid; + m_UseFastSRGBLinearConversion = useFastSRGBLinearConversion; } private class DoFBokehPassData @@ -71,17 +67,20 @@ private class DoFBokehPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for DepthOfFieldBokehPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for DepthOfFieldBokehPostProcessPass."); + if (!m_IsValid) + return; UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); + var depthOfField = volumeStack.GetComponent(); + + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); var srcDesc = sourceTexture.GetDescriptor(renderGraph); - int downSample = 2; - int wh = srcDesc.width / downSample; - int hh = srcDesc.height / downSample; + int wh = srcDesc.width / k_DownSample; + int hh = srcDesc.height / k_DownSample; // Pass Textures var fullCoCTextureDesc = PostProcessUtils.GetCompatibleDescriptor(srcDesc, srcDesc.width, srcDesc.height, Experimental.Rendering.GraphicsFormat.R8_UNorm); @@ -115,13 +114,13 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer depthOfField.bladeRotation.value, maxRadius, rcpAspect); } - float uvMargin = (1.0f / srcDesc.height) * downSample; + float uvMargin = (1.0f / srcDesc.height) * k_DownSample; passData.bokehKernel = m_BokehKernel; - passData.downSample = downSample; + passData.downSample = k_DownSample; passData.uvMargin = uvMargin; passData.cocParams = new Vector4(P, maxCoC, maxRadius, rcpAspect); - passData.useFastSRGBLinearConversion = useFastSRGBLinearConversion; + passData.useFastSRGBLinearConversion = m_UseFastSRGBLinearConversion; passData.enableAlphaOutput = cameraData.isAlphaOutputEnabled; // Inputs @@ -163,7 +162,6 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer dofMat.SetVector(ShaderConstants._DownSampleScaleFactor, new Vector4(1.0f / data.downSample, 1.0f / data.downSample, data.downSample,data.downSample)); dofMat.SetVector(ShaderConstants._BokehConstants, new Vector4(data.uvMargin, data.uvMargin * 2.0f)); dofMat.SetVector(ShaderConstants._SourceSize, sourceSize); - //PostProcessUtils.SetGlobalShaderSourceSize(cmd, data.sourceTexture); CoreUtils.SetKeyword(dofMat, ShaderKeywordStrings.UseFastSRGBLinearConversion, data.useFastSRGBLinearConversion); CoreUtils.SetKeyword(dofMat, ShaderKeywordStrings._ENABLE_ALPHA_OUTPUT, data.enableAlphaOutput); @@ -203,6 +201,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } }); } + + resourceData.cameraColor = destinationTexture; } static void PrepareBokehKernel(ref Vector4[] bokehKernel, int bladeCount, float bladeCurvature, float bladeRotation, float maxRadius, float rcpAspect) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs index c68fd8a209a..85113d6fb5d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/DepthOfFieldGaussianPostProcessPass.cs @@ -5,9 +5,10 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class DepthOfFieldGaussianPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class DepthOfFieldGaussianPostProcessPass : PostProcessPass { public const string k_TargetName = "_DoFTarget"; + const int k_DownSample = 2; Material m_Material; Material m_MaterialCoc; @@ -15,15 +16,6 @@ internal sealed class DepthOfFieldGaussianPostProcessPass : ScriptableRenderPass Experimental.Rendering.GraphicsFormat m_CoCFormat; - // Settings - public DepthOfField depthOfField { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public DepthOfFieldGaussianPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -46,16 +38,11 @@ public DepthOfFieldGaussianPostProcessPass(Shader shader) m_CoCFormat = Experimental.Rendering.GraphicsFormat.R8_UNorm; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); CoreUtils.Destroy(m_MaterialCoc); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class DoFGaussianPassData @@ -81,18 +68,22 @@ private class DoFGaussianPassData }; public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for DepthOfFieldGaussianPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for DepthOfFieldGaussianPostProcessPass."); + if (!m_IsValid) + return; UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); + var depthOfField = volumeStack.GetComponent(); + + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); + var srcDesc = sourceTexture.GetDescriptor(renderGraph); var colorFormat = srcDesc.colorFormat; - int downSample = 2; - int wh = srcDesc.width / downSample; - int hh = srcDesc.height / downSample; + int wh = srcDesc.width / k_DownSample; + int hh = srcDesc.height / k_DownSample; // Pass Textures var fullCoCTextureDesc = PostProcessUtils.GetCompatibleDescriptor(srcDesc, srcDesc.width, srcDesc.height, m_CoCFormat); @@ -116,7 +107,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer float maxRadius = depthOfField.gaussianMaxRadius.value * (wh / 1080f); maxRadius = Mathf.Min(maxRadius, 2f); - passData.downsample = downSample; + passData.downsample = k_DownSample; passData.cocParams = new Vector3(farStart, farEnd, maxRadius); passData.highQualitySamplingValue = depthOfField.highQualitySampling.value; passData.enableAlphaOutput = cameraData.isAlphaOutputEnabled; @@ -221,6 +212,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } }); } + + resourceData.cameraColor = destinationTexture; } // Precomputed shader ids to same some CPU cycles (mostly affects mobile) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs index 7977b316cc0..3e35a1b917f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/FinalPostProcessPass.cs @@ -4,13 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class FinalPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class FinalPostProcessPass : PostProcessPass { Material m_Material; - Texture2D[] m_FilmGrainTextures; + bool m_IsValid; - public enum SamplingOperation + public enum FilteringOperation { Linear, Point, @@ -18,12 +18,12 @@ public enum SamplingOperation FsrSharpening } - SamplingOperation m_SamplingOperation; + Texture m_DitherTexture; + FilteringOperation m_FilteringOperation; HDROutputUtils.Operation m_HdrOperations; bool m_ApplySrgbEncoding; - //NOTE: This is used to communicate if FXAA is already done in the previous pass. - bool m_ApplyFxaa; - Texture m_DitherTexture; + bool m_ApplyFxaa; // NOTE: This is used to communicate if FXAA is already done in the previous pass. + bool m_RenderOverlayUI; public FinalPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) { @@ -31,22 +31,25 @@ public FinalPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) this.profilingSampler = new ProfilingSampler("Blit Final Post Processing"); m_Material = PostProcessUtils.LoadShader(shader, passName); - + m_IsValid = m_Material != null; m_FilmGrainTextures = filmGrainTextures; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } - public void Setup(SamplingOperation samplingOperation, HDROutputUtils.Operation hdrOperations, bool applySrgbEncoding, bool applyFxaa, Texture ditherTexture) + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Setup(Texture ditherTexture, FilteringOperation filteringOperation, HDROutputUtils.Operation hdrOperations, bool applySrgbEncoding, bool applyFxaa, bool renderOverlayUI) { - m_SamplingOperation = samplingOperation; + m_DitherTexture = ditherTexture; + m_FilteringOperation = filteringOperation; m_HdrOperations = hdrOperations; m_ApplySrgbEncoding = applySrgbEncoding; m_ApplyFxaa = applyFxaa; - m_DitherTexture = ditherTexture; + m_RenderOverlayUI = renderOverlayUI; } private class PostProcessingFinalBlitPassData @@ -57,7 +60,7 @@ private class PostProcessingFinalBlitPassData internal UniversalCameraData cameraData; internal Tonemapping tonemapping; - internal SamplingOperation samplingOperation; + internal FilteringOperation filteringOperation; internal HDROutputUtils.Operation hdrOperations; internal UberPostProcessPass.FilmGrainParams filmGrain; @@ -68,19 +71,17 @@ private class PostProcessingFinalBlitPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - if (m_Material == null) + if (!m_IsValid) return; - //TODO get stack from VolumeEffect class in later PR - Tonemapping tonemapping = VolumeManager.instance.stack.GetComponent(); - FilmGrain filmGrain = VolumeManager.instance.stack.GetComponent(); + var tonemapping = volumeStack.GetComponent(); + var filmGrain = volumeStack.GetComponent(); var cameraData = frameData.Get(); var resourceData = frameData.Get(); var sourceTexture = resourceData.cameraColor; var destinationTexture = resourceData.backBufferColor; //By definition this pass blits to the backbuffer - var overlayUITexture = resourceData.overlayUITexture; // Final blit pass using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) @@ -92,14 +93,15 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.sourceTexture = sourceTexture; builder.UseTexture(sourceTexture, AccessFlags.Read); - if (overlayUITexture.IsValid()) - builder.UseTexture(overlayUITexture, AccessFlags.Read); + // NOTE: Global texture. 'overlayUITexture' is bound by the DrawOffscreenUIPass pass if needed. Not in FinalPostProcessPass. + if (m_RenderOverlayUI) + builder.UseTexture(resourceData.overlayUITexture, AccessFlags.Read); passData.material = m_Material; passData.cameraData = cameraData; passData.tonemapping = tonemapping; - passData.samplingOperation = m_SamplingOperation; + passData.filteringOperation = m_FilteringOperation; passData.hdrOperations = m_HdrOperations; passData.filmGrain.Setup(filmGrain, m_FilmGrainTextures, cameraData.pixelWidth, cameraData.pixelHeight); @@ -128,31 +130,30 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer var cmd = context.cmd; var material = data.material; var cameraData = data.cameraData; - var samplingOperation = data.samplingOperation; + var filteringOperation = data.filteringOperation; var requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); var isAlphaOutputEnabled = cameraData.isAlphaOutputEnabled; var applyFxaa = data.applyFxaa; var hdrColorEncoding = data.hdrOperations.HasFlag(HDROutputUtils.Operation.ColorEncoding); var applySrgbEncoding = data.applySrgbEncoding; RTHandle sourceTextureHdl = data.sourceTexture; - RTHandle destinationTextureHdl = data.destinationTexture; // Clear shader keywords state material.shaderKeywords = null; - switch (samplingOperation) + switch (filteringOperation) { - case SamplingOperation.Point: + case FilteringOperation.Point: material.EnableKeyword(ShaderKeywordStrings.PointSampling); break; - case SamplingOperation.TaaSharpening: + case FilteringOperation.TaaSharpening: // Reuse RCAS as a standalone sharpening filter for TAA. // If FSR is enabled then it overrides the sharpening/TAA setting and we skip it. material.EnableKeyword(ShaderKeywordStrings.Rcas); FSRUtils.SetRcasConstantsLinear(cmd, data.cameraData.taaSettings.contrastAdaptiveSharpening); // TODO: Global state constants. break; - case SamplingOperation.FsrSharpening: + case FilteringOperation.FsrSharpening: // RCAS // Use the override value if it's available, otherwise use the default. float sharpness = data.cameraData.fsrOverrideSharpness ? data.cameraData.fsrSharpness : FSRUtils.kDefaultSharpnessLinear; @@ -165,7 +166,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer FSRUtils.SetRcasConstantsLinear(cmd, sharpness); // TODO: Global state constants. } break; - case SamplingOperation.Linear: goto default; + case FilteringOperation.Linear: goto default; default: break; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs index 24e46dd6a01..a6ca9fb5c24 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/Fsr1UpscalePostProcessPass.cs @@ -4,15 +4,14 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class Fsr1UpscalePostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class Fsr1UpscalePostProcessPass : PostProcessPass { + public const string k_TargetName = "CameraColorUpscaled"; + Material m_Material; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - // Output - public TextureHandle destinationTexture { get; set; } + TextureDesc m_UpscaledDesc; public Fsr1UpscalePostProcessPass(Shader shader) { @@ -23,34 +22,39 @@ public Fsr1UpscalePostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class PostProcessingFinalFSRScalePassData { - internal TextureHandle sourceTexture; internal Material material; + internal TextureHandle sourceTexture; internal Vector2 fsrInputSize; internal Vector2 fsrOutputSize; internal bool enableAlphaOutput; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Setup(TextureDesc upscaledDesc) + { + m_UpscaledDesc = upscaledDesc; + } + public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for Fsr1UpscalePostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for Fsr1UpscalePostProcessPass."); + if (!m_IsValid) + return; - UniversalCameraData cameraData = frameData.Get(); + var cameraData = frameData.Get(); + var resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; var srcDesc = renderGraph.GetTextureDesc(sourceTexture); + + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, m_UpscaledDesc, k_TargetName, true, FilterMode.Point); var dstDesc = renderGraph.GetTextureDesc(destinationTexture); // FSR upscale @@ -79,8 +83,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Vector2 viewportScale = sourceHdl.useScaling ? new Vector2(sourceHdl.rtHandleProperties.rtHandleScale.x, sourceHdl.rtHandleProperties.rtHandleScale.y) : Vector2.one; Blitter.BlitTexture(context.cmd, data.sourceTexture, viewportScale, material, 0); }); - return; } + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs index d9241fc6b5b..745c54c1e6f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareDataDrivenPostProcessPass.cs @@ -4,19 +4,11 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class LensFlareDataDrivenPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class LensFlareDataDrivenPostProcessPass : PostProcessPass { Material m_Material; bool m_IsValid; - // Settings - public PaniniProjection paniniProjection { get; set; } // Note: dependency to another pass - - // Input - - // Output - public TextureHandle destinationTexture { get; set; } - public LensFlareDataDrivenPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -26,14 +18,10 @@ public LensFlareDataDrivenPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class LensFlarePassData @@ -51,23 +39,29 @@ private class LensFlarePassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for LensFlareDataDrivenPostProcessPass."); + if (!m_IsValid) + return; var cameraData = frameData.Get(); var resourceData = frameData.Get(); + // No "sourceTexture". Source is procedurally generated. + var destinationTexture = resourceData.cameraColor; + // Reset keywords m_Material.shaderKeywords = null; var desc = destinationTexture.GetDescriptor(renderGraph); + var paniniProjection = volumeStack.GetComponent(); + if (LensFlareCommonSRP.IsOcclusionRTCompatible()) - LensFlareDataDrivenComputeOcclusion(renderGraph, resourceData, cameraData, in desc); + LensFlareDataDrivenComputeOcclusion(renderGraph, resourceData, cameraData, in desc, paniniProjection); - RenderLensFlareDataDriven(renderGraph, resourceData, cameraData, destinationTexture, in desc); + RenderLensFlareDataDriven(renderGraph, resourceData, cameraData, destinationTexture, in desc, paniniProjection); } - void LensFlareDataDrivenComputeOcclusion(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureDesc dstDesc) + void LensFlareDataDrivenComputeOcclusion(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureDesc dstDesc, PaniniProjection paniniProjection) { using (var builder = renderGraph.AddUnsafePass("Lens Flare Compute Occlusion", out var passData, ProfilingSampler.Get(URPProfileId.LensFlareDataDrivenComputeOcclusion))) { @@ -162,7 +156,7 @@ void LensFlareDataDrivenComputeOcclusion(RenderGraph renderGraph, UniversalResou } } - void RenderLensFlareDataDriven(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureHandle destination, in TextureDesc srcDesc) + void RenderLensFlareDataDriven(RenderGraph renderGraph, UniversalResourceData resourceData, UniversalCameraData cameraData, in TextureHandle destination, in TextureDesc srcDesc, PaniniProjection paniniProjection) { using (var builder = renderGraph.AddUnsafePass("Lens Flare Data Driven Pass", out var passData, ProfilingSampler.Get(URPProfileId.LensFlareDataDriven))) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs index 2a551339fa4..8f9d9684446 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/LensFlareScreenSpacePostProcessPass.cs @@ -4,26 +4,15 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class LensFlareScreenSpacePostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class LensFlareScreenSpacePostProcessPass : PostProcessPass { Material m_Material; bool m_IsValid; - // Settings - public ScreenSpaceLensFlare lensFlareScreenSpace { get; set; } - - public bool sameSourceDestinationTexture { get; set; } = false; - - // Input - // Post-processing main color-buffer texture desc. Can be different from downsampled bloom/flare textures. - public TextureDesc colorBufferTextureDesc { get; set; } - - // Flare streaks are generated from this texture. Typically, a lower resolution downsampled bloom (mipN) texture. - public TextureHandle sourceTexture { get; set; } - - // Flare is blended to the destination. Typically, the bloom (mip0) texture. Bloom can be at different resolution compared to the main color source. - public TextureHandle destinationTexture { get; set; } + int m_ColorBufferWidth; + int m_ColorBufferHeight; + int m_FlareSourceBloomMipIndex; public LensFlareScreenSpacePostProcessPass(Shader shader) { @@ -34,19 +23,25 @@ public LensFlareScreenSpacePostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public void Setup(int colorBufferWidth, int colorBufferHeight, int flareSourceBloomMipIndex) { - return m_IsValid; + m_ColorBufferWidth = colorBufferWidth; + m_ColorBufferHeight = colorBufferHeight; + m_FlareSourceBloomMipIndex = flareSourceBloomMipIndex; } private class LensFlareScreenSpacePassData { + internal Material material; + internal ScreenSpaceLensFlare lensFlareScreenSpace; + internal Camera camera; internal TextureHandle streakTmpTexture; internal TextureHandle streakTmpTexture2; internal TextureHandle flareResultTmp; @@ -54,26 +49,38 @@ private class LensFlareScreenSpacePassData internal TextureHandle flareSourceBloomMipTexture; internal int actualColorWidth; internal int actualColorHeight; - internal Camera camera; - internal Material material; - internal ScreenSpaceLensFlare lensFlareScreenSpace; internal int downsample; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for LensFlareScreenSpacePostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for LensFlareScreenSpacePostProcessPass."); + if (!m_IsValid) + return; + + var lensFlareScreenSpace = volumeStack.GetComponent(); + var bloom = volumeStack.GetComponent(); + + // Check if Flare source and Flare target is the same texture. In practice BloomMip[0] + // TODO: Check src/dst handle equality in the future. + // Kawase blur does not use the mip pyramid. + // It is safe to pass the same texture to both input/output. + bool useDestinationAsSource = m_FlareSourceBloomMipIndex == 0 || bloom.filter.value == BloomFilterMode.Kawase; + + var resourceData = frameData.Get(); + var cameraData = frameData.Get(); - UniversalCameraData cameraData = frameData.Get(); - Camera camera = cameraData.camera; + // Flare streaks are generated from this texture. Typically, a lower resolution downsampled bloom (mipN) texture. + var sourceTexture = resourceData.cameraColor; + // Flare is blended to the destination. Typically, the bloom (mip0) texture. Bloom can be at different resolution compared to the main color source. + var destinationTexture = resourceData.bloom; var downsample = (int) lensFlareScreenSpace.resolution.value; - int flareRenderWidth = Math.Max( colorBufferTextureDesc.width / downsample, 1); - int flareRenderHeight = Math.Max( colorBufferTextureDesc.height / downsample, 1); + int flareRenderWidth = Math.Max( m_ColorBufferWidth / downsample, 1); + int flareRenderHeight = Math.Max( m_ColorBufferHeight / downsample, 1); - var streakTextureDesc = PostProcessUtils.GetCompatibleDescriptor(colorBufferTextureDesc, flareRenderWidth, flareRenderHeight, colorBufferTextureDesc.colorFormat); + var streakDesc = renderGraph.GetTextureDesc(resourceData.cameraColor); + var streakTextureDesc = PostProcessUtils.GetCompatibleDescriptor(streakDesc, flareRenderWidth, flareRenderHeight, streakDesc.colorFormat); var streakTmpTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, streakTextureDesc, "_StreakTmpTexture", true, FilterMode.Bilinear); var streakTmpTexture2 = PostProcessUtils.CreateCompatibleTexture(renderGraph, streakTextureDesc, "_StreakTmpTexture2", true, FilterMode.Bilinear); @@ -92,11 +99,11 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.UseTexture(sourceTexture, AccessFlags.ReadWrite); passData.flareDestinationBloomTexture = destinationTexture; // Input/Output can be the same texture. There's a temp texture in between. Avoid RG double write error. - if(!sameSourceDestinationTexture) + if(!useDestinationAsSource) builder.UseTexture(destinationTexture, AccessFlags.ReadWrite); - passData.actualColorWidth = colorBufferTextureDesc.width; - passData.actualColorHeight = colorBufferTextureDesc.height; - passData.camera = camera; + passData.actualColorWidth = m_ColorBufferWidth; + passData.actualColorHeight = m_ColorBufferHeight; + passData.camera = cameraData.camera; passData.material = m_Material; passData.lensFlareScreenSpace = lensFlareScreenSpace; // NOTE: reference, assumed constant until executed. passData.downsample = downsample; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs index 38c329bb7d0..d5526568586 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/MotionBlurPostProcessPass.cs @@ -4,21 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class MotionBlurPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class MotionBlurPostProcessPass : PostProcessPass { public const string k_TargetName = "_MotionBlurTarget"; Material m_Material; bool m_IsValid; - // Settings - public MotionBlur motionBlur { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - // Output - public TextureHandle destinationTexture { get; set; } - public MotionBlurPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -28,15 +20,10 @@ public MotionBlurPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class MotionBlurPassData @@ -52,12 +39,17 @@ private class MotionBlurPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for MotionBlurPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for MotionBlurPostProcessPass."); + if(!m_IsValid) + return; + + var motionBlur = volumeStack.GetComponent(); UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); + TextureHandle motionVectorColor = resourceData.motionVectorColor; TextureHandle cameraDepthTexture = resourceData.cameraDepthTexture; @@ -104,9 +96,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Vector2 viewportScale = sourceTextureHdl.useScaling ? new Vector2(sourceTextureHdl.rtHandleProperties.rtHandleScale.x, sourceTextureHdl.rtHandleProperties.rtHandleScale.y) : Vector2.one; Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, data.material, data.passIndex); }); - - return; } + + resourceData.cameraColor = destinationTexture; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs index 913a23aa497..43f71dade8f 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PaniniProjectionPostProcessPass.cs @@ -4,22 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class PaniniProjectionPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class PaniniProjectionPostProcessPass : PostProcessPass { public const string k_TargetName = "_PaniniProjectionTarget"; Material m_Material; bool m_IsValid; - // Settings - public PaniniProjection paniniProjection { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public PaniniProjectionPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -29,15 +20,10 @@ public PaniniProjectionPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class PaniniProjectionPassData @@ -49,8 +35,14 @@ private class PaniniProjectionPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for PaniniProjectionPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for PaniniProjectionPostProcessPass."); + if(!m_IsValid) + return; + + var paniniProjection = volumeStack.GetComponent(); + + UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); UniversalCameraData cameraData = frameData.Get(); Camera camera = cameraData.camera; @@ -89,9 +81,9 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Vector2 viewportScale = sourceTextureHdl.useScaling ? new Vector2(sourceTextureHdl.rtHandleProperties.rtHandleScale.x, sourceTextureHdl.rtHandleProperties.rtHandleScale.y) : Vector2.one; Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, data.material, 0); }); - - return; } + + resourceData.cameraColor = destinationTexture; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs new file mode 100644 index 00000000000..622b938233a --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs @@ -0,0 +1,30 @@ +using System; + +namespace UnityEngine.Rendering.Universal +{ + internal abstract class PostProcessPass : ScriptableRenderPass, IDisposable + { + VolumeStack m_VolumeStackOverride; + + public VolumeStack volumeStack + { + get{ + if (m_VolumeStackOverride == null) + { + return VolumeManager.instance.stack; + } + else + { + return m_VolumeStackOverride; + } + } + } + + public VolumeStack volumeStackOverride + { + set { m_VolumeStackOverride = value; } + } + + public abstract void Dispose(); + } +} diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs.meta b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs.meta new file mode 100644 index 00000000000..d6e4b4a5941 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/PostProcessPass.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 389e75599c6f47399ec151a887fef961 +timeCreated: 1761069683 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs index 03f0af2cb7c..8bf013255cc 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/ScalingSetupPostProcessPass.cs @@ -4,23 +4,14 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class ScalingSetupPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class ScalingSetupPostProcessPass : PostProcessPass { public const string k_TargetName = "_ScalingSetupTarget"; Material m_Material; bool m_IsValid; - // Settings - public Tonemapping tonemapping { get; set; } - - public HDROutputUtils.Operation hdrOperations { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - // Output - public TextureHandle destinationTexture { get; set; } - + HDROutputUtils.Operation m_HdrOperations; public ScalingSetupPostProcessPass(Shader shader) { @@ -31,15 +22,16 @@ public ScalingSetupPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public void Setup(HDROutputUtils.Operation hdrOperations) { - return m_IsValid; + m_HdrOperations = hdrOperations; } private class PostProcessingFinalSetupPassData @@ -54,14 +46,30 @@ private class PostProcessingFinalSetupPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for ScalingSetupPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for ScalingSetupPostProcessPass."); + if (!m_IsValid) + return; + + var tonemapping = volumeStack.GetComponent(); + + var cameraData = frameData.Get(); + var resourceData = frameData.Get(); + + var sourceTexture = resourceData.cameraColor; + + var scalingSetupDesc = renderGraph.GetTextureDesc(sourceTexture); + bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); + if (!requireHDROutput) + { + // Select a UNORM format since we've already performed tonemapping. (Values are in 0-1 range) + // This improves precision and is required if we want to avoid excessive banding when FSR is in use. + scalingSetupDesc.format = UniversalRenderPipeline.MakeUnormRenderTextureGraphicsFormat(); + } + + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, scalingSetupDesc, k_TargetName, true, FilterMode.Point); // Scaled FXAA using (var builder = renderGraph.AddRasterRenderPass(passName, out var passData, profilingSampler)) { - UniversalCameraData cameraData = frameData.Get(); - passData.destinationTexture = destinationTexture; builder.SetRenderAttachment(destinationTexture, 0, AccessFlags.Write); passData.sourceTexture = sourceTexture; @@ -70,7 +78,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.material = m_Material; passData.cameraData = cameraData; passData.tonemapping = tonemapping; - passData.hdrOperations = hdrOperations; + passData.hdrOperations = m_HdrOperations; builder.SetRenderFunc(static (PostProcessingFinalSetupPassData data, RasterGraphContext context) => { @@ -100,6 +108,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer PostProcessUtils.ScaleViewportAndBlit(context, data.sourceTexture, data.destinationTexture, data.cameraData, data.material, isFinalPass); }); } + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs index 2b87e160cba..bbdd97257ca 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/SmaaPostProcessPass.cs @@ -4,7 +4,7 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class SmaaPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class SmaaPostProcessPass : PostProcessPass { public const string k_TargetName = "_SMAATarget"; @@ -17,14 +17,7 @@ internal sealed class SmaaPostProcessPass : ScriptableRenderPass, IDisposable Experimental.Rendering.GraphicsFormat m_SMAAEdgeFormat; - // Settings - public AntialiasingQuality antialiasingQuality { get; set; } - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } + AntialiasingQuality m_AntiAliasingQuality; public SmaaPostProcessPass(Shader shader, Texture2D smaaAreaTexture, Texture2D smaaSearchTexture) { @@ -45,15 +38,15 @@ public SmaaPostProcessPass(Shader shader, Texture2D smaaAreaTexture, Texture2D s m_SMAAEdgeFormat = Experimental.Rendering.GraphicsFormat.R8G8B8A8_UNorm; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() + public void Setup(AntialiasingQuality antialiasingQuality) { - return m_IsValid; + m_AntiAliasingQuality = antialiasingQuality; } private class SMAASetupPassData @@ -77,12 +70,15 @@ private class SMAAPassData public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), "Source texture must be set for SmaaPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), "Destination texture must be set for SmaaPostProcessPass."); + if (!m_IsValid) + return; UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destDesc = renderGraph.GetTextureDesc(sourceTexture); + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, destDesc, k_TargetName, true, FilterMode.Bilinear); destDesc.clearColor = Color.black; destDesc.clearColor.a = 0.0f; @@ -112,7 +108,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.stencilRef = (float)kStencilBit; passData.stencilMask = (float)kStencilBit; - passData.antialiasingQuality = antialiasingQuality; + passData.antialiasingQuality = m_AntiAliasingQuality; passData.material = m_Material; builder.SetRenderAttachment(edgeTexture, 0, AccessFlags.Write); @@ -177,6 +173,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, SMAAMaterial, ShaderPass.k_NeighborhoodBlending); }); } + + resourceData.cameraColor = destinationTexture; } static void SetupMaterial(SMAASetupPassData data) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs index 091adc7a5f6..e6f1624474d 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StopNanPostProcessPass.cs @@ -4,20 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class StopNanPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class StopNanPostProcessPass : PostProcessPass { public const string k_TargetName = "_StopNaNsTarget"; Material m_Material; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - - public StopNanPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -27,15 +20,10 @@ public StopNanPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } private class StopNaNsPassData @@ -45,8 +33,12 @@ private class StopNaNsPassData } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for StopNanPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for StopNanPostProcessPass."); + if (!m_IsValid) + return; + + var resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, true, FilterMode.Bilinear); using (var builder = renderGraph.AddRasterRenderPass("Stop NaNs", out var passData, ProfilingSampler.Get(URPProfileId.RG_StopNaNs))) @@ -63,6 +55,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer Blitter.BlitTexture(cmd, sourceTextureHdl, viewportScale, data.stopNaN, 0); }); } + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs index 1f30a95b9cb..3335dfb5154 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/StpPostProcessPass.cs @@ -4,18 +4,12 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class StpPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class StpPostProcessPass : PostProcessPass { public const string k_UpscaledColorTargetName = "_CameraColorUpscaledSTP"; Texture2D[] m_BlueNoise16LTex; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public StpPostProcessPass(Texture2D[] blueNoise16LTex) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -25,24 +19,25 @@ public StpPostProcessPass(Texture2D[] blueNoise16LTex) m_IsValid = m_BlueNoise16LTex != null && m_BlueNoise16LTex.Length > 0; } - public void Dispose() + public override void Dispose() { - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for StpPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for StpPostProcessPass."); + if (!m_IsValid) + return; UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + + var srcDesc = renderGraph.GetTextureDesc(sourceTexture); + var dstDesc = StpPostProcessPass.GetStpTargetDesc(srcDesc, cameraData); + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, dstDesc, k_UpscaledColorTargetName, false, FilterMode.Bilinear); + TextureHandle cameraDepth = resourceData.cameraDepthTexture; TextureHandle motionVectors = resourceData.motionVectorColor; @@ -56,6 +51,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer // Update the camera resolution to reflect the upscaled size var destDesc = destinationTexture.GetDescriptor(renderGraph); UpscalerPostProcessPass.UpdateCameraResolution(renderGraph, cameraData, new Vector2Int(destDesc.width, destDesc.height)); + + resourceData.cameraColor = destinationTexture; } [MethodImpl(MethodImplOptions.AggressiveInlining)] diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs index 29a71651e66..39e42358b4a 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/TemporalAntiAliasingPostProcessPass.cs @@ -4,19 +4,13 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class TemporalAntiAliasingPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class TemporalAntiAliasingPostProcessPass : PostProcessPass { public const string k_TargetName = "_TemporalAATarget"; Material m_Material; bool m_IsValid; - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; set; } - public TemporalAntiAliasingPostProcessPass(Shader shader) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -26,9 +20,10 @@ public TemporalAntiAliasingPostProcessPass(Shader shader) m_IsValid = m_Material != null; } - public void Dispose() + public override void Dispose() { CoreUtils.Destroy(m_Material); + m_IsValid = false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -39,18 +34,23 @@ public bool IsValid() public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for TemporalAntiAliasingPostProcessPass."); - Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for TemporalAntiAliasingPostProcessPass."); + if (!m_IsValid) + return; UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; + var destinationTexture = PostProcessUtils.CreateCompatibleTexture(renderGraph, sourceTexture, k_TargetName, false, FilterMode.Bilinear); + TextureHandle cameraDepth = resourceData.cameraDepth; TextureHandle motionVectors = resourceData.motionVectorColor; Debug.Assert(motionVectors.IsValid(), "MotionVectors are invalid. TAA requires a motion vector texture."); TemporalAA.Render(renderGraph, m_Material, cameraData, sourceTexture, in cameraDepth, in motionVectors, destinationTexture); + + resourceData.cameraColor = destinationTexture; } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs index b2a332f9646..9f08b039edc 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UberPostProcessPass.cs @@ -4,30 +4,19 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class UberPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class UberPostProcessPass : PostProcessPass { Material m_Material; - Texture2D[] m_FilmGrainTextures; - // Settings - public ColorLookup colorLookup { get; set; } - public ColorAdjustments colorAdjustments { get; set; } - public Tonemapping tonemapping { get; set; } - public Bloom bloom { get; set; } - - public LensDistortion lensDistortion { get; set; } - public ChromaticAberration chromaticAberration { get; set; } - public Vignette vignette { get; set; } - public FilmGrain filmGrain { get; set; } - - - public bool isFinalPass { get; set; } - public HDROutputUtils.Operation hdrOperations { get; set; } - public bool requireSRGBConversionBlit { get; set; } - public bool useFastSRGBLinearConversion { get; set; } - - public Texture ditherTexture { get; set; } + Texture m_DitherTexture; + RTHandle m_UserLut; + HDROutputUtils.Operation m_HdrOperations; + bool m_IsValid; + bool m_IsFinalPass; + bool m_RequireSRGBConversionBlit; + bool m_UseFastSRGBLinearConversion; + bool m_RenderOverlayUI; public UberPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) { @@ -35,14 +24,30 @@ public UberPostProcessPass(Shader shader, Texture2D[] filmGrainTextures) this.profilingSampler = new ProfilingSampler("Blit Post Processing"); m_Material = PostProcessUtils.LoadShader(shader, passName); - + m_IsValid = m_Material != null; m_FilmGrainTextures = filmGrainTextures; } - public void Dispose() + public override void Dispose() { - CoreUtils.Destroy(m_Material); m_UserLut?.Release(); + CoreUtils.Destroy(m_Material); + m_IsValid = false; + } + + public void Setup(Texture ditherTexture, + HDROutputUtils.Operation hdrOperations, + bool requireSRGBConversionBlit, + bool useFastSRGBLinearConversion, + bool isFinalPass, + bool renderOverlayUI) + { + m_DitherTexture = ditherTexture; + m_HdrOperations = hdrOperations; + m_RequireSRGBConversionBlit = requireSRGBConversionBlit; + m_UseFastSRGBLinearConversion = useFastSRGBLinearConversion; + m_IsFinalPass = isFinalPass; + m_RenderOverlayUI = renderOverlayUI; } private class UberPostPassData @@ -76,9 +81,18 @@ private class UberPostPassData /// public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { - if (m_Material == null) + if(!m_IsValid) return; + var colorLookup = volumeStack.GetComponent(); + var colorAdjustments = volumeStack.GetComponent(); + var tonemapping = volumeStack.GetComponent(); + var bloom = volumeStack.GetComponent(); + var lensDistortion = volumeStack.GetComponent(); + var chromaticAberration = volumeStack.GetComponent(); + var vignette = volumeStack.GetComponent(); + var filmGrain = volumeStack.GetComponent(); + var cameraData = frameData.Get(); var postProcessingData = frameData.Get(); var resourceData = frameData.Get(); @@ -101,8 +115,8 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer resourceData.destinationCameraColor //TODO here we don't seem to apply PostProcessUtils.CreateCompatibleTexture. This seems completely out of sync with the other post process passes. //However, changing it, breaks some tests because rendering with the color and depth after this pass when MSAA is on leads to mismatch. - //It seems completely arbitrary that we continue to write out color with MSAA if no other pp pass has been applied earlier. - : renderGraph.CreateTexture(sourceTexture, _CameraColorAfterPostProcessingName); + //It seems completely arbitrary that we continue to write out color with MSAA if no other pp pass has been applied earlier. + : renderGraph.CreateTexture(sourceTexture, _CameraColorAfterPostProcessingName); resourceData.destinationCameraColor = TextureHandle.nullHandle; } @@ -131,7 +145,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.sourceTexture = sourceTexture; builder.UseTexture(sourceTexture, AccessFlags.Read); - if(overlayUITexture.IsValid()) + if(m_RenderOverlayUI) builder.UseTexture(overlayUITexture, AccessFlags.Read); builder.UseTexture(internalColorLut, AccessFlags.Read); @@ -143,12 +157,12 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.material = m_Material; passData.cameraData = cameraData; - passData.useFastSRGBLinearConversion = useFastSRGBLinearConversion; - passData.requireSRGBConversionBlit = requireSRGBConversionBlit; + passData.useFastSRGBLinearConversion = m_UseFastSRGBLinearConversion; + passData.requireSRGBConversionBlit = m_RequireSRGBConversionBlit; // HDR passData.tonemapping = tonemapping; - passData.hdrOperations = hdrOperations; + passData.hdrOperations = m_HdrOperations; passData.isHdrGrading = postProcessingData.gradingMode == ColorGradingMode.HighDynamicRange; passData.lut.Setup(colorAdjustments, colorLookup, postProcessingData.lutSize, internalColorLut, userColorLut); @@ -158,12 +172,12 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer passData.vignette.Setup(vignette, srcDesc.width, srcDesc.height, cameraData.xr); // Final pass effects - if (isFinalPass) + if (m_IsFinalPass) { passData.filmGrain.Setup(filmGrain, m_FilmGrainTextures, cameraData.pixelWidth, cameraData.pixelHeight); - passData.dither.Setup(ditherTexture, cameraData.pixelWidth, cameraData.pixelHeight); + passData.dither.Setup(m_DitherTexture, cameraData.pixelWidth, cameraData.pixelHeight); } - passData.isFinalPass = isFinalPass; + passData.isFinalPass = m_IsFinalPass; builder.SetRenderFunc(static (UberPostPassData data, RasterGraphContext context) => { @@ -238,7 +252,6 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } #region ColorLut - RTHandle m_UserLut; TextureHandle TryGetCachedUserLutTextureHandle(RenderGraph renderGraph, ColorLookup colorLookup) { if (colorLookup.texture.value == null) diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs index 465c914a48a..f50c0baefc2 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/PostProcess/UpscalerPostProcessPass.cs @@ -4,20 +4,12 @@ namespace UnityEngine.Rendering.Universal { - internal sealed class UpscalerPostProcessPass : ScriptableRenderPass, IDisposable + internal sealed class UpscalerPostProcessPass : PostProcessPass { public const string k_UpscaledColorTargetName = "_CameraColorUpscaled"; Texture2D[] m_BlueNoise16LTex; bool m_IsValid; - // Settings - - // Input - public TextureHandle sourceTexture { get; set; } - - // Output - public TextureHandle destinationTexture { get; private set; } - public UpscalerPostProcessPass(Texture2D[] blueNoise16LTex) { this.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing - 1; @@ -27,28 +19,22 @@ public UpscalerPostProcessPass(Texture2D[] blueNoise16LTex) m_IsValid = m_BlueNoise16LTex != null && m_BlueNoise16LTex.Length > 0; } - public void Dispose() + public override void Dispose() { - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsValid() - { - return m_IsValid; + m_IsValid = false; } public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) { #if ENABLE_UPSCALER_FRAMEWORK - Assertions.Assert.IsTrue(sourceTexture.IsValid(), $"Source texture must be set for StpPostProcessPass."); - - // TODO: User should be able to set the destination texture externally. This allows the user to decide where the upscaled texture should be stored. - //Assertions.Assert.IsTrue(destinationTexture.IsValid(), $"Destination texture must be set for StpPostProcessPass."); + if (!m_IsValid) + return; UniversalCameraData cameraData = frameData.Get(); UniversalResourceData resourceData = frameData.Get(); UniversalPostProcessingData postProcessingData = frameData.Get(); + var sourceTexture = resourceData.cameraColor; var srcDesc = sourceTexture.GetDescriptor(renderGraph); // Create a context item containing upscaling inputs @@ -78,7 +64,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer motionData = additionalCameraData.motionVectorsPersistentData; Debug.Assert(motionData != null); } - io.cameraInstanceID = cameraData.camera.GetInstanceID(); + io.cameraInstanceID = cameraData.camera.GetEntityId(); io.nearClipPlane = cameraData.camera.nearClipPlane; io.farClipPlane = cameraData.camera.farClipPlane; io.fieldOfViewDegrees = cameraData.camera.fieldOfView; @@ -129,7 +115,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer UpdateCameraResolution(renderGraph, cameraData, new Vector2Int(dstDesc.width, dstDesc.height)); // Use the output texture of upscaling - destinationTexture = io.cameraColor; + resourceData.cameraColor = io.cameraColor; #endif } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs index d1b3d30ea2d..75808c91ec3 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ProbeVolumeDebugPass.cs @@ -58,7 +58,7 @@ internal void Render(RenderGraph renderGraph, ContextContainer frameData, Textur builder.UseTexture(passData.depthBuffer, AccessFlags.Read); builder.UseTexture(passData.normalBuffer, AccessFlags.Read); - builder.SetRenderFunc((WriteApvData data, ComputeGraphContext ctx) => + builder.SetRenderFunc(static (WriteApvData data, ComputeGraphContext ctx) => { int kernel = data.computeShader.FindKernel("ComputePositionNormal"); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs index ff637b4090d..6cd36815636 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/RenderObjectsPass.cs @@ -291,7 +291,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } } - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { var isYFlipped = RenderingUtils.IsHandleYFlipped(rgContext, in data.color); ExecutePass(data, rgContext.cmd, data.rendererListHdl, isYFlipped); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs index c6481da2fbc..d8b1a6a16fa 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/ScreenSpaceAmbientOcclusionPass.cs @@ -373,7 +373,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.SetGlobalTextureAfterPass(finalTexture, s_SSAOFinalTextureID); } - builder.SetRenderFunc((SSAOPassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (SSAOPassData data, UnsafeGraphContext rgContext) => { CommandBuffer cmd = CommandBufferHelpers.GetNativeCommandBuffer(rgContext.cmd); RenderBufferLoadAction finalLoadAction = data.afterOpaque ? RenderBufferLoadAction.Load : RenderBufferLoadAction.DontCare; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs index e31575ce8b7..7071a798eeb 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/Passes/StencilCrossFadeRenderPass.cs @@ -64,7 +64,7 @@ public void Render(RenderGraph renderGraph, ScriptableRenderContext context, Tex passData.stencilDitherMaskSeedMaterials = m_StencilDitherMaskSeedMaterials; passData.depthTarget = depthTarget; - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { ExecutePass(context.cmd, data.depthTarget, data.stencilDitherMaskSeedMaterials); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs b/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs index 08b40f6b033..ef84fa028b5 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/PostProcess.cs @@ -124,8 +124,6 @@ static void UpdateGlobalDebugHandlerPass(RenderGraph renderGraph, UniversalCamer debugHandler?.UpdateShaderGlobalPropertiesForFinalValidationPass(renderGraph, cameraData, isFinalPass && !resolveToDebugScreen); } - const string _CameraColorUpscaled = "_CameraColorUpscaled"; - // If hasFinalPass == true, Film Grain and Dithering are setup in the final pass, otherwise they are setup in this pass. public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frameData, bool hasFinalPass, bool enableColorEncodingIfNeeded) { @@ -139,13 +137,6 @@ public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frame var paniniProjection = stack.GetComponent(); var bloom = stack.GetComponent(); var lensFlareScreenSpace = stack.GetComponent(); - var lensDistortion = stack.GetComponent(); - var chromaticAberration = stack.GetComponent(); - var vignette = stack.GetComponent(); - var colorLookup = stack.GetComponent(); - var colorAdjustments = stack.GetComponent(); - var tonemapping = stack.GetComponent(); - var filmGrain = stack.GetComponent(); bool useFastSRGBLinearConversion = postProcessingData.useFastSRGBLinearConversion; bool supportDataDrivenLensFlare = postProcessingData.supportDataDrivenLensFlare; @@ -154,13 +145,13 @@ public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frame bool isSceneViewCamera = cameraData.isSceneViewCamera; //We blit back and forth without msaa untill the last blit. - bool useStopNan = cameraData.isStopNaNEnabled && m_StopNanPostProcessPass.IsValid(); - bool useSubPixelMorpAA = (cameraData.antialiasing == AntialiasingMode.SubpixelMorphologicalAntiAliasing) && m_SmaaPostProcessPass.IsValid(); - bool useDepthOfField = depthOfField.IsActive() && !isSceneViewCamera && (m_DepthOfFieldGaussianPass.IsValid() || m_DepthOfFieldBokehPass.IsValid()); + bool useStopNan = cameraData.isStopNaNEnabled; + bool useSubPixelMorpAA = (cameraData.antialiasing == AntialiasingMode.SubpixelMorphologicalAntiAliasing); + bool useDepthOfField = depthOfField.IsActive() && !isSceneViewCamera; bool useLensFlare = !LensFlareCommonSRP.Instance.IsEmpty() && supportDataDrivenLensFlare; bool useLensFlareScreenSpace = lensFlareScreenSpace.IsActive() && supportScreenSpaceLensFlare; - bool useMotionBlur = motionBlur.IsActive() && !isSceneViewCamera && m_MotionBlurPass.IsValid(); - bool usePaniniProjection = paniniProjection.IsActive() && !isSceneViewCamera && m_PaniniProjectionPass.IsValid(); + bool useMotionBlur = motionBlur.IsActive() && !isSceneViewCamera; + bool usePaniniProjection = paniniProjection.IsActive() && !isSceneViewCamera; // Disable MotionBlur in EditMode, so that editing remains clear and readable. // NOTE: HDRP does the same via CoreUtils::AreAnimatedMaterialsEnabled(). @@ -196,28 +187,19 @@ public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frame // NOTE: Debug handling injects a global state render pass. UpdateGlobalDebugHandlerPass(renderGraph, cameraData, !hasFinalPass); - TextureHandle currentSource = resourceData.cameraColor; + var colorSourceDesc = resourceData.cameraColor.GetDescriptor(renderGraph); // Optional NaN killer before post-processing kicks in // stopNaN may be null on Adreno 3xx. It doesn't support full shader level 3.5, but SystemInfo.graphicsShaderLevel is 35. if (useStopNan) { - var stopNanTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, StopNanPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - m_StopNanPostProcessPass.sourceTexture = currentSource; - m_StopNanPostProcessPass.destinationTexture = stopNanTarget; m_StopNanPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_StopNanPostProcessPass.destinationTexture; } if(useSubPixelMorpAA) { - var targetDesc = renderGraph.GetTextureDesc(currentSource); - var smaaTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, targetDesc, SmaaPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - m_SmaaPostProcessPass.antialiasingQuality = cameraData.antialiasingQuality; - m_SmaaPostProcessPass.sourceTexture = currentSource; - m_SmaaPostProcessPass.destinationTexture = smaaTarget; + m_SmaaPostProcessPass.Setup(cameraData.antialiasingQuality); m_SmaaPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_SmaaPostProcessPass.destinationTexture; } // Depth of Field @@ -225,23 +207,15 @@ public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frame // DOF shader uses #pragma target 3.5 which adds requirement for instancing support, thus marking the shader unsupported on those devices. if (useDepthOfField) { - var doFTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, DepthOfFieldGaussianPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - if(depthOfField.mode.value == DepthOfFieldMode.Gaussian) - { - m_DepthOfFieldGaussianPass.depthOfField = depthOfField; - m_DepthOfFieldGaussianPass.sourceTexture = currentSource; - m_DepthOfFieldGaussianPass.destinationTexture = doFTarget; - m_DepthOfFieldGaussianPass.RecordRenderGraph(renderGraph, frameData); - } - else - { - m_DepthOfFieldBokehPass.depthOfField = depthOfField; - m_DepthOfFieldBokehPass.useFastSRGBLinearConversion = useFastSRGBLinearConversion; - m_DepthOfFieldBokehPass.sourceTexture = currentSource; - m_DepthOfFieldBokehPass.destinationTexture = doFTarget; - m_DepthOfFieldBokehPass.RecordRenderGraph(renderGraph, frameData); - } - currentSource = doFTarget; + if(depthOfField.mode.value == DepthOfFieldMode.Gaussian) + { + m_DepthOfFieldGaussianPass.RecordRenderGraph(renderGraph, frameData); + } + else + { + m_DepthOfFieldBokehPass.Setup(useFastSRGBLinearConversion); + m_DepthOfFieldBokehPass.RecordRenderGraph(renderGraph, frameData); + } } // Temporal Anti Aliasing / Upscaling @@ -251,150 +225,83 @@ public void RenderPostProcessing(RenderGraph renderGraph, ContextContainer frame #if ENABLE_UPSCALER_FRAMEWORK if (postProcessingData.activeUpscaler != null) { - // TODO: The caller of the pass should create the upscaled target. Caller should have the control of the placement of the result. - m_UpscalerPostProcessPass.sourceTexture = currentSource; m_UpscalerPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_UpscalerPostProcessPass.destinationTexture; } else #endif if (useSTP) { - var srcDesc = renderGraph.GetTextureDesc(currentSource); - var dstDesc = StpPostProcessPass.GetStpTargetDesc(srcDesc, cameraData); - var stpTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, dstDesc, StpPostProcessPass.k_UpscaledColorTargetName, false, FilterMode.Bilinear); - - m_StpPostProcessPass.sourceTexture = currentSource; - m_StpPostProcessPass.destinationTexture = stpTarget; m_StpPostProcessPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_StpPostProcessPass.destinationTexture; } else { - var taaTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, TemporalAntiAliasingPostProcessPass.k_TargetName, false, FilterMode.Bilinear); - - m_TemporalAntiAliasingPass.sourceTexture = currentSource; - m_TemporalAntiAliasingPass.destinationTexture = taaTarget; m_TemporalAntiAliasingPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_TemporalAntiAliasingPass.destinationTexture; } + } if(useMotionBlur) { - var motionTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, MotionBlurPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - - m_MotionBlurPass.motionBlur = motionBlur; - m_MotionBlurPass.sourceTexture = currentSource; - m_MotionBlurPass.destinationTexture = motionTarget; m_MotionBlurPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_MotionBlurPass.destinationTexture; } if(usePaniniProjection) { - var paniniTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, currentSource, PaniniProjectionPostProcessPass.k_TargetName, true, FilterMode.Bilinear); - - m_PaniniProjectionPass.paniniProjection = paniniProjection; - m_PaniniProjectionPass.sourceTexture = currentSource; - m_PaniniProjectionPass.destinationTexture = paniniTarget; m_PaniniProjectionPass.RecordRenderGraph(renderGraph, frameData); - currentSource = m_PaniniProjectionPass.destinationTexture; } // Uberpost { - var colorSrcDesc = currentSource.GetDescriptor(renderGraph); - // Bloom goes first - TextureHandle bloomTexture = TextureHandle.nullHandle; bool bloomActive = bloom.IsActive() || useLensFlareScreenSpace; + //Even if bloom is not active we need the texture if the lensFlareScreenSpace pass is active. if (bloomActive) { // NOTE: bloom destination texture is some texture in the bloom mip pyramid. It's not explicitly set beforehand. - m_BloomPass.bloom = bloom; - m_BloomPass.sourceTexture = currentSource; m_BloomPass.RecordRenderGraph(renderGraph, frameData); - bloomTexture = m_BloomPass.destinationTexture; if (useLensFlareScreenSpace) { var mipPyramid = m_BloomPass.mipPyramid; + // TODO: Bloom pass could compute the flare source resource. // We need to take into account how many valid mips the bloom pass produced. int bloomMipCount = mipPyramid.mipCount; - int maxBloomMip = Mathf.Clamp(bloomMipCount - 1, 0, bloom.maxIterations.value / 2); - int useBloomMip = Mathf.Clamp(lensFlareScreenSpace.bloomMip.value, 0, maxBloomMip); + int bloomMipMax = Mathf.Clamp(bloomMipCount - 1, 0, bloom.maxIterations.value / 2); + int bloomMipIndex = Mathf.Clamp(lensFlareScreenSpace.bloomMip.value, 0, bloomMipMax); - TextureHandle bloomMipFlareSource = mipPyramid.GetResultMip(useBloomMip); - // Flare source and Flare target is the same texture. BloomMip[0] - bool sameBloomSrcDestTex = useBloomMip == 0; + var prevCameraColor = resourceData.cameraColor; + resourceData.cameraColor = mipPyramid.GetResultMip(bloomMipIndex);; - // Kawase blur does not use the mip pyramid. - // It is safe to pass the same texture to both input/output. - if (bloom.filter.value == BloomFilterMode.Kawase) - { - bloomMipFlareSource = bloomTexture; - sameBloomSrcDestTex = true; - } - - m_LensFlareScreenSpacePass.lensFlareScreenSpace = lensFlareScreenSpace; - m_LensFlareScreenSpacePass.sameSourceDestinationTexture = sameBloomSrcDestTex; - m_LensFlareScreenSpacePass.colorBufferTextureDesc = colorSrcDesc; - m_LensFlareScreenSpacePass.sourceTexture = bloomMipFlareSource; - m_LensFlareScreenSpacePass.destinationTexture = bloomTexture; + m_LensFlareScreenSpacePass.Setup(colorSourceDesc.width, colorSourceDesc.height, bloomMipIndex); m_LensFlareScreenSpacePass.RecordRenderGraph(renderGraph, frameData); + + resourceData.cameraColor = prevCameraColor; } } if (useLensFlare) { // Lens Flares are procedurally generated and blended to the destination texture. - m_LensFlareDataDrivenPass.paniniProjection = paniniProjection; - m_LensFlareDataDrivenPass.destinationTexture = currentSource; m_LensFlareDataDrivenPass.RecordRenderGraph(renderGraph, frameData); } - // Settings - m_UberPass.colorLookup = colorLookup; - m_UberPass.colorAdjustments = colorAdjustments; - m_UberPass.tonemapping = tonemapping; - m_UberPass.bloom = bloom; - m_UberPass.lensDistortion = lensDistortion; - m_UberPass.chromaticAberration = chromaticAberration; - m_UberPass.vignette = vignette; - m_UberPass.filmGrain = filmGrain; - - m_UberPass.isFinalPass = !hasFinalPass; - m_UberPass.requireSRGBConversionBlit = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); - m_UberPass.useFastSRGBLinearConversion = useFastSRGBLinearConversion; + var ditherTexture = cameraData.isDitheringEnabled ? GetNextDitherTexture() : null; + var hdrOperations = HDROutputUtils.Operation.None; + var applySrgbEncoding = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); - //TODO remove once all passes are converted to use the resourceData with cameraColor swapping - resourceData.cameraColor = currentSource; - - var activeOverlayUITextureUberPost = TextureHandle.nullHandle; bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); if (requireHDROutput) { // Color space conversion is already applied through color grading, do encoding if uber post is the last pass // Otherwise encoding will happen in the final post process pass or the final blit pass - m_UberPass.hdrOperations = !hasFinalPass && enableColorEncodingIfNeeded ? HDROutputUtils.Operation.ColorEncoding : HDROutputUtils.Operation.None; - - if(enableColorEncodingIfNeeded && resourceData.overlayUITexture.IsValid()) - activeOverlayUITextureUberPost = resourceData.overlayUITexture; + hdrOperations = !hasFinalPass && enableColorEncodingIfNeeded ? HDROutputUtils.Operation.ColorEncoding : HDROutputUtils.Operation.None; } - var overlayUITexture = resourceData.overlayUITexture; - - resourceData.overlayUITexture = activeOverlayUITextureUberPost; - resourceData.bloom = bloomTexture; - - m_UberPass.ditherTexture = cameraData.isDitheringEnabled ? GetNextDitherTexture() : null; - + bool renderOverlayUI = requireHDROutput && enableColorEncodingIfNeeded && resourceData.overlayUITexture.IsValid(); + m_UberPass.Setup(ditherTexture, hdrOperations, applySrgbEncoding, useFastSRGBLinearConversion, !hasFinalPass, renderOverlayUI); m_UberPass.RecordRenderGraph(renderGraph, frameData); - - resourceData.overlayUITexture = overlayUITexture; } } @@ -404,15 +311,12 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer UniversalCameraData cameraData = frameData.Get(); var stack = VolumeManager.instance.stack; - var tonemapping = stack.GetComponent(); - var filmGrain = stack.GetComponent(); // NOTE: Debug handling injects a global state render pass. UpdateGlobalDebugHandlerPass(renderGraph, cameraData, true); var resourceData = frameData.Get(); - var currentSource = resourceData.cameraColor; - var srcDesc = renderGraph.GetTextureDesc(currentSource); + var sourceDesc = renderGraph.GetTextureDesc(resourceData.cameraColor); HDROutputUtils.Operation hdrOperations = HDROutputUtils.Operation.None; bool requireHDROutput = PostProcessUtils.RequireHDROutput(cameraData); @@ -425,14 +329,14 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer hdrOperations |= HDROutputUtils.Operation.ColorConversion; } - FinalPostProcessPass.SamplingOperation samplingOperation = FinalPostProcessPass.SamplingOperation.Linear; + FinalPostProcessPass.FilteringOperation filteringOperation = FinalPostProcessPass.FilteringOperation.Linear; // Reuse RCAS pass as an optional standalone post sharpening pass for TAA. // This avoids the cost of EASU and is available for other upscaling options. // If FSR is enabled then FSR settings override the TAA settings and we perform RCAS only once. // If STP is enabled, then TAA sharpening has already been performed inside STP. if(PostProcessUtils.IsTaaSharpeningEnabled(cameraData)) - samplingOperation = FinalPostProcessPass.SamplingOperation.TaaSharpening; + filteringOperation = FinalPostProcessPass.FilteringOperation.TaaSharpening; bool applyFxaa = PostProcessUtils.IsFxaaEnabled(cameraData); @@ -450,24 +354,8 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer // When FXAA is needed while scaling is active, we must perform it before the scaling takes place. if (isSetupRequired) { - var scalingSetupDesc = srcDesc; - if (!requireHDROutput) - { - // Select a UNORM format since we've already performed tonemapping. (Values are in 0-1 range) - // This improves precision and is required if we want to avoid excessive banding when FSR is in use. - scalingSetupDesc.format = UniversalRenderPipeline.MakeUnormRenderTextureGraphicsFormat(); - } - - var scalingSetupTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, scalingSetupDesc, ScalingSetupPostProcessPass.k_TargetName, true, FilterMode.Point); - - m_ScalingSetupFinalPostProcessPass.tonemapping = tonemapping; - m_ScalingSetupFinalPostProcessPass.hdrOperations = hdrOperations; - - m_ScalingSetupFinalPostProcessPass.sourceTexture = currentSource; - m_ScalingSetupFinalPostProcessPass.destinationTexture = scalingSetupTarget; - m_ScalingSetupFinalPostProcessPass.RecordRenderGraph(renderGraph,frameData); - - currentSource = m_ScalingSetupFinalPostProcessPass.destinationTexture; + m_ScalingSetupFinalPostProcessPass.Setup(hdrOperations); + m_ScalingSetupFinalPostProcessPass.RecordRenderGraph(renderGraph, frameData); // Indicate that we no longer need to perform FXAA in the final pass since it was already perfomed here. applyFxaa = false; @@ -475,10 +363,10 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer // Upscaling (and downscaling) - var upscaledDesc = srcDesc; + var upscaledDesc = sourceDesc; upscaledDesc.width = cameraData.pixelWidth; upscaledDesc.height = cameraData.pixelHeight; - var upScaleTarget = PostProcessUtils.CreateCompatibleTexture(renderGraph, upscaledDesc, "_UpscaledTexture", true, FilterMode.Point); + // NOTE: upscaledDesc.format != scalingSetupDesc.format (in resourceData.cameraColor) switch (cameraData.imageScalingMode) { @@ -489,8 +377,8 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer case ImageUpscalingFilter.Point: { // TAA post sharpening is an RCAS pass, avoid overriding it with point sampling. - if (samplingOperation != FinalPostProcessPass.SamplingOperation.TaaSharpening) - samplingOperation = FinalPostProcessPass.SamplingOperation.Point; + if (filteringOperation != FinalPostProcessPass.FilteringOperation.TaaSharpening) + filteringOperation = FinalPostProcessPass.FilteringOperation.Point; break; } case ImageUpscalingFilter.Linear: @@ -499,11 +387,9 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer } case ImageUpscalingFilter.FSR: { - m_Fsr1UpscaleFinalPostProcessPass.sourceTexture = currentSource; - m_Fsr1UpscaleFinalPostProcessPass.destinationTexture = upScaleTarget; - m_Fsr1UpscaleFinalPostProcessPass.RecordRenderGraph(renderGraph,frameData); - currentSource = m_Fsr1UpscaleFinalPostProcessPass.destinationTexture; - samplingOperation = FinalPostProcessPass.SamplingOperation.FsrSharpening; + m_Fsr1UpscaleFinalPostProcessPass.Setup(upscaledDesc); + m_Fsr1UpscaleFinalPostProcessPass.RecordRenderGraph(renderGraph, frameData); + filteringOperation = FinalPostProcessPass.FilteringOperation.FsrSharpening; break; } } @@ -515,29 +401,17 @@ public void RenderFinalPostProcessing(RenderGraph renderGraph, ContextContainer // and it's already the default option in the shader. // Also disable TAA post sharpening pass when downscaling. - samplingOperation = FinalPostProcessPass.SamplingOperation.Linear; + filteringOperation = FinalPostProcessPass.FilteringOperation.Linear; break; } } } - //TODO remove once all passes are converted to use the resourceData with cameraColor swapping - resourceData.cameraColor = currentSource; - - bool renderOverlayUI = requireHDROutput && enableColorEncodingIfNeeded && cameraData.rendersOverlayUI; - var overlayUITexture = resourceData.overlayUITexture; - - //We will swap the resourceData.overlayUITexture back after the pass - if (!renderOverlayUI) - resourceData.overlayUITexture = TextureHandle.nullHandle; - - bool applySrgbEncoding = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); var ditherTexture = cameraData.isDitheringEnabled ? GetNextDitherTexture() : null; - - m_FinalPostProcessPass.Setup(samplingOperation, hdrOperations, applySrgbEncoding, applyFxaa, ditherTexture); - m_FinalPostProcessPass.RecordRenderGraph(renderGraph,frameData); - - resourceData.overlayUITexture = overlayUITexture; + bool applySrgbEncoding = RequireSRGBConversionBlitToBackBuffer(cameraData, enableColorEncodingIfNeeded); + bool renderOverlayUI = requireHDROutput && enableColorEncodingIfNeeded && cameraData.rendersOverlayUI; + m_FinalPostProcessPass.Setup(ditherTexture, filteringOperation, hdrOperations, applySrgbEncoding, applyFxaa, renderOverlayUI); + m_FinalPostProcessPass.RecordRenderGraph(renderGraph, frameData); } #endregion } diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs index 10785882b1b..ba1ba87dd9b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RTHandleUtils.cs @@ -176,7 +176,7 @@ internal int GetHashCodeWithNameHash(in TextureDesc texDesc) internal static TextureDesc CreateTextureDesc(RenderTextureDescriptor desc, TextureSizeMode textureSizeMode = TextureSizeMode.Explicit, int anisoLevel = 1, float mipMapBias = 0, FilterMode filterMode = FilterMode.Point, TextureWrapMode wrapMode = TextureWrapMode.Clamp, string name = "") - { + { var format = (desc.depthStencilFormat != GraphicsFormat.None) ? desc.depthStencilFormat : desc.graphicsFormat; TextureDesc rgDesc = new TextureDesc(desc.width, desc.height); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs index 30930e9313f..871fbac13e9 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ReflectionProbeManager.cs @@ -159,7 +159,7 @@ public unsafe void UpdateGpuData(CommandBuffer cmd, ref CullingResults cullResul var probe = probes[probeIndex]; var texture = probe.texture; - var id = probe.reflectionProbe.GetInstanceID(); + var id = probe.reflectionProbe.GetEntityId(); var wasCached = m_Cache.TryGetValue(id, out var cachedProbe); if (!texture) @@ -263,7 +263,7 @@ public unsafe void UpdateGpuData(CommandBuffer cmd, ref CullingResults cullResul for (var probeIndex = 0; probeIndex < probeCount; probeIndex++) { var probe = probes[probeIndex]; - var id = probe.reflectionProbe.GetInstanceID(); + var id = probe.reflectionProbe.GetEntityId(); var dataIndex = probeIndex - skipCount; if (!m_Cache.TryGetValue(id, out var cachedProbe) || !probe.texture) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs index 5737fa52bbc..2c6415a2f51 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature.cs @@ -251,7 +251,7 @@ private void AddFullscreenRenderPassInputPass(RenderGraph renderGraph, Universal if (m_BindDepthStencilAttachment) builder.SetRenderAttachmentDepth(resourcesData.activeDepthTexture, AccessFlags.ReadWrite); - builder.SetRenderFunc((MainPassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (MainPassData data, RasterGraphContext rgContext) => { ExecuteMainPass(rgContext.cmd, data.inputTexture, data.material, data.passIndex); }); @@ -267,7 +267,7 @@ private void AddCopyPassRenderPassFullscreen(RenderGraph renderGraph, TextureHan builder.SetRenderAttachment(destination, 0, AccessFlags.Write); - builder.SetRenderFunc((CopyPassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (CopyPassData data, RasterGraphContext rgContext) => { ExecuteCopyColorPass(rgContext.cmd, data.inputTexture); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs index 755f3e03f82..6c8142f96df 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/FullScreenPassRendererFeature_OldGUID.cs @@ -31,7 +31,7 @@ void DownCast() var serializedObject = new SerializedObject(this); var scriptProperty = serializedObject.FindProperty("m_Script"); MonoScript currentScript = scriptProperty.objectReferenceValue as MonoScript; - AssetDatabase.TryGetGUIDAndLocalFileIdentifier(currentScript.GetInstanceID(), out var currentGUID, out var _); + AssetDatabase.TryGetGUIDAndLocalFileIdentifier(currentScript.GetEntityId(), out var currentGUID, out var _); if (currentGUID != oldGUID) return; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs index c7f306328af..a7b4c7cba9c 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/OnTilePostProcessPass.cs @@ -199,7 +199,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer } builder.SetRenderAttachment(destination, 0, AccessFlags.WriteAll); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => ExecuteFBFetchPass(data, context)); + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => ExecuteFBFetchPass(data, context)); passData.useXRVisibilityMesh = false; passData.msaaSamples = (int)srcDesc.msaaSamples; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs index 9ac588cc20e..29010dd6f13 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/RendererFeatures/ScreenSpaceShadows.cs @@ -177,7 +177,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer if (color.IsValid()) builder.SetGlobalTextureAfterPass(color, m_ScreenSpaceShadowmapTextureID); - builder.SetRenderFunc((PassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext rgContext) => { ExecutePass(rgContext.cmd, data, data.target); }); @@ -232,7 +232,7 @@ public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext rgContext) => { ExecutePass(rgContext.cmd, data.shadowData); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs index fe6b67ecf7e..434c647acd4 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/ScriptableRenderer.cs @@ -405,14 +405,6 @@ static void SetShaderTimeValues(IBaseCommandBuffer cmd, float time, float deltaT cmd.SetGlobalVector(ShaderPropertyId.lastTimeParameters, lastTimeParametersVector); } - /// - /// Returns the camera color target for this renderer. - /// It's only valid to call cameraColorTarget in the scope of ScriptableRenderPass. - /// . - /// - [Obsolete("Use cameraColorTargetHandle. #from(2022.1) #breakingFrom(2023.2)", true)] - public RenderTargetIdentifier cameraColorTarget => throw new NotSupportedException("cameraColorTarget has been deprecated. Use cameraColorTargetHandle instead"); - /// /// Returns a list of renderer features added to this renderer. /// @@ -445,92 +437,18 @@ protected List activeRenderPassQueue /// public GraphicsDeviceType[] unsupportedGraphicsDeviceTypes { get; set; } = new GraphicsDeviceType[0]; - static class RenderPassBlock - { - // Executes render passes that are inputs to the main rendering - // but don't depend on camera state. They all render in monoscopic mode. f.ex, shadow maps. - public static readonly int BeforeRendering = 0; - - // Main bulk of render pass execution. They required camera state to be properly set - // and when enabled they will render in stereo. - public static readonly int MainRenderingOpaque = 1; - public static readonly int MainRenderingTransparent = 2; - - // Execute after Post-processing. - public static readonly int AfterRendering = 3; - } - - private StoreActionsOptimization m_StoreActionsOptimizationSetting = StoreActionsOptimization.Auto; - private static bool m_UseOptimizedStoreActions = false; - - const int k_RenderPassBlockCount = 4; - - /// - /// An RTHandle wrapping the BuiltinRenderTextureType.CameraTarget render target. This is a helper - /// that avoids having to (re)allocate a new RTHandle every time the camera target is needed. - /// - protected static readonly RTHandle k_CameraTarget = RTHandles.Alloc(BuiltinRenderTextureType.CameraTarget); - List m_ActiveRenderPassQueue = new List(32); List m_RendererFeatures = new List(10); - RTHandle m_CameraColorTarget; - RTHandle m_CameraDepthTarget; - RTHandle m_CameraResolveTarget; - - bool m_FirstTimeCameraColorTargetIsBound = true; // flag used to track when m_CameraColorTarget should be cleared (if necessary), as well as other special actions only performed the first time m_CameraColorTarget is bound as a render target - bool m_FirstTimeCameraDepthTargetIsBound = true; // flag used to track when m_CameraDepthTarget should be cleared (if necessary), the first time m_CameraDepthTarget is bound as a render target - // The pipeline can only guarantee the camera target texture are valid when the pipeline is executing. // Trying to access the camera target before or after might be that the pipeline texture have already been disposed. bool m_IsPipelineExecuting = false; internal bool useRenderPassEnabled = false; - // Used to cache nameID of m_ActiveColorAttachments for CoreUtils without allocating arrays at each call - static RenderTargetIdentifier[] m_ActiveColorAttachmentIDs = new RenderTargetIdentifier[8]; - static RTHandle[] m_ActiveColorAttachments = new RTHandle[8]; - static RTHandle m_ActiveDepthAttachment; ContextContainer m_frameData = new(); internal ContextContainer frameData => m_frameData; - private static RenderBufferStoreAction[] m_ActiveColorStoreActions = new RenderBufferStoreAction[] - { - RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, - RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store, RenderBufferStoreAction.Store - }; - - private static RenderBufferStoreAction m_ActiveDepthStoreAction = RenderBufferStoreAction.Store; - - // CommandBuffer.SetRenderTarget(RenderTargetIdentifier[] colors, RenderTargetIdentifier depth, int mipLevel, CubemapFace cubemapFace, int depthSlice); - // called from CoreUtils.SetRenderTarget will issue a warning assert from native c++ side if "colors" array contains some invalid RTIDs. - // To avoid that warning assert we trim the RenderTargetIdentifier[] arrays we pass to CoreUtils.SetRenderTarget. - // To avoid re-allocating a new array every time we do that, we re-use one of these arrays for both RTHandles and RenderTargetIdentifiers: - static RenderTargetIdentifier[][] m_TrimmedColorAttachmentCopyIDs = - { - Array.Empty(), // only used to make indexing code easier to read - new RenderTargetIdentifier[1], - new RenderTargetIdentifier[2], - new RenderTargetIdentifier[3], - new RenderTargetIdentifier[4], - new RenderTargetIdentifier[5], - new RenderTargetIdentifier[6], - new RenderTargetIdentifier[7], - new RenderTargetIdentifier[8], - }; - static RTHandle[][] m_TrimmedColorAttachmentCopies = - { - Array.Empty(), // only used to make indexing code easier to read - new RTHandle[1], - new RTHandle[2], - new RTHandle[3], - new RTHandle[4], - new RTHandle[5], - new RTHandle[6], - new RTHandle[7], - new RTHandle[8], - }; - private static Plane[] s_Planes = new Plane[6]; private static Vector4[] s_VectorPlanes = new Vector4[6]; @@ -564,15 +482,7 @@ public ScriptableRenderer(ScriptableRendererData data) m_RendererFeatures.Add(feature); } useRenderPassEnabled = data.useNativeRenderPass; - Clear(CameraRenderType.Base); m_ActiveRenderPassQueue.Clear(); - - if (UniversalRenderPipeline.asset) - { - m_StoreActionsOptimizationSetting = UniversalRenderPipeline.asset.storeActionsOptimization; - } - - m_UseOptimizedStoreActions = m_StoreActionsOptimizationSetting != StoreActionsOptimization.Store; } /// @@ -672,7 +582,7 @@ private void InitRenderGraphFrame(RenderGraph renderGraph) builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (PassData data, UnsafeGraphContext rgContext) => { UnsafeCommandBuffer cmd = rgContext.cmd; #if UNITY_EDITOR @@ -716,7 +626,7 @@ internal void ProcessVFXCameraCommand(RenderGraph renderGraph) builder.AllowPassCulling(false); - builder.SetRenderFunc((VFXProcessCameraPassData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (VFXProcessCameraPassData data, UnsafeGraphContext context) => { if (data.xrPass != null) data.xrPass.StartSinglePass(context.cmd); @@ -743,7 +653,7 @@ internal void SetupRenderGraphCameraProperties(RenderGraph renderGraph, TextureH builder.AllowGlobalStateModification(true); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { bool yFlipped = SystemInfo.graphicsUVStartsAtTop && RenderingUtils.IsHandleYFlipped(context, in data.target); @@ -819,7 +729,7 @@ internal void DrawRenderGraphGizmos(RenderGraph renderGraph, ContextContainer fr builder.UseRendererList(passData.gizmoRenderList); builder.AllowPassCulling(false); - builder.SetRenderFunc((DrawGizmosPassData data, UnsafeGraphContext rgContext) => + builder.SetRenderFunc(static (DrawGizmosPassData data, UnsafeGraphContext rgContext) => { using (new ProfilingScope(rgContext.cmd, Profiling.drawGizmos)) { @@ -964,7 +874,7 @@ private void SetEditorTarget(RenderGraph renderGraph) { builder.AllowPassCulling(false); - builder.SetRenderFunc((DummyData data, UnsafeGraphContext context) => + builder.SetRenderFunc(static (DummyData data, UnsafeGraphContext context) => { context.cmd.SetRenderTarget(BuiltinRenderTextureType.CameraTarget, RenderBufferLoadAction.Load, RenderBufferStoreAction.Store, // color @@ -1203,10 +1113,6 @@ internal void AddRenderPasses(ref RenderingData renderingData) if (activeRenderPassQueue[i] == null) activeRenderPassQueue.RemoveAt(i); } - - // if any pass was injected, the "automatic" store optimization policy will disable the optimized load actions - if (count > 0 && m_StoreActionsOptimizationSetting == StoreActionsOptimization.Auto) - m_UseOptimizedStoreActions = false; } static void ClearRenderingState(IBaseCommandBuffer cmd) @@ -1236,23 +1142,6 @@ static void ClearRenderingState(IBaseCommandBuffer cmd) cmd.SetGlobalVector(ScreenSpaceAmbientOcclusionPass.s_AmbientOcclusionParamID, Vector4.zero); } - internal void Clear(CameraRenderType cameraType) - { - m_ActiveColorAttachments[0] = k_CameraTarget; - for (int i = 1; i < m_ActiveColorAttachments.Length; ++i) - m_ActiveColorAttachments[i] = null; - for (int i = 0; i < m_ActiveColorAttachments.Length; ++i) - m_ActiveColorAttachmentIDs[i] = m_ActiveColorAttachments[i]?.nameID ?? 0; - - m_ActiveDepthAttachment = k_CameraTarget; - - m_FirstTimeCameraColorTargetIsBound = cameraType == CameraRenderType.Base; - m_FirstTimeCameraDepthTargetIsBound = true; - - m_CameraColorTarget = null; - m_CameraDepthTarget = null; - } - // Scene filtering is enabled when in prefab editing mode internal bool IsSceneFilteringEnabled(Camera camera) { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs b/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs index bf8a3747256..2bb124658fd 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/TemporalAA.cs @@ -568,7 +568,7 @@ internal static void Render(RenderGraph renderGraph, Material taaMaterial, Unive passData.material = taaMaterial; passData.passIndex = kHistoryCopyPass; - builder.SetRenderFunc((TaaPassData data, RasterGraphContext context) => { Blitter.BlitTexture(context.cmd, data.srcColorTex, Vector2.one, data.material, data.passIndex); }); + builder.SetRenderFunc(static (TaaPassData data, RasterGraphContext context) => { Blitter.BlitTexture(context.cmd, data.srcColorTex, Vector2.one, data.material, data.passIndex); }); } cameraData.taaHistory.SetAccumulationVersion(multipassId, Time.frameCount); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index f08e4d15532..65615b12704 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -750,8 +750,6 @@ static void RenderSingleCamera(ScriptableRenderContext context, UniversalCameraD var cameraMetadata = CameraMetadataCache.GetCached(camera); using (new ProfilingScope(cmdScope, cameraMetadata.sampler)) // Enqueues a "BeginSample" command into the CommandBuffer cmd { - renderer.Clear(cameraData.renderType); - using (new ProfilingScope(Profiling.Pipeline.Renderer.setupCullingParameters)) { var legacyCameraData = new CameraData(frameData); @@ -1888,18 +1886,6 @@ static UniversalLightData CreateLightData(ContextContainer frameData, UniversalR lightData.maxPerObjectAdditionalLightsCount = 0; } - if (settings.mainLightRenderingMode == LightRenderingMode.Disabled) - { - var mainLightIndex = GetBrightestDirectionalLightIndex(settings, visibleLights); - if (mainLightIndex != -1) - { - // a visible main light was disabled, since it is still in the visible lights array we need to maintain - // the mainLightIndex otherwise indexing in the lightloop goes wrong - lightData.additionalLightsCount--; - lightData.mainLightIndex = mainLightIndex; - } - } - lightData.supportsAdditionalLights = settings.additionalLightsRenderingMode != LightRenderingMode.Disabled; lightData.shadeAdditionalLightsPerVertex = settings.additionalLightsRenderingMode == LightRenderingMode.PerVertex; lightData.supportsMixedLighting = settings.supportsMixedLighting; diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs index acf0aa6165e..ad10564926b 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRenderer.cs @@ -59,8 +59,6 @@ public sealed partial class UniversalRenderer : ScriptableRenderer const int k_FinalBlitPassQueueOffset = 1; const int k_AfterFinalBlitPassQueueOffset = k_FinalBlitPassQueueOffset + 1; - static readonly List k_DepthNormalsOnly = new List { new ShaderTagId("DepthNormalsOnly") }; - /// public override int SupportedCameraStackingTypes() { diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs index d094149219e..49797a54bf4 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererDebug.cs @@ -201,7 +201,7 @@ private void SetupRenderGraphFinalPassDebug(RenderGraph renderGraph, ContextCont { var debugSettings = DebugHandler.DebugDisplaySettings.gpuResidentDrawerSettings; - GPUResidentDrawer.RenderDebugOcclusionTestOverlay(renderGraph, debugSettings, cameraData.camera.GetInstanceID(), resourceData.activeColorTexture); + GPUResidentDrawer.RenderDebugOcclusionTestOverlay(renderGraph, debugSettings, cameraData.camera.GetEntityId(), resourceData.activeColorTexture); float screenWidth = (int)(cameraData.pixelHeight * cameraData.renderScale); float screenHeight = (int)(cameraData.pixelHeight * cameraData.renderScale); @@ -275,7 +275,7 @@ private void BlitEmptyTexture(RenderGraph renderGraph, TextureHandle destination builder.SetRenderAttachment(destination, 0); builder.AllowPassCulling(false); - builder.SetRenderFunc((CopyToDebugTexturePassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (CopyToDebugTexturePassData data, RasterGraphContext context) => { Blitter.BlitTexture(context.cmd, data.src, new Vector4(1,1,0,0), 0, false); }); diff --git a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs index e9996c62851..0eebdf50bc6 100644 --- a/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs +++ b/Packages/com.unity.render-pipelines.universal/Runtime/UniversalRendererRenderGraph.cs @@ -372,7 +372,7 @@ void CreateRenderGraphCameraRenderTargets(RenderGraph renderGraph, bool isCamera cameraDescriptor.useMipMap = false; cameraDescriptor.autoGenerateMips = false; cameraDescriptor.mipMapBias = 0; - cameraDescriptor.anisoLevel = 0; + cameraDescriptor.anisoLevel = 1; if (requireIntermediateAttachments) { @@ -610,7 +610,7 @@ internal override void OnRecordRenderGraph(RenderGraph renderGraph, ScriptableRe bool requirePrepass = requirePrepassForTextures || useDepthPriming; // Only use a depth format when we do a prepass directly the cameraDepthTexture. If we do depth priming (ie, prepass to the activeCameraDepth), we don't do a prepass to the texture. Instead, we do a copy from the primed attachment. - bool prepassToCameraDepthTexture = requirePrepass && !useDepthPriming; + bool prepassToCameraDepthTexture = requirePrepassForTextures && !usesDeferredLighting; bool depthTextureIsDepthFormat = prepassToCameraDepthTexture; bool requireCopyFromDepth = requireDepthTexture && !prepassToCameraDepthTexture; @@ -778,7 +778,7 @@ private void UpdateInstanceOccluders(RenderGraph renderGraph, UniversalCameraDat int scaledWidth = (int)(cameraData.pixelWidth * cameraData.renderScale); int scaledHeight = (int)(cameraData.pixelHeight * cameraData.renderScale); bool isSinglePassXR = cameraData.xr.enabled && cameraData.xr.singlePassEnabled; - var occluderParams = new OccluderParameters(cameraData.camera.GetInstanceID()) + var occluderParams = new OccluderParameters(cameraData.camera.GetEntityId()) { subviewCount = isSinglePassXR ? 2 : 1, depthTexture = depthTexture, @@ -806,7 +806,7 @@ private void InstanceOcclusionTest(RenderGraph renderGraph, UniversalCameraData { bool isSinglePassXR = cameraData.xr.enabled && cameraData.xr.singlePassEnabled; int subviewCount = isSinglePassXR ? 2 : 1; - var settings = new OcclusionCullingSettings(cameraData.camera.GetInstanceID(), occlusionTest) + var settings = new OcclusionCullingSettings(cameraData.camera.GetEntityId(), occlusionTest) { instanceMultiplier = (isSinglePassXR && !SystemInfo.supportsMultiview) ? 2 : 1, }; @@ -847,7 +847,7 @@ private void RecordCustomPassesWithDepthCopyAndMotion(RenderGraph renderGraph, U private static bool AllowPartialDepthNormalsPrepass(bool isDeferred, RenderPassEvent requiresDepthNormalEvent, bool useDepthPriming) { return isDeferred && ((RenderPassEvent.AfterRenderingGbuffer <= requiresDepthNormalEvent) && - (requiresDepthNormalEvent <= RenderPassEvent.BeforeRenderingOpaques)) && useDepthPriming; + (requiresDepthNormalEvent <= RenderPassEvent.BeforeRenderingOpaques)) && !useDepthPriming; } // Enumeration of possible positions within the frame where the depth copy can occur @@ -935,7 +935,7 @@ private struct TextureCopySchedules internal ColorCopySchedule color; } - private TextureCopySchedules CalculateTextureCopySchedules(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, bool requiresDepthPrepass, bool hasFullPrepass, bool requireDepthTexture) + private TextureCopySchedules CalculateTextureCopySchedules(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, bool isDeferred, bool requiresDepthPrepass, bool hasFullPrepass, bool requireDepthTexture) { // Assume the depth texture is unused and no copy is needed until we determine otherwise DepthCopySchedule depth = DepthCopySchedule.None; @@ -944,7 +944,7 @@ private TextureCopySchedules CalculateTextureCopySchedules(UniversalCameraData c if (requireDepthTexture) { //The prepass will render directly to the depthTexture when not using depth priming. Therefore we don't need a copy in that case. - bool depthTextureRequiresCopy = (!requiresDepthPrepass || useDepthPriming); + bool depthTextureRequiresCopy = isDeferred || (!requiresDepthPrepass || useDepthPriming); depth = depthTextureRequiresCopy ? CalculateDepthCopySchedule(renderPassInputs.requiresDepthTextureEarliestEvent, hasFullPrepass) : DepthCopySchedule.DuringPrepass; @@ -1011,7 +1011,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // - Have a depth normals prepass that does not allow the partial prepass optimization bool hasFullPrepass = isDepthOnlyPrepass || (isDepthNormalPrepass && !AllowPartialDepthNormalsPrepass(usesDeferredLighting, renderPassInputs.requiresDepthNormalAtEvent, useDepthPriming)); - TextureCopySchedules copySchedules = CalculateTextureCopySchedules(cameraData, renderPassInputs, requiresPrepass, hasFullPrepass, requireDepthTexture); + TextureCopySchedules copySchedules = CalculateTextureCopySchedules(cameraData, renderPassInputs, usesDeferredLighting, requiresPrepass, hasFullPrepass, requireDepthTexture); // Decide if & when to use GPU Occlusion Culling. // In deferred, do it during gbuffer laydown unless we are forced to do a *full* prepass by a render pass. @@ -1047,10 +1047,13 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co if (requiresPrepass) { - TextureHandle depthTarget = useDepthPriming ? resourceData.activeDepthTexture : resourceData.cameraDepthTexture; + // If we're in deferred mode, prepasses always render directly to the depth attachment rather than the camera depth texture. + // In non-deferred mode, we only render to the depth attachment directly when depth priming is enabled and we're starting with an empty depth buffer. + bool renderToAttachment = (usesDeferredLighting || useDepthPriming); + TextureHandle depthTarget = renderToAttachment ? resourceData.activeDepthTexture : resourceData.cameraDepthTexture; // Prepare stencil buffer for stencil-based cross-fade lod in depth normal prepass. Depth prepass doesn't use stencil test (same as shadow). - if (renderingData.stencilLodCrossFadeEnabled && isDepthNormalPrepass && !useDepthPriming) + if (renderingData.stencilLodCrossFadeEnabled && isDepthNormalPrepass && !renderToAttachment) m_StencilCrossFadeRenderPass.Render(renderGraph, context, resourceData.cameraDepthTexture); bool needsOccluderUpdate = occluderPass == OccluderPass.DepthPrepass; @@ -1073,7 +1076,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co // When we render to the depth attachment, a copy must happen later to populate the camera depth texture and the copy will handle setting globals. // If we're rendering to the camera depth texture, we can set the globals immediately. - bool setGlobalDepth = isLastPass && !useDepthPriming; + bool setGlobalDepth = isLastPass && !renderToAttachment; // There's no special copy logic for the camera normals texture, so we can set the global as long as we're not performing a partial prepass. // In the case of a partial prepass, the global will be set later by the gbuffer pass once it completes the data in the texture. @@ -1088,7 +1091,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co { SetupRenderGraphCameraProperties(renderGraph, depthTarget); } - DepthNormalPrepassRender(renderGraph, renderPassInputs, depthTarget, batchLayerMask, setGlobalDepth, setGlobalTextures); + DepthNormalPrepassRender(renderGraph, renderPassInputs, depthTarget, batchLayerMask, setGlobalDepth, setGlobalTextures, !hasFullPrepass); // Restore camera properties for the rest of the render graph execution. if (resourceData.isActiveTargetBackBuffer) { @@ -1096,7 +1099,7 @@ private void OnMainRendering(RenderGraph renderGraph, ScriptableRenderContext co } } else - m_DepthPrepass.Render(renderGraph, frameData, ref depthTarget, batchLayerMask, setGlobalDepth); + m_DepthPrepass.Render(renderGraph, frameData, in depthTarget, batchLayerMask, setGlobalDepth); if (needsOccluderUpdate) { @@ -1530,11 +1533,11 @@ static bool RequireDepthTexture(UniversalCameraData cameraData, in RenderPassInp } /// - /// When true the pipeline needs to add a prepass that renders depth to the currentCameraDepth. + /// When true the pipeline needs to add a full prepass that renders depth to the currentCameraDepth. /// Depth priming is an optimization (on certain devices/platforms). Features that want to leverage this as an optimization /// need to check UniversalRender.useDepthPriming (which equal to the result of this function) /// to ensure that the pipeline will actually do depth priming. - /// When this is true then we are sure that after RenderPassEvent.AfterRenderingPrePasses the currentCameraDepth has been primed. + /// When this is true then we are sure that after RenderPassEvent.AfterRenderingPrePasses the currentCameraDepth has been primed with the full depth. /// static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in RenderPassInputSummary renderPassInputs, DepthPrimingMode depthPrimingMode, bool requireDepthTexture, bool requirePrepassForTextures, bool usesDeferredLighting) { @@ -1574,19 +1577,6 @@ static bool IsDepthPrimingEnabledRenderGraph(UniversalCameraData cameraData, in bool depthPrimingRequested = (depthPrimingRecommended && depthPrimingMode == DepthPrimingMode.Auto) || depthPrimingMode == DepthPrimingMode.Forced; bool isNotMSAA = cameraData.cameraTargetDescriptor.msaaSamples == 1; - { - //TODO this need to be further investigated. This moved here from the MainRendering to consolidate all the depth priming logic in one place. The PR that landed this aimed to refactor without unnecessarily changing behavior. - //The prepass and gbuffer logic should have an alternative path that can handle depth priming off. This way, we can respect the user setting Never and Forced. - //Priming is bad for performance when using deferred so we don't allow it. However, when a prepass for textures is required, the gbuffer pass currently - //relies on the prepass writing the same (activeCameraDepth) depth resource. - bool needsPrimingForDeferredWithPartialPrepass = usesDeferredLighting - && ((RenderPassEvent.AfterRenderingGbuffer <= renderPassInputs.requiresDepthNormalAtEvent) && - (renderPassInputs.requiresDepthNormalAtEvent <= RenderPassEvent.BeforeRenderingOpaques)) - && requirePrepassForTextures; - if (needsPrimingForDeferredWithPartialPrepass) - return true; - } - bool isFirstCameraToWriteDepth = cameraData.renderType == CameraRenderType.Base || cameraData.clearDepth; // Depth is not rendered in a depth-only camera setup with depth priming (UUM-38158) bool isNotOffscreenDepthTexture = !IsOffscreenDepthTexture(cameraData); @@ -1921,7 +1911,7 @@ void CreateRenderingLayersTexture(RenderGraph renderGraph, TextureDesc descripto } } - void DepthNormalPrepassRender(RenderGraph renderGraph, RenderPassInputSummary renderPassInputs, TextureHandle depthTarget, uint batchLayerMask, bool setGlobalDepth, bool setGlobalTextures) + void DepthNormalPrepassRender(RenderGraph renderGraph, RenderPassInputSummary renderPassInputs, in TextureHandle depthTarget, uint batchLayerMask, bool setGlobalDepth, bool setGlobalTextures, bool partialPass) { UniversalResourceData resourceData = frameData.Get(); @@ -1935,20 +1925,7 @@ void DepthNormalPrepassRender(RenderGraph renderGraph, RenderPassInputSummary re m_DepthNormalPrepass.enableRenderingLayers = false; } - if (usesDeferredLighting) - { - // Only render forward-only geometry, as standard geometry will be rendered as normal into the gbuffer. - if (AllowPartialDepthNormalsPrepass(usesDeferredLighting, renderPassInputs.requiresDepthNormalAtEvent, useDepthPriming)) - m_DepthNormalPrepass.shaderTagIds = k_DepthNormalsOnly; - - // TODO RENDERGRAPH: commented this out since would be equivalent to the current behaviour? Double check - //if (!m_RenderingLayerProvidesByDepthNormalPass) - // renderingLayersTexture = resourceData.gbuffer[m_DeferredLights.GBufferRenderingLayers]; // GBUffer texture here - } - - TextureHandle normalsTexture = resourceData.cameraNormalsTexture; - TextureHandle renderingLayersTexture = resourceData.renderingLayersTexture; - m_DepthNormalPrepass.Render(renderGraph, frameData, normalsTexture, depthTarget, renderingLayersTexture, batchLayerMask, setGlobalDepth, setGlobalTextures); + m_DepthNormalPrepass.Render(renderGraph, frameData, resourceData.cameraNormalsTexture, in depthTarget, resourceData.renderingLayersTexture, batchLayerMask, setGlobalDepth, setGlobalTextures, partialPass); if (m_RequiresRenderingLayer) SetRenderingLayersGlobalTextures(renderGraph); @@ -1993,7 +1970,7 @@ public static void SetGlobalTexture(RenderGraph graph, int nameId, TextureHandle builder.SetGlobalTextureAfterPass(handle, nameId); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { }); } @@ -2047,7 +2024,7 @@ internal static void Render(RenderGraph graph, TextureHandle colorHandle, Textur builder.AllowPassCulling(false); - builder.SetRenderFunc((PassData data, RasterGraphContext context) => + builder.SetRenderFunc(static (PassData data, RasterGraphContext context) => { context.cmd.ClearRenderTarget(data.clearFlags, data.clearColor, 1, 0); }); diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity index 15f0a2c0b82..e403a02cb7f 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/CameraStacking/MixedFOV/MixedFOV.unity @@ -207,6 +207,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &15946185 MeshFilter: @@ -319,6 +320,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &67584135 MeshFilter: @@ -447,6 +449,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 1 + m_UseReflectionProbes: 0 m_AdditionalShaderChannelsFlag: 1 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -561,6 +564,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &156759407 MeshFilter: @@ -700,6 +704,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &164721799 MeshFilter: @@ -831,6 +836,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &194942086 MeshFilter: @@ -928,6 +934,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &385566022 MeshFilter: @@ -987,6 +994,10 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 131481531} m_Modifications: + - target: {fileID: 1028709304226404832, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Name value: CheckAssignedRenderPipelineAsset @@ -1147,7 +1158,7 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 705507993} m_Enabled: 1 - serializedVersion: 12 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 1 @@ -1199,7 +1210,7 @@ Light: m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 m_ForceVisible: 0 - m_ShadowRadius: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 m_LightUnit: 1 m_LuxAtDistance: 1 @@ -1336,6 +1347,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &742501542 MeshFilter: @@ -1475,6 +1487,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &922637797 MeshFilter: @@ -1526,6 +1539,159 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 16 m_CollisionDetection: 0 +--- !u!1 &935640735 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 8282558930070009747} + m_PrefabAsset: {fileID: 0} +--- !u!114 &935640739 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935640735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::NewFirstPersonControler + moveSpeed: 5 + gravity: -9.81 + lookSensitivity: 1 + baseCamera: {fileID: 8282558930070009751} +--- !u!114 &935640740 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935640735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: f426eb113dac7124d897c338662b4024, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_TargetAssemblyTypeName: UnityEditor.MonoScript, UnityEditor.CoreModule + m_MethodName: set_name + m_Mode: 5 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: Onlook + m_BoolArgument: 0 + m_CallState: 2 + - m_Target: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_TargetAssemblyTypeName: UnityEditor.MonoScript, UnityEditor.CoreModule + m_MethodName: set_name + m_Mode: 5 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: OnMove + m_BoolArgument: 0 + m_CallState: 2 + - m_Target: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_TargetAssemblyTypeName: UnityEditor.MonoScript, UnityEditor.CoreModule + m_MethodName: set_name + m_Mode: 5 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: OnFire + m_BoolArgument: 0 + m_CallState: 2 + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 68156268-5c1f-4acc-955e-d121992f8ad5 + m_ActionName: 'Player/Move[/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow,/46D-C2AB/stick]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: e2f24dfb-116f-4941-8f88-cf0a20903c6a + m_ActionName: 'Player/Look[/Mouse/delta,/Touchscreen/delta,/Pen/delta]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 75aea007-8293-456a-9d47-5442fc0f5e68 + m_ActionName: 'Player/Fire[/Mouse/leftButton,/Touchscreen/primaryTouch/tap,/46D-C2AB/trigger]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 11b2185d-2fb4-4c89-aafd-748da443e2dc + m_ActionName: 'UI/Navigate[/46D-C2AB/stick/up,/46D-C2AB/stick/down,/46D-C2AB/stick/left,/46D-C2AB/stick/right,/Keyboard/w,/Keyboard/upArrow,/Keyboard/s,/Keyboard/downArrow,/Keyboard/a,/Keyboard/leftArrow,/Keyboard/d,/Keyboard/rightArrow]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: d587f992-6a9d-4333-a252-7293b674fd36 + m_ActionName: 'UI/Submit[/Keyboard/enter]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 86ee9931-c691-4e12-a075-6a5bc7be2520 + m_ActionName: 'UI/Cancel[/Keyboard/escape]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: e49d4a8d-a0ca-4893-bc77-263954f4eb13 + m_ActionName: 'UI/Point[/Mouse/position,/Pen/position,/Touchscreen/touch0/position,/Touchscreen/touch1/position,/Touchscreen/touch2/position,/Touchscreen/touch3/position,/Touchscreen/touch4/position,/Touchscreen/touch5/position,/Touchscreen/touch6/position,/Touchscreen/touch7/position,/Touchscreen/touch8/position,/Touchscreen/touch9/position]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 05a94944-eece-456c-a514-3c74d0b37a64 + m_ActionName: 'UI/Click[/Mouse/leftButton,/Pen/tip,/Touchscreen/touch0/press,/Touchscreen/touch1/press,/Touchscreen/touch2/press,/Touchscreen/touch3/press,/Touchscreen/touch4/press,/Touchscreen/touch5/press,/Touchscreen/touch6/press,/Touchscreen/touch7/press,/Touchscreen/touch8/press,/Touchscreen/touch9/press]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 8334b98a-d9f5-4295-8292-7d83bbc450ea + m_ActionName: 'UI/ScrollWheel[/Mouse/scroll]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 0862ed31-cb59-4cb8-b655-58f1fcc629e2 + m_ActionName: 'UI/MiddleClick[/Mouse/middleButton]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 6f006a1f-a75d-47a8-a238-82d8b73cb7bc + m_ActionName: 'UI/RightClick[/Mouse/rightButton]' + - m_PersistentCalls: + m_Calls: [] + m_ActionId: 09be00e8-57eb-45df-a37e-77e4e01d7239 + m_ActionName: UI/TrackedDevicePosition + - m_PersistentCalls: + m_Calls: [] + m_ActionId: ac15ba30-53c8-49bc-a859-98024bf21458 + m_ActionName: UI/TrackedDeviceOrientation + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: Player + m_SplitScreenIndex: -1 + m_Camera: {fileID: 8282558930070009751} +--- !u!114 &935640743 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 935640735} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e2ca254cf5a4eb443bba3eb4c9b3035b, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::CameraManagement + baseCamera: {fileID: 8282558930070009751} + overlayCamera: {fileID: 1434764562} --- !u!1 &1062089488 GameObject: m_ObjectHideFlags: 0 @@ -1614,6 +1780,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1062089491 MeshFilter: @@ -1745,6 +1912,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1188625086 MeshFilter: @@ -1842,6 +2010,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1402436728 MeshFilter: @@ -2148,6 +2317,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1490055368 MeshFilter: @@ -2157,85 +2327,6 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1490055364} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1 &1574701474 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1574701477} - - component: {fileID: 1574701476} - - component: {fileID: 1574701478} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1574701476 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1574701474} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &1574701477 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1574701474} - serializedVersion: 2 - 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1574701478 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1574701474} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} - m_Name: - m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.UI.InputSystemUIInputModule - m_SendPointerHoverToParent: 1 - m_MoveRepeatDelay: 0.5 - m_MoveRepeatRate: 0.1 - m_XRTrackingOrigin: {fileID: 0} - m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3} - m_DeselectOnBackgroundClick: 1 - m_PointerBehavior: 0 - m_CursorLockBehavior: 0 - m_ScrollDeltaPerTick: 6 --- !u!1 &1592661739 GameObject: m_ObjectHideFlags: 0 @@ -2324,6 +2415,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1592661742 MeshFilter: @@ -2436,6 +2528,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1667562488 MeshFilter: @@ -2575,6 +2668,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1675440457 MeshFilter: @@ -2704,6 +2798,11 @@ PrefabInstance: value: This sample shows how Camera Stacking can be used in an FPS game to prevent the gun from clipping into walls. This setup also makes it possible to have different Field of Views for the "Level" camera and the "Gun" camera. + Use the fire button to switch between cameras. + objectReference: {fileID: 0} + - target: {fileID: 8490861713229784074, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} + propertyPath: m_SizeDelta.y + value: 75 objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] @@ -2803,6 +2902,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1823617475 MeshFilter: @@ -2915,6 +3015,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1856286181 MeshFilter: @@ -3046,6 +3147,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1857608333 MeshFilter: @@ -3081,7 +3183,7 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1862309426} m_Enabled: 1 - serializedVersion: 12 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} m_Intensity: 0.5 @@ -3133,7 +3235,7 @@ Light: m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 m_ForceVisible: 0 - m_ShadowRadius: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 m_LightUnit: 1 m_LuxAtDistance: 1 @@ -3270,6 +3372,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &1913427153 MeshFilter: @@ -3382,6 +3485,7 @@ MeshRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &2042961014 MeshFilter: @@ -3601,7 +3705,7 @@ PrefabInstance: m_Modifications: - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_Name - value: Cameras + value: Player objectReference: {fileID: 0} - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RootOrder @@ -3667,6 +3771,10 @@ PrefabInstance: propertyPath: m_Name value: Level Camera objectReference: {fileID: 0} + - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_MoveWithMouse value: 1 @@ -3676,24 +3784,39 @@ PrefabInstance: value: 100 objectReference: {fileID: 0} m_RemovedComponents: + - {fileID: 0} - {fileID: 8900132868616544278, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + - {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} m_RemovedGameObjects: [] m_AddedGameObjects: - targetCorrespondingSourceObject: {fileID: 3363522893988168260, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} insertIndex: -1 addedObject: {fileID: 1434764559} - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 935640739} + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 935640740} + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 935640743} m_SourcePrefab: {fileID: 100100000, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} --- !u!4 &8282558930070009748 stripped Transform: m_CorrespondingSourceObject: {fileID: 3363522893988168260, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} m_PrefabInstance: {fileID: 8282558930070009747} m_PrefabAsset: {fileID: 0} +--- !u!20 &8282558930070009751 stripped +Camera: + m_CorrespondingSourceObject: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 8282558930070009747} + m_PrefabAsset: {fileID: 0} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 131481531} - - {fileID: 1574701477} - {fileID: 567206876} - {fileID: 8282558930070009747} diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity index 26c68993549..9847801549a 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/Shaders/Lit/Lit.unity @@ -38,12 +38,12 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 1090784526} - m_IndirectSpecularColor: {r: 0.18098786, g: 0.22654998, b: 0.3072675, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: m_ObjectHideFlags: 0 - serializedVersion: 12 + serializedVersion: 13 + m_BakeOnSceneLoad: 0 m_GISettings: serializedVersion: 2 m_BounceScale: 1 @@ -93,10 +93,8 @@ LightmapSettings: m_ExportTrainingData: 0 m_TrainingDataDestination: TrainingData m_LightProbeSampleCountMultiplier: 4 - m_LightingDataAsset: {fileID: 112000000, guid: 7632e9382edaf42eea71fffda301b7e4, - type: 2} - m_LightingSettings: {fileID: 4890085278179872738, guid: cce5fc22d530544e9baddea9febf9776, - type: 2} + m_LightingDataAsset: {fileID: 112000000, guid: 7632e9382edaf42eea71fffda301b7e4, type: 2} + m_LightingSettings: {fileID: 4890085278179872738, guid: cce5fc22d530544e9baddea9febf9776, type: 2} --- !u!196 &4 NavMeshSettings: serializedVersion: 2 @@ -129,164 +127,131 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapText objectReference: {fileID: 0} - - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 673fd4308d68a4e6eb452d59b21ff3d4, type: 2} - - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normal Map With Height Map' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_RootOrder value: 8 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.x value: 12.6 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: HeightMap objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 673fd4308d68a4e6eb452d59b21ff3d4, type: 2} - - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapQuad objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normal Map No Height Map' objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -303,359 +268,283 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 175851581590636847, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 175851581590636847, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 363678494143714049, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 363678494143714049, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Metallic Map objectReference: {fileID: 0} - - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 703742556405561692, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.w value: -0.37843886 objectReference: {fileID: 0} - - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.y value: 0.92562634 objectReference: {fileID: 0} - - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 707564616722749779, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 224.474 objectReference: {fileID: 0} - - target: {fileID: 792100534224308606, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 792100534224308606, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: c2809691a61fc4a43b6483eee535d786, type: 2} - - target: {fileID: 1579627784970439916, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 1579627784970439916, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: MetallicText objectReference: {fileID: 0} - - target: {fileID: 1700924697434049057, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 1700924697434049057, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: c2809691a61fc4a43b6483eee535d786, type: 2} - - target: {fileID: 1856864314734137278, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 1856864314734137278, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: EmisisonSphere objectReference: {fileID: 0} - - target: {fileID: 2325730147888387742, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2325730147888387742, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: NormalText objectReference: {fileID: 0} - - target: {fileID: 2384831340507027100, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2384831340507027100, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2516708741707952774, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2516708741707952774, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e2d3ad60e29e404da68fa903eaff772, type: 2} - - target: {fileID: 2984202550618798972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 2984202550618798972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e1368ee81423418da8a693099ce68c0, type: 2} - - target: {fileID: 3158804035374670811, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3158804035374670811, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: HeightSphere objectReference: {fileID: 0} - - target: {fileID: 3432419910411265175, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3432419910411265175, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 3519193640892908046, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3519193640892908046, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: db2f9e1b0d51c4244972d007409c5d1a, type: 2} - - target: {fileID: 3632988833837816489, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3632988833837816489, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: NormalSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Height Map objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3639366238018879424, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 3690115919084241155, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3690115919084241155, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: EmissionText objectReference: {fileID: 0} - - target: {fileID: 3903542586167764489, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 3903542586167764489, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 4466141343835727266, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4466141343835727266, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: OcclusionText objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_RootOrder value: 11 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalPosition.x value: 26.3 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757494, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: Texture Maps objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863344285757497, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345698722662, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: db2f9e1b0d51c4244972d007409c5d1a, type: 2} - - target: {fileID: 4515863345698722664, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345698722664, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: HeightQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345714478689, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e1368ee81423418da8a693099ce68c0, type: 2} - - target: {fileID: 4515863345714478691, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4515863345714478691, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: NormalQuad objectReference: {fileID: 0} - - target: {fileID: 4519952585507003653, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4519952585507003653, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: BaseQuad objectReference: {fileID: 0} - - target: {fileID: 4868844637098708737, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 4868844637098708737, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: OcclusionSphere objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 5084966873698575717, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 5838474508579879326, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 5838474508579879326, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 5982961926340784712, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 5982961926340784712, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: EmisisonQuad objectReference: {fileID: 0} - - target: {fileID: 6328839550329180593, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6328839550329180593, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: HeightText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Normal Map objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6329929520080556972, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 6381987796755295956, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 6381987796755295956, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 71d0ae4a494e24fc8842080c57cdeee7, type: 2} - - target: {fileID: 7176882605897474993, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7176882605897474993, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7422092480594011468, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7422092480594011468, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: OcclusionQuad objectReference: {fileID: 0} - - target: {fileID: 7444712557463921412, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7444712557463921412, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: BaseText objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Base Map objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7499780522273572509, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 7594455542058088936, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7594455542058088936, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: MetallicQuad objectReference: {fileID: 0} - - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Emission Map objectReference: {fileID: 0} - - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 7992821393818068015, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 8078821430268539671, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 8078821430268539671, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: MetallicSphere objectReference: {fileID: 0} - - target: {fileID: 8220988234712831962, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 8220988234712831962, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e2d3ad60e29e404da68fa903eaff772, type: 2} - - target: {fileID: 8492668814307491323, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 8492668814307491323, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Name value: BaseSphere objectReference: {fileID: 0} - - target: {fileID: 9066520212796099257, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 9066520212796099257, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 71d0ae4a494e24fc8842080c57cdeee7, type: 2} - - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_Text value: Occlusion Map objectReference: {fileID: 0} - - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, - type: 3} + - target: {fileID: 9205124857158510153, guid: a62ae87b83afd45458e3e92c3f072830, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -672,164 +561,131 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapText objectReference: {fileID: 0} - - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 92b3aa099ecb9483381c91aba9894aad, type: 2} - - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'With Normal Map' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_RootOrder value: 7 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.x value: 9.4 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.x value: -0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.y value: -0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.z value: -0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NormalMap objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 92b3aa099ecb9483381c91aba9894aad, type: 2} - - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapQuad objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Without Normal Map' objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -838,6 +694,57 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b350d0ee6adff493c954545853ab9922, type: 3} +--- !u!1 &671775837 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 1925206219} + m_PrefabAsset: {fileID: 0} +--- !u!114 &671775840 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671775837} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::FirstPersonController + moveSpeed: 5 + gravity: -9.81 + lookSensitivity: 0.5 + baseCamera: {fileID: 1703775717} +--- !u!114 &671775841 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 671775837} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: f426eb113dac7124d897c338662b4024, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: [] + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: [] + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: + m_SplitScreenIndex: -1 + m_Camera: {fileID: 1703775717} --- !u!1001 &734120777 PrefabInstance: m_ObjectHideFlags: 0 @@ -846,198 +753,157 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba07f5ddfe8f94c61ac3c22a32d15fc4, type: 2} - - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BlueEmissionText objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: No Emission objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: Emission Map objectReference: {fileID: 0} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba07f5ddfe8f94c61ac3c22a32d15fc4, type: 2} - - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BlueEmissionSphere objectReference: {fileID: 0} - - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: NoEmissionText objectReference: {fileID: 0} - - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: NoEmissionQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BlueEmissionQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 0c32055e4135a484b913cc24d7fd1be5, type: 2} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: Emission objectReference: {fileID: 0} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_RootOrder value: 10 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.x value: 19.6 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: 'Bright blue Emission' objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: NoEmissionSphere objectReference: {fileID: 0} - - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 0c32055e4135a484b913cc24d7fd1be5, type: 2} @@ -1057,6 +923,11 @@ GameObject: - component: {fileID: 902575298} - component: {fileID: 902575297} - component: {fileID: 902575296} + - component: {fileID: 902575299} + - component: {fileID: 902575303} + - component: {fileID: 902575302} + - component: {fileID: 902575301} + - component: {fileID: 902575300} m_Layer: 0 m_Name: Floor m_TagString: Untagged @@ -1083,6 +954,9 @@ MeshRenderer: m_RayTraceProcedural: 0 m_RayTracingAccelStructBuildFlagsOverride: 0 m_RayTracingAccelStructBuildFlags: 1 + m_SmallMeshCulling: 1 + m_ForceMeshLod: -1 + m_MeshLodSelectionBias: 0 m_RenderingLayerMask: 1 m_RendererPriority: 0 m_Materials: @@ -1104,9 +978,11 @@ MeshRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} + m_GlobalIlluminationMeshLod: 0 m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 + m_MaskInteraction: 0 m_AdditionalVertexStreams: {fileID: 0} --- !u!33 &902575297 MeshFilter: @@ -1131,6 +1007,112 @@ Transform: m_Children: [] m_Father: {fileID: 909040152} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &902575299 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0} +--- !u!65 &902575300 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.015852813, y: 0.09999999, z: 0.62597126} + m_Center: {x: -0.38, y: 0.049999993, z: -0.00012832641} +--- !u!65 &902575301 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 0.015852813, y: 0.09999999, z: 0.62597126} + m_Center: {x: 0.99026203, y: 0.049999993, z: -0.00012832641} +--- !u!65 &902575302 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1.3748568, y: 0.09999999, z: 0.01} + m_Center: {x: 0.3107637, y: 0.049999993, z: -0.31} +--- !u!65 &902575303 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 902575294} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Size: {x: 1.3748568, y: 0.09999999, z: 0.01} + m_Center: {x: 0.3107637, y: 0.049999993, z: 0.31} --- !u!1 &909040151 GameObject: m_ObjectHideFlags: 0 @@ -1193,14 +1175,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1090784525} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 0.9909949, b: 0.9669811, a: 1} m_Intensity: 1 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -1244,8 +1226,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 - m_ShadowRadius: 0 + m_ForceVisible: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!4 &1090784527 Transform: m_ObjectHideFlags: 0 @@ -1273,17 +1259,23 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} m_Name: m_EditorClassIdentifier: - m_Version: 3 m_UsePipelineSettings: 1 m_AdditionalLightsShadowResolutionTier: 2 - m_LightLayerMask: 1 - m_RenderingLayers: 1 m_CustomShadowLayers: 0 - m_ShadowLayerMask: 1 - m_ShadowRenderingLayers: 1 m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 1 + m_RenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_ShadowRenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_Version: 4 + m_LightLayerMask: 1 + m_ShadowLayerMask: 1 + m_RenderingLayers: 1 + m_ShadowRenderingLayers: 1 --- !u!1 &1157374852 GameObject: m_ObjectHideFlags: 0 @@ -1341,164 +1333,131 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 363678494143714049, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2325730147888387742, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapText objectReference: {fileID: 0} - - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 2984202550618798972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3158804035374670811, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3519193640892908046, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 615945db2db8246c39b806c45ece2fa7, type: 2} - - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3632988833837816489, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normap Map With Occlusion Map' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 3639366238018879424, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.025 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_RootOrder value: 9 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.x value: 15.8 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757494, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: Occlusion objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863344285757497, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722662, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 615945db2db8246c39b806c45ece2fa7, type: 2} - - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345698722664, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478689, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ba4db6da9324f499ab79a4b3c8e476d1, type: 2} - - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 4515863345714478691, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: NoMapQuad objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 5084966873698575717, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6328839550329180593, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_Text value: 'Normal Map No Occlusion Map' objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, - type: 3} + - target: {fileID: 6329929520080556972, guid: b350d0ee6adff493c954545853ab9922, type: 3} propertyPath: m_CharacterSize value: 0.025 objectReference: {fileID: 0} @@ -1548,14 +1507,14 @@ Light: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1647640623} m_Enabled: 1 - serializedVersion: 11 + serializedVersion: 13 m_Type: 1 m_Color: {r: 1, g: 0.944407, b: 0.8443396, a: 1} m_Intensity: 0.2 m_Range: 10 m_SpotAngle: 30 m_InnerSpotAngle: 21.80208 - m_CookieSize: 10 + m_CookieSize2D: {x: 10, y: 10} m_Shadows: m_Type: 2 m_Resolution: -1 @@ -1599,8 +1558,12 @@ Light: m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} m_UseBoundingSphereOverride: 0 m_UseViewFrustumForShadowCasterCull: 1 - m_ShadowRadius: 0 + m_ForceVisible: 0 + m_ShapeRadius: 0 m_ShadowAngle: 0 + m_LightUnit: 1 + m_LuxAtDistance: 1 + m_EnableSpotReflector: 1 --- !u!114 &1647640626 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1613,85 +1576,28 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3} m_Name: m_EditorClassIdentifier: - m_Version: 3 m_UsePipelineSettings: 1 m_AdditionalLightsShadowResolutionTier: 2 - m_LightLayerMask: 1 - m_RenderingLayers: 1 m_CustomShadowLayers: 0 - m_ShadowLayerMask: 1 - m_ShadowRenderingLayers: 1 m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 1 ---- !u!1 &1720569094 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1720569097} - - component: {fileID: 1720569096} - - component: {fileID: 1720569095} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1720569095 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1720569094} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_SendPointerHoverToParent: 1 - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 ---- !u!114 &1720569096 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1720569094} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &1720569097 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} + m_RenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_ShadowRenderingLayersMask: + serializedVersion: 0 + m_Bits: 1 + m_Version: 4 + m_LightLayerMask: 1 + m_ShadowLayerMask: 1 + m_RenderingLayers: 1 + m_ShadowRenderingLayers: 1 +--- !u!20 &1703775717 stripped +Camera: + m_CorrespondingSourceObject: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + m_PrefabInstance: {fileID: 1925206219} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1720569094} - serializedVersion: 2 - 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_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1925206219 PrefabInstance: m_ObjectHideFlags: 0 @@ -1700,93 +1606,75 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 1104701761066559480, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_ClearFlags value: 1 objectReference: {fileID: 0} - - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_Name value: FirstPersonPlayer objectReference: {fileID: 0} - - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalPosition.x value: -2.5 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalPosition.y value: 1 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalPosition.z value: -3 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.w value: 0.9273146 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.y value: 0.3742829 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 43.96 objectReference: {fileID: 0} - - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 4212382672143566193, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_Antialiasing value: 2 objectReference: {fileID: 0} - - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RendererIndex value: 0 objectReference: {fileID: 0} - - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 6350239021526260069, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_RenderPostProcessing value: 1 objectReference: {fileID: 0} - - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, - type: 3} + - target: {fileID: 8509898242313118626, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} propertyPath: m_MovementSpeed value: 4 objectReference: {fileID: 0} @@ -1794,7 +1682,13 @@ PrefabInstance: - {fileID: 8900132868616544278, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} m_RemovedGameObjects: [] m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 671775841} + - targetCorrespondingSourceObject: {fileID: 2148271877166492642, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} + insertIndex: -1 + addedObject: {fileID: 671775840} m_SourcePrefab: {fileID: 100100000, guid: 8089b5fe6d8304423814ff197221f77d, type: 3} --- !u!1001 &1932534512 PrefabInstance: @@ -1804,108 +1698,87 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 222607664510397816} m_Modifications: - - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6308746673132675046, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Name value: CheckAssignedRenderPipelineAsset objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Pivot.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_Pivot.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMax.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMax.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMin.x value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchorMin.y value: 0.5 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_SizeDelta.x value: 100 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_SizeDelta.y value: 100 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_AnchoredPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + - target: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} @@ -1916,8 +1789,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} --- !u!224 &1932534513 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, - type: 3} + m_CorrespondingSourceObject: {fileID: 6858826011774340517, guid: 49a291c27c0b243438a861a905fcc73e, type: 3} m_PrefabInstance: {fileID: 1932534512} m_PrefabAsset: {fileID: 0} --- !u!1001 &1951643861 @@ -1928,266 +1800,211 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 175851581590636847, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 175851581590636847, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 7e1dd3465110745d9820dc9c8a97152e, type: 2} - - target: {fileID: 363678494143714049, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 363678494143714049, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2325730147888387742, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 2325730147888387742, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MetallicText objectReference: {fileID: 0} - - target: {fileID: 2384831340507027100, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 2384831340507027100, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 2984202550618798972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 2984202550618798972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e58fe99dbdc941fbb127782a5413890, type: 2} - - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: SmoothSphere objectReference: {fileID: 0} - - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3158804035374670811, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_StaticEditorFlags value: 64 objectReference: {fileID: 0} - - target: {fileID: 3519193640892908046, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3519193640892908046, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: cd8dde816b1e341aa9dd9afca2da9937, type: 2} - - target: {fileID: 3632988833837816489, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3632988833837816489, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MetallicSphere objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: 'Smoothness One' objectReference: {fileID: 0} - - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 3639366238018879424, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 4466141343835727266, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4466141343835727266, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_RootOrder value: 6 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalPosition.x value: 5 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757494, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: Metallic/Smoothness objectReference: {fileID: 0} - - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863344285757497, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 4515863345698722662, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345698722662, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: cd8dde816b1e341aa9dd9afca2da9937, type: 2} - - target: {fileID: 4515863345698722664, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345698722664, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: SmoothQuad objectReference: {fileID: 0} - - target: {fileID: 4515863345714478689, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345714478689, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 3e58fe99dbdc941fbb127782a5413890, type: 2} - - target: {fileID: 4515863345714478691, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4515863345714478691, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MetallicQuad objectReference: {fileID: 0} - - target: {fileID: 4519952585507003653, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4519952585507003653, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: ZeroQuad objectReference: {fileID: 0} - - target: {fileID: 4868844637098708737, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 4868844637098708737, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 5084966873698575717, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 5084966873698575717, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 5838474508579879326, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 5838474508579879326, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 7e1dd3465110745d9820dc9c8a97152e, type: 2} - - target: {fileID: 6328839550329180593, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6328839550329180593, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: SmoothText objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: "Metallic \nOne" objectReference: {fileID: 0} - - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6329929520080556972, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 6381987796755295956, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 6381987796755295956, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: bfe840013b1e840cdbc00d83632179e8, type: 2} - - target: {fileID: 7176882605897474993, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7176882605897474993, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7422092480594011468, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7422092480594011468, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 7444712557463921412, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7444712557463921412, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: ZeroText objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: 'Metallic/Smoothness Zero' objectReference: {fileID: 0} - - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 7499780522273572509, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} - - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Name value: ZeroSphere objectReference: {fileID: 0} - - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 8492668814307491323, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_StaticEditorFlags value: 64 objectReference: {fileID: 0} - - target: {fileID: 9066520212796099257, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 9066520212796099257, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: bfe840013b1e840cdbc00d83632179e8, type: 2} - - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_Text value: Metallic Map objectReference: {fileID: 0} - - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, - type: 3} + - target: {fileID: 9205124857158510153, guid: f6c633bbe2d20466fb1f016e0dd1f6cd, type: 3} propertyPath: m_CharacterSize value: 0.03 objectReference: {fileID: 0} @@ -2269,123 +2086,99 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 222607664510397816} m_Modifications: - - target: {fileID: 155458132493177538, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 155458132493177538, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Name value: MainPanel objectReference: {fileID: 0} - - target: {fileID: 1638750836712682043, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 1638750836712682043, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Text value: Lit Shader objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Pivot.x value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Pivot.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_RootOrder value: 2 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMax.x value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMax.y value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMin.x value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchorMin.y value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_SizeDelta.x value: 400 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_SizeDelta.y value: 250 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_AnchoredPosition.y value: -250 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 4039968741557396746, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + - target: {fileID: 4039968741557396746, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} propertyPath: m_Text value: This sample shows how different properties of the Lit shader affect the surface. Use the materials and textures as guidelines on how to set up @@ -2398,8 +2191,7 @@ PrefabInstance: m_SourcePrefab: {fileID: 100100000, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} --- !u!224 &2050154443 stripped RectTransform: - m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, - type: 3} + m_CorrespondingSourceObject: {fileID: 2877385409968955045, guid: d5fa55a16b49d4da3a93a4958cdc3180, type: 3} m_PrefabInstance: {fileID: 2050154442} m_PrefabAsset: {fileID: 0} --- !u!1 &221137969116224548 @@ -2450,200 +2242,159 @@ PrefabInstance: serializedVersion: 3 m_TransformParent: {fileID: 0} m_Modifications: - - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 605078736972206957, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 965276579647584521, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedSphere objectReference: {fileID: 0} - - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1613878145432836316, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1810530080357623737, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: RedText objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: 'White base color' objectReference: {fileID: 0} - - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 1814010385164494244, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3023133885351793476, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedQuad objectReference: {fileID: 0} - - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3273462983484937657, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: Base Map objectReference: {fileID: 0} - - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3552189744290811969, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 3685639466378869937, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 81a7b3fb99e984cb0a7a85e94d32a98e, type: 2} - - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 5474351984923567369, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: 6a16993b78f2b4f85b82be4c42e0ebc4, type: 2} - - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7287552079565133267, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: RedSphere objectReference: {fileID: 0} - - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 7976546426794385558, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: WhiteText objectReference: {fileID: 0} - - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291250739307, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: WhiteQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426208, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: RedQuad objectReference: {fileID: 0} - - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283291266426222, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ab1e501408f784696a373918622592b2, type: 2} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: BaseMap objectReference: {fileID: 0} - - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703921, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_RootOrder value: 5 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.w value: 1 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8097283293074703934, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8290614998434304938, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: MappedText objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Font value: - objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, - type: 3} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + objectReference: {fileID: 12800000, guid: 41c277dc43e1949a49ddfa34597b8af2, type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Text value: 'Red base color' objectReference: {fileID: 0} - - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8968186135458761160, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_CharacterSize value: 0.04 objectReference: {fileID: 0} - - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 8979682401931062433, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: m_Name value: WhiteSphere objectReference: {fileID: 0} - - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, - type: 3} + - target: {fileID: 9088944033397224454, guid: 7689a0ffc4ed74a58b7298d31e1d3283, type: 3} propertyPath: 'm_Materials.Array.data[0]' value: objectReference: {fileID: 2100000, guid: ab1e501408f784696a373918622592b2, type: 2} @@ -2670,6 +2421,7 @@ Canvas: m_OverridePixelPerfect: 0 m_SortingBucketNormalizedSize: 0 m_VertexColorAlwaysGammaSpace: 0 + m_UseReflectionProbes: 0 m_AdditionalShaderChannelsFlag: 0 m_UpdateRectTransformForStandalone: 0 m_SortingLayerID: 0 @@ -2720,7 +2472,6 @@ SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 1925206219} - - {fileID: 1720569097} - {fileID: 222607664510397816} - {fileID: 909040152} - {fileID: 586851967382586498} diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions new file mode 100644 index 00000000000..ce0b23b0dcb --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions @@ -0,0 +1,839 @@ +{ + "version": 1, + "name": "PlayerControls", + "maps": [ + { + "name": "Player", + "id": "2cf6ceb3-86d0-4b8b-9eff-79d527e59fb0", + "actions": [ + { + "name": "Move", + "type": "Value", + "id": "68156268-5c1f-4acc-955e-d121992f8ad5", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Look", + "type": "Value", + "id": "e2f24dfb-116f-4941-8f88-cf0a20903c6a", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Fire", + "type": "Button", + "id": "75aea007-8293-456a-9d47-5442fc0f5e68", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "", + "id": "978bfe49-cc26-4a3d-ab7b-7d7a29327403", + "path": "/leftStick", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "WASD", + "id": "00ca640b-d935-4593-8157-c05846ea39b3", + "path": "Dpad", + "interactions": "", + "processors": "", + "groups": "", + "action": "Move", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "e2062cb9-1b15-46a2-838c-2f8d72a0bdd9", + "path": "/w", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "up", + "id": "8180e8bd-4097-4f4e-ab88-4523101a6ce9", + "path": "/upArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "320bffee-a40b-4347-ac70-c210eb8bc73a", + "path": "/s", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "1c5327b5-f71c-4f60-99c7-4e737386f1d1", + "path": "/downArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "d2581a9b-1d11-4566-b27d-b92aff5fabbc", + "path": "/a", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "2e46982e-44cc-431b-9f0b-c11910bf467a", + "path": "/leftArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "fcfe95b8-67b9-4526-84b5-5d0bc98d6400", + "path": "/d", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "77bff152-3580-4b21-b6de-dcd0c7e41164", + "path": "/rightArrow", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Move", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "1635d3fe-58b6-4ba9-a4e2-f4b964f6b5c8", + "path": "/{Primary2DAxis}", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "3ea4d645-4504-4529-b061-ab81934c3752", + "path": "/stick", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Move", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "c1f7a91b-d0fd-4a62-997e-7fb9b69bf235", + "path": "/rightStick", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Look", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "8c8e490b-c610-4785-884f-f04217b23ca4", + "path": "/delta", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse;Touch", + "action": "Look", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "3e5f5442-8668-4b27-a940-df99bad7e831", + "path": "/{Hatswitch}", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Look", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "143bb1cd-cc10-4eca-a2f0-a3664166fe91", + "path": "/rightTrigger", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "05f6913d-c316-48b2-a6bb-e225f14c7960", + "path": "/leftButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "886e731e-7071-4ae4-95c0-e61739dad6fd", + "path": "/primaryTouch/tap", + "interactions": "", + "processors": "", + "groups": ";Touch", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "ee3d0cd2-254e-47a7-a8cb-bc94d9658c54", + "path": "/trigger", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "8255d333-5683-4943-a58a-ccb207ff1dce", + "path": "/{PrimaryAction}", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "Fire", + "isComposite": false, + "isPartOfComposite": false + } + ] + }, + { + "name": "UI", + "id": "53dbdbef-4101-4aa8-b9ee-fffbbf22db70", + "actions": [ + { + "name": "Navigate", + "type": "PassThrough", + "id": "11b2185d-2fb4-4c89-aafd-748da443e2dc", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Submit", + "type": "Button", + "id": "d587f992-6a9d-4333-a252-7293b674fd36", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Cancel", + "type": "Button", + "id": "86ee9931-c691-4e12-a075-6a5bc7be2520", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "Point", + "type": "PassThrough", + "id": "e49d4a8d-a0ca-4893-bc77-263954f4eb13", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "Click", + "type": "PassThrough", + "id": "05a94944-eece-456c-a514-3c74d0b37a64", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": true + }, + { + "name": "ScrollWheel", + "type": "PassThrough", + "id": "8334b98a-d9f5-4295-8292-7d83bbc450ea", + "expectedControlType": "Vector2", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "MiddleClick", + "type": "PassThrough", + "id": "0862ed31-cb59-4cb8-b655-58f1fcc629e2", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "RightClick", + "type": "PassThrough", + "id": "6f006a1f-a75d-47a8-a238-82d8b73cb7bc", + "expectedControlType": "Button", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "TrackedDevicePosition", + "type": "PassThrough", + "id": "09be00e8-57eb-45df-a37e-77e4e01d7239", + "expectedControlType": "Vector3", + "processors": "", + "interactions": "", + "initialStateCheck": false + }, + { + "name": "TrackedDeviceOrientation", + "type": "PassThrough", + "id": "ac15ba30-53c8-49bc-a859-98024bf21458", + "expectedControlType": "Quaternion", + "processors": "", + "interactions": "", + "initialStateCheck": false + } + ], + "bindings": [ + { + "name": "Gamepad", + "id": "809f371f-c5e2-4e7a-83a1-d867598f40dd", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Navigate", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "14a5d6e8-4aaf-4119-a9ef-34b8c2c548bf", + "path": "/leftStick/up", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "up", + "id": "9144cbe6-05e1-4687-a6d7-24f99d23dd81", + "path": "/rightStick/up", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "2db08d65-c5fb-421b-983f-c71163608d67", + "path": "/leftStick/down", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "58748904-2ea9-4a80-8579-b500e6a76df8", + "path": "/rightStick/down", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "8ba04515-75aa-45de-966d-393d9bbd1c14", + "path": "/leftStick/left", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "712e721c-bdfb-4b23-a86c-a0d9fcfea921", + "path": "/rightStick/left", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "fcd248ae-a788-4676-a12e-f4d81205600b", + "path": "/leftStick/right", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "1f04d9bc-c50b-41a1-bfcc-afb75475ec20", + "path": "/rightStick/right", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "fb8277d4-c5cd-4663-9dc7-ee3f0b506d90", + "path": "/dpad", + "interactions": "", + "processors": "", + "groups": ";Gamepad", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "Joystick", + "id": "e25d9774-381c-4a61-b47c-7b6b299ad9f9", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Navigate", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "3db53b26-6601-41be-9887-63ac74e79d19", + "path": "/stick/up", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "0cb3e13e-3d90-4178-8ae6-d9c5501d653f", + "path": "/stick/down", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "0392d399-f6dd-4c82-8062-c1e9c0d34835", + "path": "/stick/left", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "942a66d9-d42f-43d6-8d70-ecb4ba5363bc", + "path": "/stick/right", + "interactions": "", + "processors": "", + "groups": "Joystick", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "Keyboard", + "id": "ff527021-f211-4c02-933e-5976594c46ed", + "path": "2DVector", + "interactions": "", + "processors": "", + "groups": "", + "action": "Navigate", + "isComposite": true, + "isPartOfComposite": false + }, + { + "name": "up", + "id": "563fbfdd-0f09-408d-aa75-8642c4f08ef0", + "path": "/w", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "up", + "id": "eb480147-c587-4a33-85ed-eb0ab9942c43", + "path": "/upArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "2bf42165-60bc-42ca-8072-8c13ab40239b", + "path": "/s", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "down", + "id": "85d264ad-e0a0-4565-b7ff-1a37edde51ac", + "path": "/downArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "74214943-c580-44e4-98eb-ad7eebe17902", + "path": "/a", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "left", + "id": "cea9b045-a000-445b-95b8-0c171af70a3b", + "path": "/leftArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "8607c725-d935-4808-84b1-8354e29bab63", + "path": "/d", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "right", + "id": "4cda81dc-9edd-4e03-9d7c-a71a14345d0b", + "path": "/rightArrow", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Navigate", + "isComposite": false, + "isPartOfComposite": true + }, + { + "name": "", + "id": "9e92bb26-7e3b-4ec4-b06b-3c8f8e498ddc", + "path": "*/{Submit}", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse;Gamepad;Touch;Joystick;XR", + "action": "Submit", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "82627dcc-3b13-4ba9-841d-e4b746d6553e", + "path": "*/{Cancel}", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse;Gamepad;Touch;Joystick;XR", + "action": "Cancel", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "c52c8e0b-8179-41d3-b8a1-d149033bbe86", + "path": "/position", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Point", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "e1394cbc-336e-44ce-9ea8-6007ed6193f7", + "path": "/position", + "interactions": "", + "processors": "", + "groups": "Keyboard&Mouse", + "action": "Point", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "5693e57a-238a-46ed-b5ae-e64e6e574302", + "path": "/touch*/position", + "interactions": "", + "processors": "", + "groups": "Touch", + "action": "Point", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "4faf7dc9-b979-4210-aa8c-e808e1ef89f5", + "path": "/leftButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "8d66d5ba-88d7-48e6-b1cd-198bbfef7ace", + "path": "/tip", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "47c2a644-3ebc-4dae-a106-589b7ca75b59", + "path": "/touch*/press", + "interactions": "", + "processors": "", + "groups": "Touch", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "bb9e6b34-44bf-4381-ac63-5aa15d19f677", + "path": "/trigger", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "Click", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "38c99815-14ea-4617-8627-164d27641299", + "path": "/scroll", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "ScrollWheel", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "24066f69-da47-44f3-a07e-0015fb02eb2e", + "path": "/middleButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "MiddleClick", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "4c191405-5738-4d4b-a523-c6a301dbf754", + "path": "/rightButton", + "interactions": "", + "processors": "", + "groups": ";Keyboard&Mouse", + "action": "RightClick", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "7236c0d9-6ca3-47cf-a6ee-a97f5b59ea77", + "path": "/devicePosition", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "TrackedDevicePosition", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "23e01e3a-f935-4948-8d8b-9bcac77714fb", + "path": "/deviceRotation", + "interactions": "", + "processors": "", + "groups": "XR", + "action": "TrackedDeviceOrientation", + "isComposite": false, + "isPartOfComposite": false + } + ] + } + ], + "controlSchemes": [ + { + "name": "Keyboard&Mouse", + "bindingGroup": "Keyboard&Mouse", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + }, + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "Gamepad", + "bindingGroup": "Gamepad", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "Touch", + "bindingGroup": "Touch", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "Joystick", + "bindingGroup": "Joystick", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + }, + { + "name": "XR", + "bindingGroup": "XR", + "devices": [ + { + "devicePath": "", + "isOptional": false, + "isOR": false + } + ] + } + ] +} \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions.meta new file mode 100644 index 00000000000..fd5f5da027f --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/PlayerControls.inputactions.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f426eb113dac7124d897c338662b4024 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3} + generateWrapperCode: 0 + wrapperCodePath: + wrapperClassName: + wrapperCodeNamespace: diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab index 7410520bcd9..21aa96c56ec 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Prefabs/FirstPersonPlayer.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 4212382672143566193} - component: {fileID: 4891938747972648122} - component: {fileID: 8509898242313118626} + - component: {fileID: 8535537789861062929} m_Layer: 0 m_Name: FirstPersonPlayer m_TagString: Untagged @@ -25,6 +26,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2148271877166492642} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0.812, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} @@ -32,7 +34,6 @@ Transform: m_Children: - {fileID: 3363522893988168260} m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!143 &4891938747972648122 CharacterController: @@ -42,9 +43,16 @@ CharacterController: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2148271877166492642} m_Material: {fileID: 0} - m_IsTrigger: 0 + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ProvidesContacts: 0 m_Enabled: 1 - serializedVersion: 2 + serializedVersion: 3 m_Height: 1.5 m_Radius: 0.4 m_SlopeLimit: 45 @@ -61,15 +69,43 @@ MonoBehaviour: m_GameObject: {fileID: 2148271877166492642} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 94f9f55b5897449c29f5189f47cad4bc, type: 3} + m_Script: {fileID: 11500000, guid: 1b63a52c6229a7d48944998a4fcad092, type: 3} m_Name: m_EditorClassIdentifier: - m_MouseSensitivity: 100 - m_ButtonSensitivity: 100 - m_MovementSpeed: 3 - m_PlayerCamera: {fileID: 3363522893988168260} - m_MoveWithMouse: 1 - m_ButtonMovementFlags: 0 + moveSpeed: 5 + gravity: -9.81 + lookSensitivity: 0.5 + baseCamera: {fileID: 1104701761066559480} +--- !u!114 &8535537789861062929 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2148271877166492642} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62899f850307741f2a39c98a8b639597, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.PlayerInput + m_Actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3} + m_NotificationBehavior: 0 + m_UIInputModule: {fileID: 0} + m_DeviceLostEvent: + m_PersistentCalls: + m_Calls: [] + m_DeviceRegainedEvent: + m_PersistentCalls: + m_Calls: [] + m_ControlsChangedEvent: + m_PersistentCalls: + m_Calls: [] + m_ActionEvents: [] + m_NeverAutoSwitchControlSchemes: 0 + m_DefaultControlScheme: + m_DefaultActionMap: + m_SplitScreenIndex: -1 + m_Camera: {fileID: 1104701761066559480} --- !u!1 &8157311212398424292 GameObject: m_ObjectHideFlags: 0 @@ -82,7 +118,6 @@ GameObject: - component: {fileID: 1104701761066559480} - component: {fileID: 5828494068272712963} - component: {fileID: 6350239021526260069} - - component: {fileID: 8900132868616544278} m_Layer: 0 m_Name: Camera m_TagString: MainCamera @@ -97,13 +132,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8157311212398424292} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0.6, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4212382672143566193} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!20 &1104701761066559480 Camera: @@ -119,9 +154,17 @@ Camera: m_projectionMatrixMode: 1 m_GateFitMode: 2 m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 m_SensorSize: {x: 36, y: 24} m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 @@ -186,19 +229,17 @@ MonoBehaviour: m_Dithering: 0 m_ClearDepth: 1 m_AllowXRRendering: 1 + m_AllowHDROutput: 1 + m_UseScreenCoordOverride: 0 + m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0} + m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0} m_RequiresDepthTexture: 0 m_RequiresColorTexture: 0 + m_TaaSettings: + m_Quality: 3 + m_FrameInfluence: 0.1 + m_JitterScale: 1 + m_MipBias: 0 + m_VarianceClampScale: 0.9 + m_ContrastAdaptiveSharpening: 0 m_Version: 2 ---- !u!114 &8900132868616544278 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 8157311212398424292} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 21aa50131bc134f04a14efdbeb7686be, type: 3} - m_Name: - m_EditorClassIdentifier: - m_PipelineAsset: {fileID: 11400000, guid: 9b9c0b62deeea4218843a7ad59325649, type: 2} diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs new file mode 100644 index 00000000000..8a978bac483 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs @@ -0,0 +1,87 @@ +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.Rendering.Universal; + +[RequireComponent(typeof(PlayerInput))] +public class CameraManagement : MonoBehaviour +{ + + [Header("Cameras")] + public Camera baseCamera; + public Camera overlayCamera; + + private PlayerInput playerInput; + private InputAction fireAction; + + private float baseFOV; + private float overlayFOV; + private bool isOverlayActive = false; + + private void Awake() + { + playerInput = GetComponent(); + + // Check if the cameras are corectly assigned + if (baseCamera == null || overlayCamera == null) + { + Debug.LogError("BaseCamera and OverlayCamera have to be assigned in the PlayerInput!"); + enabled = false; + return; + } + + // Get FOV + baseFOV = baseCamera.fieldOfView; + overlayFOV = overlayCamera.fieldOfView; + + // Prepare URP stack + var baseData = baseCamera.GetUniversalAdditionalCameraData(); + var overlayData = overlayCamera.GetUniversalAdditionalCameraData(); + overlayData.renderType = CameraRenderType.Overlay; + + if (!baseData.cameraStack.Contains(overlayCamera)) + baseData.cameraStack.Add(overlayCamera); + + // Overlay off at start + overlayCamera.gameObject.SetActive(false); + } + + private void OnEnable() + { + fireAction = playerInput.actions["Fire"]; + fireAction.performed += OnFirePerformed; + fireAction.canceled += OnFireCanceled; + } + + private void OnDisable() + { + if (fireAction != null) + { + fireAction.performed -= OnFirePerformed; + fireAction.canceled -= OnFireCanceled; + } + } + + private void OnFirePerformed(InputAction.CallbackContext ctx) + { + isOverlayActive = true; + overlayCamera.gameObject.SetActive(true); + baseCamera.fieldOfView = overlayFOV; + } + + private void OnFireCanceled(InputAction.CallbackContext ctx) + { + isOverlayActive = false; + overlayCamera.gameObject.SetActive(false); + baseCamera.fieldOfView = baseFOV; + } + + private void LateUpdate() + { + // Synchronise base and overlay camera rotation to avoid a jerky effect + if (isOverlayActive && overlayCamera != null && baseCamera != null) + { + overlayCamera.transform.rotation = baseCamera.transform.rotation; + } + } +} + diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs.meta new file mode 100644 index 00000000000..d1f069ceab1 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/CameraManagement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e2ca254cf5a4eb443bba3eb4c9b3035b \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs index 6bcc30a6e56..9c5923eb9e0 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs @@ -1,84 +1,96 @@ using UnityEngine; -using Cursor = UnityEngine.Cursor; +using UnityEngine.InputSystem; [RequireComponent(typeof(CharacterController))] +[RequireComponent(typeof(PlayerInput))] public class FirstPersonController : MonoBehaviour { - [SerializeField] - private float m_MouseSensitivity = 100f; - [SerializeField] - private float m_MovementSpeed = 5f; - [SerializeField] - private Transform m_PlayerCamera = null; - [SerializeField] - private bool m_MoveWithMouse = true; - - private CharacterController m_CharacterController; - private float m_XRotation = 0f; - [SerializeField] - private byte m_ButtonMovementFlags; - - void Start() - { -#if ENABLE_INPUT_SYSTEM - Debug.Log("The FirstPersonController uses the legacy input system. Please set it in Project Settings"); - m_MoveWithMouse = false; -#endif - if (m_MoveWithMouse) - { - Cursor.lockState = CursorLockMode.Locked; - } - m_CharacterController = GetComponent(); - } + [Header("Movement Settings")] + public float moveSpeed = 5f; + public float gravity = -9.81f; - void Update() - { - Look(); - Move(); - } + [Header("Look Settings")] + public float lookSensitivity = 0.5f; - private void Look() - { - Vector2 lookInput = GetLookInput(); + [Header("Camera Reference")] + public Camera baseCamera; + + private CharacterController controller; + private PlayerInput playerInput; + private InputAction moveAction; + private InputAction lookAction; + + private Vector2 moveInput; + private Vector2 lookInput; + private float verticalVelocity; + private float cameraPitch; - m_XRotation -= lookInput.y; - m_XRotation = Mathf.Clamp(m_XRotation, -90f, 90f); + private void Awake() + { + controller = GetComponent(); + playerInput = GetComponent(); - m_PlayerCamera.localRotation = Quaternion.Euler(m_XRotation, 0, 0); - transform.Rotate(Vector3.up * lookInput.x, Space.World); + // Hide cursor + Cursor.lockState = CursorLockMode.Locked; + Cursor.visible = false; } - private void Move() + private void OnEnable() { - Vector3 movementInput = GetMovementInput(); + var actions = playerInput.actions; - Vector3 move = transform.right * movementInput.x + transform.forward * movementInput.z; + moveAction = actions["Move"]; + lookAction = actions["Look"]; + + moveAction.performed += ctx => moveInput = ctx.ReadValue(); + moveAction.canceled += ctx => moveInput = Vector2.zero; - m_CharacterController.Move(move * m_MovementSpeed * Time.deltaTime); + lookAction.performed += ctx => lookInput = ctx.ReadValue(); + lookAction.canceled += ctx => lookInput = Vector2.zero; + + actions.Enable(); } - private Vector2 GetLookInput() + private void OnDisable() { - float mouseX = 0; - float mouseY = 0; - if (m_MoveWithMouse) + if (moveAction != null) + { + moveAction.performed -= ctx => moveInput = ctx.ReadValue(); + moveAction.canceled -= ctx => moveInput = Vector2.zero; + } + if (lookAction != null) { - mouseX = Input.GetAxis("Mouse X") * m_MouseSensitivity * Time.deltaTime; - mouseY = Input.GetAxis("Mouse Y") * m_MouseSensitivity * Time.deltaTime; + lookAction.performed -= ctx => lookInput = ctx.ReadValue(); + lookAction.canceled -= ctx => lookInput = Vector2.zero; } - return new Vector2(mouseX, mouseY); } - private Vector3 GetMovementInput() + private void Update() { - float x = 0; - float z = 0; - if (m_MoveWithMouse) - { - x = Input.GetAxis("Horizontal"); - z = Input.GetAxis("Vertical"); - } + HandleMovement(); + HandleLook(); + } + + private void HandleMovement() + { + Vector3 move = transform.right * moveInput.x + transform.forward * moveInput.y; + + if (controller.isGrounded && verticalVelocity < 0) + verticalVelocity = -2f; + + verticalVelocity += gravity * Time.deltaTime; + move.y = verticalVelocity; + + controller.Move(move * moveSpeed * Time.deltaTime); + } + + private void HandleLook() + { + transform.Rotate(Vector3.up * lookInput.x * lookSensitivity); + + cameraPitch -= lookInput.y * lookSensitivity; + cameraPitch = Mathf.Clamp(cameraPitch, -80f, 80f); - return new Vector3(x, 0, z); + baseCamera.transform.localEulerAngles = Vector3.right * cameraPitch; } -} +} \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta index 05b26da7810..9dc6e420166 100644 --- a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/FirstPersonController.cs.meta @@ -1,11 +1,2 @@ fileFormatVersion: 2 -guid: 94f9f55b5897449c29f5189f47cad4bc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: +guid: 1b63a52c6229a7d48944998a4fcad092 \ No newline at end of file diff --git a/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef new file mode 100644 index 00000000000..8cb1bf88891 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef @@ -0,0 +1,21 @@ +{ + "name": "SampleAssembly", + "rootNamespace": "", + "references": [ + "Unity.InputSystem", + "Unity.RenderPipelines.Core.Runtime", + "Unity.RenderPipelines.Universal.Editor", + "Unity.RenderPipelines.Universal.Runtime" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [ + "ENABLE_INPUT_SYSTEM" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/360_Shader_Graphs_UITK.unity.meta b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef.meta similarity index 59% rename from Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/360_Shader_Graphs_UITK.unity.meta rename to Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef.meta index 62d5f19143b..083d6f1e079 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/360_Shader_Graphs_UITK.unity.meta +++ b/Packages/com.unity.render-pipelines.universal/Samples~/URPPackageSamples/SharedAssets/Scripts/SampleAssembly.asmdef.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 131227f8302d12c49aa595b7f090a7a7 -DefaultImporter: +guid: d770956cfc6450d45bf1908075cac342 +AssemblyDefinitionImporter: externalObjects: {} userData: assetBundleName: diff --git a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl index 56438e7ba05..ff2beaf897f 100644 --- a/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl +++ b/Packages/com.unity.render-pipelines.universal/ShaderLibrary/GlobalIllumination.hlsl @@ -31,12 +31,12 @@ half3 SampleScreenSpaceGI(float2 pos) #define _MIXED_LIGHTING_SUBTRACTIVE #endif -#if !defined(_REFLECTION_PROBE_BLENDING_KEYWORD_DECLARED) -#define _REFLECTION_PROBE_BLENDING 0 +#if !defined(_REFLECTION_PROBE_BLENDING_KEYWORD_DECLARED) && !defined(_REFLECTION_PROBE_BLENDING) + #define _REFLECTION_PROBE_BLENDING 0 #endif -#if !defined(_REFLECTION_PROBE_BOX_PROJECTION_KEYWORD_DECLARED) -#define _REFLECTION_PROBE_BOX_PROJECTION 0 +#if !defined(_REFLECTION_PROBE_BOX_PROJECTION_KEYWORD_DECLARED) && !defined(_REFLECTION_PROBE_BOX_PROJECTION) + #define _REFLECTION_PROBE_BOX_PROJECTION 0 #endif // SH Vertex Evaluation. Depending on target SH sampling might be diff --git a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader index 0e5ce5d0fbe..26449110ef0 100644 --- a/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader +++ b/Packages/com.unity.render-pipelines.universal/Shaders/2D/Sprite-Lit-Default.shader @@ -36,7 +36,8 @@ Shader "Universal Render Pipeline/2D/Sprite-Lit-Default" // GPU Instancing #pragma multi_compile_instancing - #pragma multi_compile _ DEBUG_DISPLAY SKINNED_SPRITE + #pragma multi_compile _ DEBUG_DISPLAY + #pragma multi_compile _ SKINNED_SPRITE struct Attributes { diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs b/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs index e70e76510d5..ff2a3f1a983 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Editor/NoLeaksOnEnterLeavePlaymode.cs @@ -114,6 +114,7 @@ public IEnumerator NoResourceLeaks() "Arial Unicode MS - Regular Material", "Helvetica Neue - Regular Material", "Inter - Regular Material", // UUM-28555 + "Inter - Regular Material + Inter - Semi Bold Atlas", // UUM-28555 "Malgun Gothic - Regular Material", "Microsoft Sans Serif - Regular Material", "Microsoft YaHei - Regular Material", @@ -143,6 +144,7 @@ public IEnumerator NoResourceLeaks() "Arial Unicode MS - Regular Atlas", "Helvetica Neue - Regular Atlas", "Inter - Regular Atlas", + "Inter - Regular Material + Inter - Semi Bold Atlas", "Malgun Gothic - Regular Atlas", "Microsoft Sans Serif - Regular Atlas", "Microsoft YaHei - Regular Atlas", diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs index 793cadaf955..29e02f1a64a 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/LightClusteringTests.cs @@ -61,6 +61,8 @@ public void LightClustering_WhenLightVolumeIntersectionWithXZPlaneIsOutsideTheSc float farPlane = 1000f; JobHandle handle = ForwardLights.ScheduleClusteringJobs( + false, + true, lights, probes, zBins, diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs new file mode 100644 index 00000000000..da84421001e --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs @@ -0,0 +1,56 @@ +#if U2D_ANIMATION_INSTALLED +using NUnit.Framework; +using UnityEngine.U2D.Animation; + +namespace UnityEngine.Rendering.Universal.Tests +{ + class ShadowCaster2DTests + { + GameObject m_Obj; + + [SetUp] + public void Setup() + { + m_Obj = new GameObject(); + m_Obj.AddComponent(); + } + + [TearDown] + public void Cleanup() + { + Object.DestroyImmediate(m_Obj); + } + + [Test] + public void AddShadowCaster2DWithSpriteSkin() + { + m_Obj.AddComponent(); + ShadowCaster2D shadowCaster2D = m_Obj.AddComponent(); + +// ShadowCaster2D.shadowShape2DProvider is always null on Standalone. +#if UNITY_EDITOR + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.TypeOf(typeof(ShadowShape2DProvider_SpriteSkin))); +#else + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.Null); +#endif + } + + [Test] + public void AddShadowCaster2DWithSpriteSkinWhenInactive() + { + m_Obj.AddComponent(); + m_Obj.SetActive(false); + ShadowCaster2D shadowCaster2D = m_Obj.AddComponent(); + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.Null); + + m_Obj.SetActive(true); +// ShadowCaster2D.shadowShape2DProvider is always null on Standalone. +#if UNITY_EDITOR + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.TypeOf(typeof(ShadowShape2DProvider_SpriteSkin))); +#else + Assert.That(shadowCaster2D.shadowShape2DProvider, Is.Null); +#endif + } + } +} +#endif diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs.meta b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs.meta new file mode 100644 index 00000000000..a7db3171516 --- /dev/null +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/ShadowCaster2DTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cf9e72a1bdd854b65a42b0d13738efcd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef index 13cdbdae9cf..502762ff501 100644 --- a/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef +++ b/Packages/com.unity.render-pipelines.universal/Tests/Runtime/Unity.RenderPipelines.Universal.Runtime.Tests.asmdef @@ -7,7 +7,8 @@ "GUID:0acc523941302664db1f4e527237feb3", "GUID:516a5277b8c3b4f4c8cc86b77b1591ff", "GUID:d8b63aba1907145bea998dd612889d6b", - "GUID:df380645f10b7bc4b97d4f5eb6303d95" + "GUID:df380645f10b7bc4b97d4f5eb6303d95", + "GUID:41524c21c95e5fe4dbc5b48bd21995a4" ], "includePlatforms": [], "excludePlatforms": [], @@ -20,6 +21,12 @@ "defineConstraints": [ "UNITY_INCLUDE_TESTS" ], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.unity.2d.animation", + "expression": "1.0.0", + "define": "U2D_ANIMATION_INSTALLED" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Packages/com.unity.shadergraph/Documentation~/Append-Node.md b/Packages/com.unity.shadergraph/Documentation~/Append-Node.md index 1550eddd367..54958b882e1 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Append-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Append-Node.md @@ -19,7 +19,11 @@ Input **A** channels take priority over input **B** to combine up to a maximum o ## Example graph usage -In the following example, an **Append** node combines a **Vector 2** and a **Float**. The resulting output vector has 3 channels: the **X** and **Y** from the **Vector 2**, and the **X** from the **Float**. +In the following example, an **Append** node combines a **Vector 2** and a **Float**. The resulting output vector has the following 3 channels: + +- The first channel is the **X** from the **Vector 2**. +- The second channel is the **Y** from the **Vector 2**. +- The third channel is the **X** from the **Float**. Notice that with an Append node, you don't need to use a Split node to break up the Vector 2 into individual channels, then a Combine node to combine the 3 separate channels. diff --git a/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md b/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md index 6bfd3c8ee58..60872a1cd29 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Cosine-Node.md @@ -8,7 +8,7 @@ Returns the cosine of the value of input **In**. | Name | Direction | Type | Description | |:------------ |:-------------|:-----|:---| -| In | Input | Dynamic Vector | Input value | +| In | Input | Dynamic Vector | Input value in radians | | Out | Output | Dynamic Vector | Output value | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md b/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md index 31b2d355a79..5cfbb956fbc 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md +++ b/Packages/com.unity.shadergraph/Documentation~/Create-Node-Menu.md @@ -1,22 +1,69 @@ -# Create Node Menu +# Add and connect nodes in a shader graph -## Description +You can add and connect nodes in a shader graph in different ways depending on your current task. -Use the **Create Node Menu** to create [nodes](Node.md) in Shader Graph. To open the **Create Node Menu**, either right-click on the workspace in the [Shader Graph Window](Shader-Graph-Window.md) and select **Create Node**, or press the spacebar. +> [!NOTE] +> To add and connect nodes in a shader graph, you need to [create a shader graph asset](create-shader-graph.md) first and open the asset in the [Shader Graph window](Shader-Graph-Window.md). -At the top of the **Create Node Menu** is a search bar. To search for a node, type any part of its name in the search field. The search box gives you autocomplete options, and you can press Tab to accept the predictive text. It highlights matching text in yellow. +## Add a node -The **Create Node Menu** lists all nodes that are available in Shader Graph, categorized by their function. User-created [Sub Graphs](Sub-graph.md) are also available in the **Create Node Menu** under **Sub Graph Assets**, or in a custom category that you define in the Sub Graph Asset. +To add a [node](Node.md) to your shader graph, follow these steps: -To add a node to the workspace, double-click it in the **Create Node Menu**. +1. Open the **Create Node** menu through either of the following: + + * Select the [Shader Graph window](Shader-Graph-Window.md)'s workspace and press the **Spacebar**. + * Right-click in the Shader Graph Window's workspace and select **Create Node**. -### Contextual Create Node Menu +1. In the **Create Node** menu, browse or search for the desired node. + + The **Create Node** menu lists all nodes that are available in Shader Graph, categorized by their function. User-created [sub graphs](Sub-graph.md) are also available in the **Create Node** menu under **Sub Graph Assets**, or in a custom category that you define in the Sub Graph Asset. -A contextual **Create Node Menu** filters the available nodes, and only shows those that use the [Data Type](Data-Types.md) of a selected edge. It lists every available [Port](Port.md) on nodes that match that Data Type. +1. Double-click on a node's name to add the corresponding node in the graph. -To open a contextual **Create Node Menu**, click and drag an [Edge](Edge.md) from a Port, and then release it in an empty area of the workspace. +> [!NOTE] +> Use the **Create Node** menu search box to filter the listed nodes by name parts and synonyms based on industry terms. It provides autocomplete options and highlights matching text in yellow. You can press **Tab** to accept the predictive text. -### Master Stack Create Node Menu -To add a new [Block Node]() to the [Master Stack](), either right click and select **Create Node** or press spacebar with the stack selected. +## Connect node ports -The **Create Node Menu** will display all available blocks for the master stack based on the render pipelines in your project. Any block can be added to the master stack via the **Create Node Menu**. If the block added is not compatible with the current Graph settings, the block will be disabled until the settings are configured to support it. +To connect [ports](Port.md) between two existing [nodes](Node.md) or with the [master stack](Master-Stack.md), select and drag the desired port to the target. + +The line resulting from that connection is called an [edge](Edge.md). + +You can only connect an output port to a input port, or vice-versa, and you can't connect two ports of the same node together. + +## Add and connect a node from an existing port + +To connect a [port](Port.md) to a [node](Node.md) that doesn't exist yet and create that targeted node in the process, follow these steps: + +1. Select and drag the desired port and release it in an empty area of the workspace. + +1. In the **Create Node** menu, browse or search for the node you need to connect to the port you dragged out. + + The **Create Node** menu displays every node port available according to the [data types](Data-Types.md) compatible with the port you dragged out. + +1. Double-click on a node port's name to add the corresponding node in the graph, with the two expected ports already connected­. + +## Add a block node in the Master Stack + +To add a new [block node](Block-Node.md) to the [master stack](Master-Stack.md), follow these steps: + +1. Open the **Create Node** menu for the Master Stack context through either of the following: + * Select the Master Stack's targeted context (**Vertex** or **Fragment**) and press the **Spacebar**. + * Right-click in the Master Stack's targeted context area and select **Create Node**. + +1. In the **Create Node** menu, browse or search for the desired block node. + + The **Create Node** menu displays all available blocks for the master stack based on the render pipelines in your project. + +1. Double-click on a block node's name to add the corresponding block node in the Master Stack. + +> [!NOTE] +> If the block that you add is not compatible with the current [graph settings](Graph-Settings-Tab.md), the block is deactivated until you configure the settings to support it. + +## Additional resources + +* [Nodes](Node.md) +* [Ports](Port.md) +* [Edges](Edge.md) +* [Master Stack](Master-Stack.md) +* [Block nodes](Block-Node.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md b/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md index 0db8b5eeecc..bf5b07eeb02 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md +++ b/Packages/com.unity.shadergraph/Documentation~/Create-Shader-Graph.md @@ -1,51 +1,57 @@ -# Creating a new shader graph asset +# Create a shader graph asset -After you configure an SRP, you can create a new shader graph asset. +You can create a new shader graph asset in different ways according to your current workflow. -To create a new shader graph asset, follow these steps: -1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **From Template...**. +## Create a shader graph from a template -1. In the context menu, select your desired type of Shader Graph. +To create a new shader graph asset from a prebuilt shader graph template, follow these steps: - The type of Shader Graph available is dependent on the render pipelines present in your project. +1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **From Template**. - A submenu for each installed render pipeline may be present containing template stacks for standard shading models ( Lit, Unlit, etc ). + The [template browser](template-browser.md) lists all available templates according to your project's render pipeline. - For a full list of provided options, refer to the [Universal Render Pipeline](https://docs.unity3d.com/Manual/urp/urp-introduction.html) and [High Definition Render Pipeline](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest) documentation. +1. Select the desired template and click **Create**. - For this example, Universal is installed so a Universal Lit Shader Graph has been created. + Unity creates a new shader graph asset in your project. -1. Double-click your newly created shader graph asset to open it in the Shader Graph window. +1. Name the shader graph asset. -## Shader Graph window +You can now open the asset and edit the graph in the [Shader Graph window](Shader-Graph-Window.md). -The Shader Graph window consists of the Master Stack, the Preview Window, the Blackboard, and the Graph Inspector. -![](images/ShaderGraphWindow.png) +## Create a shader graph with a preset target -### Master Stack +To start from a default configuration with a preset master stack according to a specific render pipeline and material type, follow these steps: -The final connection that determines your shader output. Refer to [Master Stack](Master-Stack.md) for more information. +1. In the **Project** window, right-click and select **Create** > **Shader Graph**, and then the target render pipeline and the desired shader type. -![]() + The types of shader graphs available depend on the render pipelines present in your project (for example, **URP** > **Lit Shader Graph**). For a full list of provided options, refer to the [Universal Render Pipeline](https://docs.unity3d.com/Manual/urp/urp-introduction.html) and [High Definition Render Pipeline](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest) documentation. -### Preview window + Unity creates a new shader graph asset in your project. -An area to preview the current shader output. Here, you can rotate the object, and zoom in and out. You can also change the basic mesh on which the shader is previewed. Refer to [Main Preview](Main-Preview.md) for more information. +1. Name the shader graph asset. -![img](images/MainPreview.png) +You can now open the asset and edit the graph in the [Shader Graph window](Shader-Graph-Window.md). -### Blackboard -An area that contains all of the shader's properties in a single, collected view. Use the Blackboard to add, remove, rename, and reorder properties. Refer to [Blackboard](Blackboard.md) for more information. +## Create an empty shader graph -![](images/Blackboard.png) +To create an empty shader graph asset and build your shader graph from scratch in the Shader Graph window: -After you've set up a project, and become familiar with the Shader Graph window, refer to [My first Shader Graph](First-Shader-Graph.md) for more information on how to get started. +1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **Blank Shader Graph**. -### Internal Inspector + Unity creates a new shader graph asset in your project. -An area that contains information contextual to whatever the user is currently clicking on. It's a window that automatically is hidden by default and only appears when something is selected that can be edited by the user. Use the Internal Inspector to display and modify properties, node options, and the graph settings. Refer to [Internal Inspector](Internal-Inspector.md) for more information. +1. Name the shader graph asset. -![](images/Inspector.png) +You can now open the asset and edit the graph in the [Shader Graph window](Shader-Graph-Window.md). + +> [!NOTE] +> To make such a blank shader graph functional, you have to define a [Target](Graph-Target.md) in the [Graph settings tab](Graph-Settings-Tab.md) of the Graph Inspector. + +## Additional resources + +* [Shader Graph template browser](template-browser.md) +* [Create a custom shader graph template](template-browser.md#create-a-custom-shader-graph-template) +* [Shader Graph window](Shader-Graph-Window.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Edge.md b/Packages/com.unity.shadergraph/Documentation~/Edge.md index 988acaeb150..5a45646a536 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Edge.md +++ b/Packages/com.unity.shadergraph/Documentation~/Edge.md @@ -6,6 +6,6 @@ An **Edge** defines a connection between two [Ports](Port.md). **Edges** define Each **Edge** has a [Data Type](Data-Types.md) which defines what [Ports](Port.md) it can be connected to. Each [Data Type](Data-Types.md) has an associated color for identifying its type. -You can create a new **Edge** by clicking and dragging from a [Port](Port.md) with the left mouse button. Edges can be deleted with Delete (Windows), Command + Backspace (OSX) or from the context menu by right clicking on the [Node](Node.md). +You can create a new **Edge** by clicking and dragging from a [Port](Port.md) with the left mouse button. Edges can be deleted with Delete (Windows), Command + Backspace (OSX) or from the context menu by right clicking on the edge. You can open a contextual [Create Node Menu](Create-Node-Menu.md) by dragging an **Edge** from a [Port](Port.md) with the left mouse button and releasing it in an empty area of the workspace. diff --git a/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md b/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md index 303b7dcda8b..240330c6fd7 100644 --- a/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md +++ b/Packages/com.unity.shadergraph/Documentation~/First-Shader-Graph.md @@ -1,111 +1,121 @@ -# My first Shader Graph +# Create a shader graph and use it with a material -Before you begin, make sure that your project is set up properly, and the graphs are loading correctly. See [Getting started with Shader Graph](Getting-Started.md) for more information. +This example shows you how to do the following: +* Create a simple Lit shader graph with the Universal Render Pipeline (URP). +* Create and manage a material that uses this shader graph in a scene. -## Create a New Graph -Use the Project Browser to create a new [Shader Graph Asset](Shader-Graph-Asset.md) in your project. The **Create > Shader Graph** will display the various creation options. +For more options to get started with Shader Graph, refer to: +* [Create a shader graph asset](create-shader-graph.md) +* [Add and connect nodes in a shader graph](Create-Node-Menu.md) -A **Blank Shader Graph** will create a Shader Graph with no selected active targets or [block nodes](Block-Node.md). You will need to select a target via the [Graph Settings Menu](Graph-Settings-Tab.md) to continue. +## Create a new shader graph -Certain integrations, like Render Pipelines, can also provide pre-configured options for Shader Graphs. For this example, a **Universal > Lit** Shader Graph has been created and opened. +Before you can build a new shader graph, you have to create a shader graph asset to contain it. Follow these steps: -## Create a new node +1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **URP** > **Lit**. + +1. Name the created shader graph asset and press Enter. -Use the **Create Node** menu to create new nodes. There are two ways to open the menu: +The [Shader Graph window](Shader-Graph-Window.md) opens, which allows you to edit the shader graph in the created asset. If the window doesn't open, double-click on the created asset. -1. Right click, and select **Create Node** from the context menu. -2. Press the spacebar. +## Create a new node -In the menu, you can type in the search bar to look for specific nodes, or browse all nodes in the library. In this example, we'll create a Color node. First, type "color" in the **Create Node** menu's search bar. Then, click **Color**, or highlight **Color** and press Enter to create a Color node. +For this example, you need to create a Color node. Follow these steps: -![](images/MyFirstShaderGraph_01.png) +1. Select the Shader Graph window's workspace and press the **Spacebar**. + + The **Create Node** menu opens, with the list of all available nodes. -## Connect nodes +1. In the **Create Node** menu's search bar, type `color`. -To build a graph, you need to connect nodes together. To do so, click the **Output Slot** of a node, and drag that connection into the **Input Slot** of another node. +1. In the **Input** > **Basic** category, double-click on **Color**. -Start by connecting the Color node to the **Base Color** block of our Fragment Stack. +A new **Color** node appears in the workspace. -![](images/MyFirstShaderGraph_02.png) +## Connect the node to the master stack -## Change node output +To use the Color node property as an input for the shader, you need to connect the node to the master stack. Follow these steps: -Notice that the connection updated the main preview, and the 3D Object in the **Main Preview** is now black, which is the color specified in the Color node. You can click on the color bar in that node, and use the color picker to change the color. Any changes you make on the node updates the object in the **Main Preview** in real time. +1. Select the **Out(4)** port of the **Color** node. -For example, if you pick red, the 3D Object immediately reflects this change. +1. Drag it to the **Base Color** block port of the **Fragment** section of the [master stack](Master-Stack.md). -![](images/MyFirstShaderGraph_03.png) +This connection updates the appearance of the 3D object in the **Main Preview**, which is now black, according to the Color node's default value. -## Save the graph +## Change the shader color -Currently, Shader Graphs do not automatically save. There are two ways to save your changes: +You can change the output color of the Color node to view how it affects the final shader. Follow these steps: -1. Click the **Save Asset** button in the top left corner of the window. -3. Close the graph. If Unity detects any unsaved changes, a pop-up window appears, and asks if you want to save those changes. +1. In the **Color** node, click on the color bar. -![](images/MyFirstShaderGraph_04.png) +1. Use the color picker to change the color. -## Create a Material +The color of the 3D object in the **Main Preview** changes to the selected color in real time. -After saving your graph, use the shader to create a new Material. The process of [creating a new Material](https://docs.unity3d.com/Manual/Materials.html) and assigning it a Shader Graph shader is the same as that for regular shaders. In either the main menu or the Project View context menu, select **Assets > Create > Material**. Select the Material you just created. In its Inspector window, select the **Shader** drop-down menu, click **Shader Graphs**, and choose the Shader Graph shader you wish to apply to the Material. +## Save your shader graph -You can also right-click the Shader Graph shader, and select **Create > Material**. This method automatically assigns that Shader Graph shader to the newly created Material. +You need to save your shader graph to use it with a material. To save your shader graph, do one of the following: -![](images/MyFirstShaderGraph_05.png) +* Click the **Save Asset** button in the top left corner of the window. -A Material is also automatically generated as a subasset of the Shader Graph. You can assign it directly to an object in your scene. Modifying a property from the Blackboard on the Shader Graph will update this material in real time, which allows for quick visualization in the scene. +* Close the graph. If Unity detects any unsaved changes, a dialog appears, and asks if you want to save those changes. -## Put the Material in the Scene +## Create a material from your shader graph -Now that you have assigned your shader to a Material, you can apply it to objects in the Scene. Drag and drop the Material onto an object in the Scene. Alternatively, in the object's Inspector window, locate **Mesh Renderer > Materials**, and apply the Material to the **Element**. +After you've saved your shader graph, you can use it to create a new material. -![](images/MyFirstShaderGraph_06.png) +The process of [creating a new Material](https://docs.unity3d.com/Manual/Materials.html) and assigning it a Shader Graph shader is the same as that for regular shaders. -## Use properties to edit the graph +To create a new material from your shader graph, follow these steps: -You can also use properties to alter your shader's appearance. Properties are options that are visible from the Material's Inspector, which lets others change settings in your shader without the need to open the Shader Graph. +1. In the Project window, right-click the shader graph asset you created. -To create a new property, use the **Add (+)** button on the top right corner of the Blackboard, and select the type of property to create. In this example, we'll select **Color**. +1. Select **Create > Material**. -![](images/MyFirstShaderGraph_07.png) +Unity automatically assigns the shader graph asset to the newly created material. You can view the shader graph name selected in the material's Inspector in the **Shader** property. -This adds a new property in the Blackboard with the following options in the **Node Settings** tab of the [Graph Inspector](Internal-Inspector.md) when the property is selected. +## Use the material in the scene -![](images/MyFirstShaderGraph_08.png) +Now that you have assigned your shader to a material, you can apply this material to GameObjects in the scene through one of the following: -| **Option** | **Description** | -| ------------------- | ------------------------------------------------------------ | -| **Property button** | To change the name of the property, right-click the button in the Blackboard, select **Rename**, then enter a new property name. To delete the property, right-click the button, and select **Delete**. | -| **Exposed** | Enable this checkbox to make the property visible from the Material's Inspector. | -| **Reference** | The property's name that appears in C# scripts. To change the **Reference** name, enter a new string. | -| **Default** | The default value of the property. | -| **Mode** | The mode of the property. Each property has different modes. For **Color**, you can select either **Default** or **HDR**. | -| **Precision** | The default [precision](Precision-Modes.md) of the property. | -| **Hybrid Instanced**| An experimental feature that enables this property to be instanced when using the Hybrid DOTS renderer. | +* Drag the material onto a GameObject in the scene. +* In the GameObject's Inspector, go to **Mesh Renderer > Materials**, and set the **Element** property to your material. -There are two ways to reference a property in your graph: +## Control the color from the material's Inspector -1. Drag the property from the Blackboard onto the graph. -2. Right-click and select **Create Node**. The property is listed in the **Properties** category. +You can use a property in the shader graph to alter your shader's appearance directly from the material's Inspector, without the need to edit the shader graph. -![](images/MyFirstShaderGraph_09.png) +To use a Color property instead of a Color node in your shader graph, follow these steps: -Try connecting the property to the **Base Color** block. The object immediately changes to black. +1. Open the shader graph you created earlier in the [Shader Graph window](Shader-Graph-Window.md). -![](images/MyFirstShaderGraph_10.png) +1. In the [Blackboard](Blackboard.md), select **Add (+)**, and then select **Color**. + + The Blackboard now displays a [property of Color type](Property-Types.md#color). -Save your graph, and return to the Material's Inspector. The property now appears in the Inspector. Any changes you make to the property in the Inspector affects all objects that use this Material. +1. Select the property. +1. In the [Graph Inspector](Internal-Inspector.md), in the **Node Settings** tab: + + * Change the **Name** according to the name you want to identify the property within the material's Inspector. + * Make sure to activate the **Show In Inspector** option. -![](images/MyFirstShaderGraph_11.png) +1. Drag the property from the Blackboard onto the Shader Graph window's workspace. -## More Tutorials +1. Connect the property's node to the **Base Color** block port of the **Fragment** section of the [master stack](Master-Stack.md), instead of the Color node you were using previously. + + This connection updates the appearance of the 3D object in the **Main Preview**, which is now black, according to the property's default value. -Older tutorials use an outdated format of Shader Graph with master nodes. When looking at older tutorials, reference the [Upgrade Guide](Upgrade-Guide-10-0-x.md) for tips on how to convert the master node to a [Master Stack](Master-Stack.md). +1. Save your graph, and return to the material's Inspector. + + The property you added in the graph now appears in the material's Inspector. Any changes you make to the property from the Inspector affects all objects that use this material. -To keep exploring how to use Shader Graph to author shaders, check out these blog posts: +## Additional resources -- [Art That Moves: Creating Animated Materials with Shader Graph](https://unity.com/blog/engine-platform/creating-animated-materials-with-shader-graph) -- [Custom Lighting in Shader Graph: Expanding Your Graphs in 2019](https://unity.com/blog/engine-platform/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019) +* [Art That Moves: Creating Animated Materials with Shader Graph](https://unity.com/blog/engine-platform/creating-animated-materials-with-shader-graph) +* [Custom Lighting in Shader Graph: Expanding Your Graphs in 2019](https://unity.com/blog/engine-platform/custom-lighting-in-shader-graph-expanding-your-graphs-in-2019) +* [Shader Graph video tutorials](https://www.youtube.com/user/Unity3D/search?query=shader+graph) (on Unity YouTube Channel) +* [Shader Graph forum](https://discussions.unity.com/tags/c/unity-engine/52/shader-graph) -You can also visit the [Unity YouTube Channel](https://www.youtube.com/channel/UCG08EqOAXJk_YXPDsAvReSg) and look for [video tutorials on Shader Graph](https://www.youtube.com/user/Unity3D/search?query=shader+graph), or head to our [user forum](https://discussions.unity.com/tags/c/unity-engine/52/shader-graph) to find the latest information and conversations about Shader Graph. +> [!NOTE] +> Older tutorials use a former version of Shader Graph with master nodes. To know the differences between the former master node and the [Master Stack](Master-Stack.md), refer to the [Upgrade Guide](Upgrade-Guide-10-0-x.md). diff --git a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md index 4ba39a34efe..07bd1887a40 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md +++ b/Packages/com.unity.shadergraph/Documentation~/Getting-Started.md @@ -1,9 +1,9 @@ # Get started with Shader Graph -Explore the Shader Graph user interface and general workflows to start creating your own shader graphs. +Use the main shader graph creation and editing tools and explore general workflows to start creating your own shader graphs. | Topic | Description | | :--- | :--- | -| **[Creating a new shader graph asset](Create-Shader-Graph.md)** | Create a shader graph asset and get an overview of the main Shader Graph interface elements available to create and configure a shader graph. | -| **[My first Shader Graph](First-Shader-Graph.md)** | Create and configure a shader graph, and create and manipulate a material that uses that shader graph. | -| **[Create a new shader graph from a template](create-shader-graph-template.md)** | Use the Shader Graph template browser to create a shader graph. | +| **[Create a shader graph asset](Create-Shader-Graph.md)** | Create a shader graph asset, either from a template or with a preset target, or from nothing. | +| **[Add and connect nodes in a shader graph](Create-Node-Menu.md)** | Edit your shader graph asset, create nodes, and connect nodes together. | +| **[Create a shader graph and use it with a material](First-Shader-Graph.md)** | Create and configure a shader graph, and create and manipulate a material that uses that shader graph. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Keyword-Node.md b/Packages/com.unity.shadergraph/Documentation~/Keyword-Node.md index 765401ff4cb..08ec9031998 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Keyword-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Keyword-Node.md @@ -1,7 +1,12 @@ # Keyword node ## Description -You can use a Keyword node to create a static branch in your Shader Graph that references a [Keyword](Keywords.md) on the [Blackboard](Blackboard.md). The appearance of a Keyword node, including its available ports, changes based on the Keyword it references. + +You can use a Keyword node to create branches or shader variants that reference [Keywords](Keywords.md) on the [Blackboard](Blackboard.md). + +Based on the Keyword's definition, the node either generates shader variants or dynamic branches. For more information, refer to [Declare shader keywords](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-declare.html). + +The appearance of a Keyword node, including its available ports, changes based on the Keyword it references and its definition. ## Creating new Keyword Nodes Because each Keyword node references a specific Keyword, you must first define at least one Keyword on the Blackboard. Drag a Keyword from the Blackboard to the workspace to make a Keyword node that corresponds to that Keyword. diff --git a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md index c7577407f91..98576807ab3 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md +++ b/Packages/com.unity.shadergraph/Documentation~/Keywords-reference.md @@ -10,6 +10,7 @@ Parameters that all keyword types have in common. | :--- | :--- | | **Name** | The display name of the keyword. Unity shows this name in the title bar of nodes that reference the corresponding keyword, and also in the Material Inspector if you expose that keyword. | | **Reference** | The internal name for the keyword in the shader. Use this **Reference** name instead of the display **Name** when you reference the keyword in a script.

If you overwrite this parameter, be aware of the following:
  • A Keyword **Reference** has to be in full capitals. Unity converts any lowercase letters to uppercase.
  • If the string contains any characters that HLSL does not support, Unity replaces those characters with underscores.
  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
| +| **Promote to final Shader** | Makes the keyword available across the entire shader rather than only within the subgraph. | | **Definition** | Sets the keyword declaration type, which determines how Unity compiles the shader code. This allows you to [optimize the balance between build time, runtime, and file sizes](Keywords-concepts.md#keyword-impact-optimization).

The options are:
  • **Shader Feature**: Unity only compiles shader variants for keyword combinations used by materials in your build, and removes other shader variants.
  • **Multi Compile**: Unity compiles shader variants for all keyword combinations regardless of whether the build uses these variants.
  • **Predefined**: Specifies that the target/sub-target already defines the keyword and you just want to reuse it. Predefined Keywords can either use a [built-in macro](https://docs.unity3d.com/Manual/shader-branching-built-in-macros.html), which results in static branching at build time, or any of the keywords already defined by the Shader Graph Target (for example, [URP](https://docs.unity3d.com/Manual/urp/urp-shaders/shader-keywords-macros.html)), including [Built-In keyword sets](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants-shortcuts.html), and where the branching depends on that definition.
  • **Dynamic Branch**: Unity keeps branching code in one compiled shader program.
| | **Is Overridable** | Indicates whether the keyword's state can be overridden.
For more information, refer to [Toggle shader keywords in a script](https://docs.unity3d.com/Manual/shader-keywords-scripts.html). | | **Generate Material Property** | Generates a material property declaration to display the keyword as a property in the material inspector.
This adds a `[Toggle(_KEYWORD)]` attribute to the material property. For more information, refer to [`MaterialPropertyDrawer`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html). | diff --git a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md index 9b83dfdf03a..2aee450abbe 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Property-Types.md +++ b/Packages/com.unity.shadergraph/Documentation~/Property-Types.md @@ -12,13 +12,17 @@ All properties have the following common parameters in addition to those specifi | Parameter | Description | | :--- | :--- | -| **Name** | The display name of the property. | -| **Reference** | The internal name for the property in the shader. Use this **Reference** name instead of the display **Name** when you reference the property in a script.

If you overwrite this parameter, be aware of the following:
  • If the string doesn't begin with an underscore, Unity automatically adds one.
  • If the string contains any characters that HLSL does not support, Unity removes them.
  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
| -| **Precision** | Sets the data precision mode of the Property. The options are **Inherit**, **Single**, **Half**, and **Use Graph Precision**.
For more details, refer to [Precision Modes](Precision-Modes.md). | -| **Scope** | Specifies where you expect to edit the property for materials. The options are:
  • **Global**: Makes the property editable at a global level, through a C# script only, for all materials that use it. Selecting this option hides or grays out all parameters that relate to the Inspector UI display.
  • **Per Material**: Makes the property independently editable per material, either through a C# script, or in the Inspector UI if you enable **Show In Inspector**.
  • **Hybrid Per Instance**: Has the same effect as **Per Material**, unless you're using [DOTS instancing](https://docs.unity3d.com/Packages/com.unity.entities.graphics@latest/index.html?subfolder=/manual/dots-instancing-shader.html).
| -| **Show In Inspector** | Displays the property in the material inspector.
If you disable this option, it includes an `[HideInInspector]` attribute to the material property (refer to [Properties block reference in ShaderLab](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-attributes) for more details). | -| **Read Only** | Adds a [`PerRendererData`](https://docs.unity3d.com/ScriptReference/Rendering.ShaderPropertyFlags.html) attribute to the material property to display the value as read-only in the material inspector. | -| **Custom Attributes** | A list of entries that allow you to call custom functions you scripted to create additional [material property drawers](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html), like static decorators or complex controls.
The **Custom Material Property Drawers** sample, available in the Package Manager among other [Shader Graph samples](ShaderGraph-Samples.md), shows how to display a Vector2 as a min/max slider, for example.

**Note**: When you declare the custom functions in the script, make sure to suffix their names with `Drawer` or `Decorator`.

In the list, use **+** or **-** to add or remove entries. Each entry corresponds to a function call which requires the following parameters:
  • **Name**: A shorthened version of the function name, without its `Drawer` or `Decorator` suffix.
  • **Value**: The input values for the function as the script expects them.
**Note**: A property can only have one drawer at any given time. | +| **Name** | Displays the user-facing name of the property in the UI. | +| **Reference** | Defines the internal identifier used by the shader for this property; use this `Reference` instead of the display `Name` when accessing the property from a script.

If you overwrite this parameter, be aware of the following:
  • If the string doesn't begin with an underscore, Unity automatically adds one.
  • If the string contains any characters that HLSL does not support, Unity removes them.
  • You can revert to the default value: right-click on the **Reference** field label, and select **Reset Reference**.
| +| **Promote to final Shader** | Makes the property accessible across the final shader as a material property, not as an input port on the Subgraph Node. | +| **Precision** | Sets the numeric precision for the property’s data type.

The options are:
  • **Inherit**: Uses the precision defined by the graph or parent context.
  • **Single**: Uses single-precision (float) for maximum accuracy.
  • **Half**: Uses half-precision to reduce memory and improve performance.
  • **Use Graph Precision**: Uses the precision mode set in the graph settings.

For more details, refer to [Precision Modes](Precision-Modes.md). | +| **Scope** | Specifies where and how the property is edited across materials. The options are:
  • **Global**: Makes the property editable at a global level, through a C# script only, for all materials that use it. Selecting this option hides or grays out all parameters that relate to the Inspector UI display.
  • **Per Material**: Makes the property independently editable per material, either through a C# script, or in the Inspector UI if you enable **Show In Inspector**.
  • **Hybrid Per Instance**: Has the same effect as **Per Material**, unless you're using [DOTS instancing](https://docs.unity3d.com/Packages/com.unity.entities.graphics@latest/index.html?subfolder=/manual/dots-instancing-shader.html).
| +| **Default Value** | Sets the property's initial value to be serialized and used when new material instances are created. The value depends on the property type. | +| **Preview Value** | Sets a value to use for preview in the Shader Graph window, only when you set **Scope** to **Global**. | +| **Show In Inspector** | Displays the property in the material Inspector when enabled.
If you disable this option, it includes an `[HideInInspector]` attribute to the material property (refer to [Properties block reference in ShaderLab](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-attributes) for more details). | +| **Read Only** | Marks the property as non-editable in the material Inspector by adding the [`PerRendererData`](https://docs.unity3d.com/ScriptReference/Rendering.ShaderPropertyFlags.html) attribute. | +| **Custom Attributes** | Enables attachment of custom scripted drawers or decorators to extend the material property UI, such as adding static headers or complex controls.
The **Custom Material Property Drawers** sample, available in the Package Manager among other [Shader Graph samples](ShaderGraph-Samples.md), shows how to display a Vector2 as a min/max slider, for example.

**Note**: When you declare the custom functions in the script, make sure to suffix their names with `Drawer` or `Decorator`.

In the list, use **+** or **-** to add or remove entries. Each entry corresponds to a function call which requires the following parameters:
  • **Name**: A shorthened version of the function name, without its `Drawer` or `Decorator` suffix.
  • **Value**: The input values for the function as the script expects them.
**Note**: A property can only have one drawer at any given time. | +| **Use Custom Binding** | Turns the property into a bound input port for connection to the [**Branch On Input Connection**](Branch-On-Input-Connection-Node.md) node. In the **Label** field, enter the label for the default value that displays on your Subgraph node's port binding in its parent Shader Graph.
This property is available only in sub graphs. | ## Float @@ -28,8 +32,9 @@ Parameters specific to Float properties in addition to the [common parameters](# | Parameter | Description | | :--- | :--- | -| **Mode** | Select the UI mode in which you want to display the Property and manipulate its value in the material inspector. You need to define a specific subset of parameters according to the option you select.

The options are:
  • **Default**: Displays a scalar input field in the material inspector. Only requires a **Default Value**.
  • **Slider**: Defines the Float property in [`Range`](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-declaration-syntax-by-type) mode to display a slider field in the material inspector. Use [additional parameters](#slider) to define the slider type.
  • **Integer**: Displays an integer input field in the material inspector. Only requires a **Default Value**.
  • **Enum**: Adds an [`Enum`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a drop-down with a list of specific values in the material inspector. Use [additional parameters](#enum) to define the enum type.
| -| **Default Value** | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
The value might be either a float or an integer according to the **Mode** and options you select. | +| **Mode** | Selects the UI mode used to display and edit the property value in the material Inspector, requiring a specific subset of parameters depending on the chosen option.

The options are:
  • **Default**: Displays a scalar input field in the material Inspector; only requires a **Default Value**.
  • **Slider**: Defines the Float property in [`Range`](https://docs.unity3d.com/Manual/SL-Properties.html#material-property-declaration-syntax-by-type) mode to display a slider; use [additional parameters](#slider) to define the slider type.
  • **Integer**: Displays an integer input field in the material Inspector; only requires a **Default Value**.
  • **Enum**: Adds an [`Enum`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a drop-down of specific values; use [additional parameters](#enum) to define the enum type.
| +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
The value is either a float or an integer depending on the selected **Mode** and its options. Not available when **Scope** is set to **Global**. | +| **Requires Literal Input** | Requires the input to be a constant value. When enabled, if the user connects a variable, the shader compilation fails with an error. | ### Slider @@ -37,10 +42,10 @@ Additional parameters available when you set the Float property **Mode** to **Sl | Parameter | Description | | :--- | :--- | -| **Slider Type** | Select the slider response type to apply when you move the slider to change the value in the material inspector.

The options are:
  • **Default**: Displays a slider with a linear response. The value responds linearly within the slider range.
  • **Power**: Adds a [`PowerSlider`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a slider with a non-linear response. The value responds exponentially within the slider range according to the specified **Power** value.
  • **Integer**: Adds an [`IntRange`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to the Float property to display a slider with an integer value response. The value responds in integer steps within the slider range.
| -| **Min** | The minimum value of the slider range. | -| **Max** | The maximum value of the slider range. | -| **Power** | The exponent to use for non-linear response between **Min** and **Max** when you set the **Slider Type** to **Power**. | +| **Slider Type** | Selects the slider response type applied when adjusting the value in the material Inspector.

The options are:
  • **Default**: Displays a slider with a linear response; the value changes linearly within the slider range.
  • **Power**: Adds a [`PowerSlider`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to display a slider with a non-linear response; the value changes exponentially within the range according to the specified **Power**.
  • **Integer**: Adds an [`IntRange`](https://docs.unity3d.com/ScriptReference/MaterialPropertyDrawer.html) attribute to display a slider with integer steps; the value changes in whole-number increments within the range.
| +| **Min** | Sets the minimum value of the slider range. | +| **Max** | Sets the maximum value of the slider range. | +| **Power** | Defines the exponent used for non-linear response between **Min** and **Max** when **Slider Type** is set to **Power**. | ### Enum @@ -48,166 +53,163 @@ Additional parameters available when you set the Float property **Mode** to **En | Parameter | Description | | :--- | :--- | -| **Enum Type** | Select the source type to use for the dropdown entries in the material inspector.

The options are:
  • **Explicit Values**: Use a list of **Entries** you directly specify in this interface.
  • **Type Reference**: Use a **C# Enum Type** reference that contains predefined entries.
| -| **Entries** | The list of dropdown entries to define when you set **Enum Type** to **Explicit Values**.

Use **+** or **-** to add or remove entries. You have to define each entry with the following parameters:
  • **Name**: The entry name to display in the dropdown in the material inspector.
  • **Value**: The value to apply to the Float property when you select its **Name** in the dropdown in the material inspector.
**Note**: The **Entries** option allows you to define up to 7 entries. If you need a dropdown with more entries, use the **Type Reference** option. | -| **C# Enum Type** | The existing Enum Type reference to use when you set **Enum Type** to **Type Reference**.
Specify the full path of the type with the namespace. For example, to get Unity's predefined blend mode values: `UnityEngine.Rendering.BlendMode`. | +| **Enum Type** | Selects the source used to populate the dropdown entries in the material Inspector.

The options are:
  • **Explicit Values**: Uses a list of **Entries** you specify directly in this interface.
  • **Type Reference**: Uses a **C# Enum Type** reference that contains predefined entries.
| +| **Entries** | Defines the list of dropdown entries when **Enum Type** is set to **Explicit Values**.

Use **+** or **-** to add or remove entries. Each entry requires the following parameters:
  • **Name**: Sets the label displayed in the dropdown in the material Inspector.
  • **Value**: Sets the numeric value applied to the Float property when its **Name** is selected.
**Note**: Supports up to 7 entries. If you need more, use **Type Reference**. | +| **C# Enum Type** | Specifies the existing enum type to reference when **Enum Type** is set to **Type Reference**.
Enter the full type path with namespace, for example: `UnityEngine.Rendering.BlendMode`. | ## Vector 2 Defines a **Vector 2** value. Displays a **Vector 4** input field in the material inspector, where the z and w components are not used. -| Data Type | Modes | -|:-------------|:------| -| Vector 2 | | - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 2 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 2D vector value (Vector2). | ## Vector 3 Defines a **Vector 3** value. Displays a **Vector 4** input field in the material inspector, where the w component is not used. -| Data Type | Modes | -|:-------------|:------| -| Vector 3 | | - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 3 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 3D vector value (Vector3). | ## Vector 4 Defines a **Vector 4** value. Displays a **Vector 4** input field in the material inspector. -| Data Type | Modes | -|:-------------|:------| -| Vector 4 | | - -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 4D vector value (Vector4). | ## Color Defines a **Color** value. If the Property Inspector displays **Main Color**, this is the [Main Color](https://docs.unity3d.com/Manual/SL-Properties.html) for the shader. To select or deselect this node as the **Main Color**, right-click it in the graph or Blackboard and select **Set as Main Color** or **Clear Main Color**. Corresponds to the [`MainColor`](https://docs.unity3d.com/Manual/SL-Properties.html) ShaderLab Properties attribute. -| Data Type | Modes | -|:-------------|:------| -| Color | Default, HDR | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| **Mode** | Selects the color input mode.

The options are:
  • **Default**: Allows to select a standard sRGB color.
  • **HDR**: Allows to select an HDR color and sets its intensity from -10 to 10 exposure stops.
| + +**Note:** In versions prior to 10.0, Shader Graph didn't correct HDR colors for the project colorspace. Version 10.0 corrected this behavior. HDR color properties that you created with older versions maintain the old behavior, but you can use the [Graph Inspector](Internal-Inspector.md) to upgrade them. To mimic the old behavior in a gamma space project, you can use the [Colorspace Conversion Node](Colorspace-Conversion-Node.md) to convert a new HDR **Color** property from **RGB** to **Linear** space. -#### Default +## Boolean + +Defines a **Boolean** value. Displays a **ToggleUI** field in the material inspector. Note that internally to the shader this value is a **Float**. The **Boolean** type in Shader Graph is merely for usability. -Displays an sRGB color field in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A boolean value. | -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +## Gradient -#### HDR +Defines a constant **Gradient**. -Displays an HDR color field in the material inspector. +Parameters specific to Gradient properties in addition to the [common parameters](#common-parameters): -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Vector 4 | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Displays the **HDR Gradient Editor** with selectable modes.
The options are:
  • **Blend (Classic)**: Creates transitions based on traditional HDR handling.
  • **Blend (Perceptual)**: Creates human vision–based gradient transitions in HDR.
  • **Fixed**: Creates a discrete gradient with fixed steps.
| -NOTE: In versions prior to 10.0, Shader Graph didn't correct HDR colors for the project colorspace. Version 10.0 corrected this behavior. HDR color properties that you created with older versions maintain the old behavior, but you can use the [Graph Inspector](Internal-Inspector.md) to upgrade them. To mimic the old behavior in a gamma space project, you can use the [Colorspace Conversion Node](Colorspace-Conversion-Node.md) to convert a new HDR **Color** property from **RGB** to **Linear** space. +**Note:** The **Promote to final Shader** parameter is not available for this property. ## Texture 2D Defines a [Texture 2D](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. If the Property Inspector displays **Main Texture**, this is the `Main Texture` for the shader. To select or deselect this node as the `Main Texture`, right-click on it in the graph or Blackboard and select **Set as Main Texture** or **Clear Main Texture**. Corresponds to the [`MainTexture`](https://docs.unity3d.com/Manual/SL-Properties.html) ShaderLab Properties attribute. -| Data Type | Modes | -|:-------------|:------| -| Texture | White, Black, Grey, Bump | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A texture asset reference. | +| **Mode** | Defines the fallback texture Unity uses when none is provided.

The options are:
  • **White**: Sets a solid white (1,1,1) texture to ensure full-intensity sampling.
  • **Black**: Sets a solid black (0,0,0) texture to yield zero contribution.
  • **Grey**: Sets a mid-grey in sRGB (~0.5) as a neutral fallback.
  • **Normal Map**: Sets a flat normal value to keep surfaces flat without a normal texture.
  • **Linear Grey**: Sets a mid-grey in linear color space.
  • **Red**: Sets a solid red (1,0,0) texture, useful for data expected in the red channel.
| +| **Use Tiling and Offset** | Toggles the property `NoScaleOffset` to enable manipulating scale and offset separately from other texture properties; see [SplitTextureTransformNode](Split-Texture-Transform-Node.md).
A boolean value. | +| **Use TexelSize** | Uses the size of texels expressed in UV space. | + +## Texture 2D Array + +Defines a [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | -| Use Tiling and Offset | Boolean | When set to false, activates the property [NoScaleOffset](https://docs.unity3d.com/Manual/SL-Properties.html), to enable manipulation of scale and offset separately from other texture properties. See [SplitTextureTransformNode](Split-Texture-Transform-Node.md).| +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A texture asset reference. | ## Texture 3D Defines a [Texture 3D](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture 3D](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. -| Data Type | Modes | -|:-------------|:------| -| Texture | | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A texture asset reference. | -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +## Cubemap -## Texture 2D Array +Defines a [Cubemap](https://docs.unity3d.com/Manual/class-Cubemap.html) value. Displays an object field of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. -Defines a [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) value. Displays an object field of type [Texture 2D Array](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A cubemap asset reference. | -| Data Type | Modes | -|:-------------|:------| -| Texture | | + +## Virtual Texture -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +Defines a [Texture Stack](https://docs.unity3d.com/2020.1/Documentation/Manual/svt-use-in-shader-graph.html), which appears as object fields of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the Material Inspector. The number of fields corresponds to the number of layers in the property. -## Cubemap +| Parameter | Description | +| :--- | :--- | +| **Layers** | Manages the collection of layers in the stack.

The options are:
  • **Add (+)**: Adds a new layer.
  • **Remove (−)**: Removes the selected layer.

Select the active layer to edit its parameters. | +| **Layer Name** | Displays the user-defined name for the selected layer. | +| **Layer Reference** | Defines the internal identifier used to reference the selected layer. | +| **Layer Texture** | Assigns the default texture asset for the selected layer. | +| **Layer Texture Type** | Specifies the expected data type for the selected layer’s texture, which determines import settings and sampling behavior, such as sRGB vs Linear and normal map decoding.

The options are:
  • **Normal tangent space**: Encodes per-texel normals relative to the mesh’s tangent basis so surface detail follows UVs and local orientation.
  • **Normal object space**: Preserves per-texel normals in object coordinates.
| -Defines a [Cubemap](https://docs.unity3d.com/Manual/class-Cubemap.html) value. Displays an object field of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the material inspector. +**Note:** The **Use Custom Binding** parameter isn't available for this property. -| Data Type | Modes | -|:-------------|:------| -| Cubemap | | +**Note:** The **Promote to final Shader** parameter is not available for this property. -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Cubemap | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +## Matrix 2 - -## Virtual Texture +Defines a Matrix 2. Matrices do not display in the **Inspector** window of the material. -Defines a [Texture Stack](https://docs.unity3d.com/2020.1/Documentation/Manual/svt-use-in-shader-graph.html), which appears as object fields of type [Texture](https://docs.unity3d.com/Manual/class-TextureImporter.html) in the Material Inspector. The number of fields correspond to the number of layers in the property. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 2×2 matrix value (Matrix2). | -| Data Type | Modes | -|:----------|-------| -| Virtual Texture | | +## Matrix 3 -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Texture | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +Defines a Matrix 3 value. Can't be displayed in the material inspector. -## Boolean +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 3×3 matrix value (Matrix3). | -Defines a **Boolean** value. Displays a **ToggleUI** field in the material inspector. Note that internally to the shader this value is a **Float**. The **Boolean** type in Shader Graph is merely for usability. +## Matrix 4 -| Data Type | Modes | -|:-------------|:------| -| Boolean | | +Defines a Matrix 4 value. Can't be displayed in the material inspector. -| Field | Type | Description | -|:-------------|:------|:------------| -| Default | Boolean | The default value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html). | +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Sets the initial value of the [Property](https://docs.unity3d.com/Manual/SL-Properties.html).
A 4×4 matrix value (Matrix4). | -## Matrix 2x2 +## SamplerState -Defines a Matrix 2. Matrices do not display in the **Inspector** window of the material. +Defines a **SamplerState**. -| Field | Type | -|:--------|:---------| -| Default | Matrix 2 | +Parameters specific to Float properties in addition to the [common parameters](#common-parameters): -## Matrix 3x3 +| Parameter | Description | +| :--- | :--- | +| **Filter** | Specifies the texture filtering mode used when sampling. The options are:
  • **Linear**: Sets bilinear filtering within mip levels for smoother results, at the cost of potential blur.
  • **Point**: Sets nearest-neighbor sampling for a crisp, pixelated look.
  • **Trilinear**: Sets bilinear filtering with interpolation between mip levels for smoother transitions.
| +| **Wrap** | Specifies how UVs outside the [0–1] range are handled. The options are:
  • **Repeat**: Tiles the texture infinitely.
  • **Clamp**: Clamps to edge texels with no tiling.
  • **Mirror**: Tiles by mirroring each repeat.
  • **MirrorOnce**: Mirrors once, then clamps.
| +| **Aniso** | Specifies the anisotropic filtering level to improve texture clarity at grazing angles. The options are:
  • **None**: Disables anisotropic filtering.
  • **x2**: Applies a low level for higher performance.
  • **x4**: Applies a moderate level.
  • **x8**: Applies a high level.
  • **x16**: Applies the maximum level for best quality at lower performance.
| -Defines a Matrix 3 value. Can't be displayed in the material inspector. +## Dropdown -| Field | Type | -|:--------|:---------| -| Default | Matrix 3 | +Defines a **Dropdown**. This property is available only in sub graphs. -## Matrix 4x4 +Parameters specific to Dropdown properties in addition to the [common parameters](#common-parameters): -Defines a Matrix 4 value. Can't be displayed in the material inspector. +| Parameter | Description | +| :--- | :--- | +| **Default Value** | Selects the default Entry that you want Shader Graph to select on your property. | +| **Entries** | Adds a corresponding input port to the node for each entry.

The options are:
  • **Add to the list (+)**: Adds a new option to your dropdown.
  • **Remove selection from the list (-)**: Removes the selected entry from the list.
| + +**Note:** The **Promote to final Shader** parameter is not available for this property. -| Field | Type | -|:--------|:---------| -| Default | Matrix 4 | diff --git a/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md b/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md index 143a0bbcb90..f43d5783719 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md +++ b/Packages/com.unity.shadergraph/Documentation~/Rounded-Rectangle-Node.md @@ -1,20 +1,23 @@ -# Rounded Rectangle Node +# Rounded Rectangle node -## Description +The Rounded Rectangle node generates a filled rounded rectangle shape with a border around it. The output is 1 for the rectangle and 0 for the border. -Generates a rounded rectangle shape based on input **UV** at the size specified by inputs **Width** and **Height**. The radius of each corner is defined by input **Radius**. The generated shape can be offset or tiled by connecting a [Tiling And Offset Node](Tiling-And-Offset-Node.md). Note that in order to preserve the ability to offset the shape within the UV space the shape will not automatically repeat if tiled. To achieve a repeating rounded rectangle effect first connect your input through a [Fraction Node](Fraction-Node.md). +To move the rectangle within the space, do the following: -NOTE: This [Node](Node.md) can only be used in the **Fragment** [Shader Stage](Shader-Stage.md). +- To offset the shape, input a [Tiling And Offset node](Tiling-And-Offset-Node.md) and adjust the **Offset** property. +- To tile the shape, input a [Tiling and Offset node](Fraction-Node.md) into a [Fraction node](Tiling-And-Offset-Node.md), then input the Fraction node into the Rounded Rectangle node. + +You can only output this node into the Fragment Context. ## Ports -| Name | Direction | Type | Binding | Description | -|:------------ |:-------------|:-----|:---|:---| -| UV | Input | Vector 2 | UV | Input UV value | -| Width | Input | Float | None | Rounded Rectangle width | -| Height | Input | Float | None | Rounded Rectangle height | -| Radius | Input | Float | None | Corner radius | -| Out | Output | Float | None | Output value | +| Name | Direction | Type | Binding | Description | +|-|-|-|-|-| +| **UV** | Input | Vector 2 | UV | Sets the UV coordinates to use to sample the rounded rectangle shape and the border. | +| **Width** | Input | Float | None | Sets how much horizontal space the rectangle fills, where 1 is a full-width rectangle without a border on the left and right. | +| **Height** | Input | Float | None | Sets how much vertical space the rectangle fills, where 1 is a full height rectangle without a border above and below. | +| **Radius** | Input | Float | None | Sets the roundness of the corners of the rectangle. The range is 0 to 1, where 0 is right-angled corners. | +| **Out** | Output | Float | None | The rounded rectangle and the border, where 1 is the rectangle and 0 is the border. | ## Generated Code Example diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md index 80417b2b67a..7a908788bcf 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Asset.md @@ -1,9 +1,36 @@ -# Shader Graph Asset +# Shader Graph Asset reference -## Description +A Shader Graph asset is a file that contains a graph you create and edit in the [**Shader Graph** window](Shader-Graph-Window.md). It is also a shader that you can select from a material's shader dropdown, as any other shader. -The **Shader Graph Asset** is the new **Asset** type introduced with the shader graph. You can create a **Shader Graph Asset** from the [Project Window](https://docs.unity3d.com/Manual/ProjectView.html) from the **Create** menu. +To access the properties of a Shader Graph asset in the **Inspector** window, select the asset in your project. -For convenience there is a **Create** menu entry for **Blank Shader Graph** and [Sub-graph](Sub-graph.md). They can be found in the **Shader** sub-menu. Additional options may be provided by render pipelines. These options will create a new Shader Graph with required settings and [Block]() nodes in the [Master Stack]() for the selected shading model. +## Action buttons -You can open the [Shader Graph Window](Shader-Graph-Window.md) by double clicking a **Shader Graph Asset** or by clicking **Open Shader Editor** in the [Inspector](https://docs.unity3d.com/Manual/UsingTheInspector.html) when the **Shader Graph Asset** is selected. +Manage Shader Graph assets code. + +| Property | Description | +|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Open Shader Editor** | Opens the selected asset in the [Shader Graph window](Shader-Graph-Window.md) so you can edit the graph. | +| **View Generated Shader** | Opens the shader code that the shader graph generates in a text editor or an IDE, such as Visual Studio. The code includes all possible passes and targets. | +| **Regenerate** | Updates the code you edited in your text editor or IDE. This button appears only when you select **View Generated Shader**. | +| **Copy Shader** | Copies the shader code to the clipboard. | + +## Properties + +Manage Shader Graph assets templates. + +| Property | Description | +|---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Use As Template** | Marks the selected Shader Graph asset as a template. When enabled, the asset appears in the [Shader Graph template browser](template-browser.md), but is no longer listed in any material's **Shader** dropdown by default. | +| **Expose As Shader** | Keeps the asset listed in a material's **Shader** dropdown so you can still use it as a shader when you also use it as a template. This is available only when **Use As Template** is enabled. | +| **Name** | Sets the name of the template in the Shader Graph template browser. | +| **Category** | Sets the category of the template in the Shader Graph template browser. | +| **Description** | Sets the description of the template in the Shader Graph template browser. | +| **Icon** | Sets the icon that represents the template in the Shader Graph template browser. | +| **Thumbnail** | Sets the image that represents the template in the Shader Graph template browser. | + +## Additional resources + +* [Creating a new shader graph asset](Create-Shader-Graph.md) +* [Shader Graph Window](Shader-Graph-Window.md) +* [Shader Graph template browser](template-browser.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md index 02dbbad75cc..74a705a0853 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Preferences.md @@ -7,12 +7,15 @@ Use the Shader Graph preferences to define shader graph settings for your system ## Settings -| Name | Description | -|:--------------------------|:----------------------------------------| -| **Preview Variant Limit** | Set the maximum number of variants allowed in local projects. This is a local version of the **Shader Variant Limit** in the project settings. If your graph exceeds this maximum value, Unity returns the following error:
_Validation: Graph is generating too many variants. Either delete Keywords, reduce Keyword variants or increase the **Shader Variant Limit** in Preferences > Shader Graph._
For more information about shader variants, refer to [Making multiple shader program variants](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). For more information about the Shader Variant Limit, refer to [Shader graph project settings](Shader-Graph-Project-Settings.md)| -| **Automatically Add and Remove Block Nodes** | Automatically add [Block nodes](Block-Node.md) to, or remove them from, the [Master Stack](Master-Stack.md) as needed. If you select this option, any [Block nodes](Block-Node.md) that your Shader graph needs are added to the [Master Stack](Master-Stack.md) automatically. Any incompatible [Block nodes](Block-Node.md) that have no incoming connections will be removed from the [Master Stack](Master-Stack.md). If you don't select this option, no [Block nodes](Block-Node.md) are added to, or removed from, the [Master Stack](Master-Stack.md) automatically. | -| **Enable Deprecated Nodes** | Disable warnings for deprecated nodes and properties. If you select this option, Shader Graph doesn't display warnings if your graph contains deprecated nodes or properties. If you don't select this option, Shader Graph displays warnings for deprecated nodes and properties, and any new nodes and properties you create use the latest version. | -| **Zoom Step Size** | Control how much the camera in Shader Graph zooms each time you roll the mouse wheel. This makes it easier to control the difference in zoom speed between the touchpad and mouse. A touchpad simulates hundreds of steps, which causes very fast zooms, whereas a mouse wheel steps once with each click. | +| Name | Description | +|:---------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Preview Variant Limit** | Sets the maximum number of variants allowed in local projects. This is a local version of the **Shader Variant Limit** in the project settings. If your graph exceeds this maximum value, Unity returns the following error:
_Validation: Graph is generating too many variants. Either delete Keywords, reduce Keyword variants, or increase the **Shader Variant Limit** in Preferences > Shader Graph._
For more information about shader variants, refer to [Making multiple shader program variants](https://docs.unity3d.com/Manual/SL-MultipleProgramVariants.html). For more information about the Shader Variant Limit, refer to [Shader graph project settings](Shader-Graph-Project-Settings.md) | +| **Automatically Add and Remove Block Nodes** | Adds to the [Master Stack](Master-Stack.md) any needed [Block nodes](Block-Node.md) and removes from the [Master Stack](Master-Stack.md) any Block nodes with no incoming connections. | +| **Enable Deprecated Nodes** | Disables warnings for deprecated nodes and properties. When enabled, Shader Graph doesn't display warnings if your graph contains deprecated nodes or properties. When disabled, Shader Graph displays warnings for deprecated nodes and properties, and the new nodes and properties you create use the latest version. | +| **Zoom Step Size** | Adjusts how much the Shader Graph camera zooms with each mouse wheel movement. This helps balance zoom speed, since touchpads can zoom much faster than regular mouse wheels.
Only affects materials created automatically, such as when you make a new shader graph from a Decal Projector or Fullscreen Renderer Feature. | +| **Graph Template Workflow** | Sets whether Unity creates new materials as [material variants](https://docs.unity3d.com/Manual/materialvariant-concept.html) from the child asset of the shader graph asset, or as standalone materials. The options are:
  • **Material Variant**: Unity creates material variants from the child asset of the shader graph asset.
  • **Material**: Unity creates standalone materials.
| +| **Open new Shader Graphs automatically** | Makes Unity open the Shader Graph window immediately after you create a new shader graph asset. When disabled, Unity does not open the window, and you must open the graph manually. | +| **New Nodes Preview** | Makes Shader Graph automatically expand the preview area for any newly created node that supports previews. When disabled, Shader Graph does not expand previews, but you can expand them manually. | ## Additional resources diff --git a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md index e771e131aa6..d49036d4740 100644 --- a/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md +++ b/Packages/com.unity.shadergraph/Documentation~/Shader-Graph-Window.md @@ -1,14 +1,25 @@ # Shader Graph Window -## Description +The **Shader Graph Window** contains the workspace to edit your shader graphs. -The **Shader Graph Window** contains the workspace for creating shaders with the **Shader Graph** system. To open the **Shader Graph Window**, you must first create a [Shader Graph Asset](index.md). For more information, refer to the [Getting Started](Getting-Started.md) section. +To access the **Shader Graph Window**, you must first create a [Shader Graph Asset](index.md). If the Shader Graph window doesn't open automatically after you [create a new shader graph asset](create-shader-graph.md), you have to double-click on the created asset. -The **Shader Graph** window contains various individual elements such as the [Blackboard](Blackboard.md), [Graph Inspector](Internal-Inspector.md), and [Main Preview](Main-Preview.md). You can move these elements around inside the workspace. They automatically anchor to the nearest corner when scaling the **Shader Graph Window**. +## Shader Graph window layout + +![The Shader Graph window with its main elements labeled from A to F.](images/ShaderGraphWindow.png) + +| Label | Name | Description | +| :--- | :--- | :--- | +| **A** | [Toolbar](#toolbar) | A set of tools to manage the shader graph asset, display elements in the window, and more. | +| **B** | [Workspace](#workspace) | The area where you create your graph. | +| **C** | [Master Stack](Master-Stack.md) | The final connection that determines your shader output. It consists of two separate contexts: **Vertex** and **Fragment**. | +| **D** | [Main Preview](Main-Preview.md) | Previews the current shader output. Use this to rotate the object, and zoom in and out. You can also change the basic mesh on which the shader is previewed. | +| **E** | [Blackboard](Blackboard.md) | Contains all of the shader's properties and keywords in a single, collected view. Use the Blackboard to add, remove, rename, and reorder properties and keywords. | +| **F** | [Graph Inspector](Internal-Inspector.md) | Displays the properties of the currently selected component. Use this to modify properties, node options, and the graph settings. This window is hidden by default and only appears when something is selected that can be edited by the user. | ## Toolbar -The toolbar at the top of the **Shader Graph Window** contains the following commands. +Use the **Shader Graph Window** toolbar to manage the shader graph asset, display elements in the window, and more. | Icon | Item | Description | |:--------------------|:--------------------|:------------| @@ -25,42 +36,42 @@ The toolbar at the top of the **Shader Graph Window** contains the following com ## Workspace -The workspace is where you create [Node](Node.md) networks. +Use the **Shader Graph Window** workspace to create [Node](Node.md) networks and connect them to the **Master Stack**. + To navigate the workspace, do the following: - Press and hold the Alt key and drag with the left mouse button to pan. - Use the mouse scroll wheel to zoom in and out. You can hold the left mouse button and drag to select multiple [Nodes](Node.md) with a marquee. There are also various [shortcut keys](Keyboard-shortcuts.md) you can use for better workflow. +### Context Menu -## Context Menu - -Right-click within the workspace to open a context menu. However, if you right-click on an item within the workspace, such as a [Node](Node.md), the context menu for that item opens. The workspace context menu provides the following options. +Right-click in the workspace area, on a node, or on a selection of nodes to open a context menu. | Item | Description | |:-----------------------------|:------------| | **Create Node** | Opens the [Create Node Menu](Create-Node-Menu.md). | | **Create Sticky Note** | Creates a new [Sticky Note](Sticky-Notes.md) on the Graph. | -| **Collapse All Previews** | Collapses previews on all [Nodes](Node.md). | -| **Cut** | Removes the selected [Nodes](Node.md) from the graph and places them in the clipboard. | -| **Copy** | Copies the selected [Nodes](Node.md) to the clipboard. | -| **Paste** | Pastes the [Nodes](Node.md) from the clipboard. | -| **Delete** | Deletes the selected [Nodes](Node.md). | -| **Duplicate** | Duplicates the selected [Nodes](Node.md). | -| **Select / Unused Nodes** | Selects all nodes on the graph that are not contributing to the final shader output from the [Master Stack](Master-Stack.md). | -| **View / Collapse Ports** | Collapses unused ports on all selected [Nodes](Node.md). | -| **View / Expand Ports** | Expands unused ports on all selected [Nodes](Node.md). | -| **View / Collapse Previews** | Collapses previews on all selected [Nodes](Node.md). | -| **View / Expand Previews** | Expands previews on all selected [Nodes](Node.md). | -| **Precision / Inherit** | Sets the precision of all selected Nodes to Inherit. | -| **Precision / Float** | Sets the precision of all selected nodes to Float. | -| **Precision / Half** | Sets the precision of all selected nodes to Half. | +| **Collapse All Previews** | Collapses previews on all nodes. | +| **Cut** | Removes the selected nodes from the graph and places them in the clipboard. | +| **Copy** | Copies the selected nodes to the clipboard. | +| **Paste** | Pastes the nodes from the clipboard. | +| **Delete** | Deletes the selected nodes. | +| **Duplicate** | Duplicates the selected nodes. | +| **Select** > **Unused Nodes** | Selects all nodes on the graph that are not contributing to the final shader output from the [Master Stack](Master-Stack.md). | +| **View** > **Collapse Ports** | Collapses unused ports on all selected nodes. | +| **View** > **Expand Ports** | Expands unused ports on all selected nodes. | +| **View** > **Collapse Previews** | Collapses previews on all selected nodes. | +| **View** > **Expand Previews** | Expands previews on all selected nodes. | +| **Precision** > **Inherit** | Sets the precision of all selected nodes to Inherit. | +| **Precision** > **Float** | Sets the precision of all selected nodes to Float. | +| **Precision** > **Half** | Sets the precision of all selected nodes to Half. | ## Additional resources -- [Color Modes](Color-Modes.md) -- [Create Node Menu](Create-Node-Menu.md) -- [Keyboard shortcuts](Keyboard-shortcuts.md) -- [Master Stack](Master-Stack.md) -- [Nodes](Node.md) -- [Sticky Notes](Sticky-Notes.md) \ No newline at end of file +* [Color Modes](Color-Modes.md) +* [Create Node Menu](Create-Node-Menu.md) +* [Keyboard shortcuts](Keyboard-shortcuts.md) +* [Master Stack](Master-Stack.md) +* [Nodes](Node.md) +* [Sticky Notes](Sticky-Notes.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md index 03a0c6fdc7c..b864b3cbdbe 100644 --- a/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.shadergraph/Documentation~/TableOfContents.md @@ -4,18 +4,17 @@ * [Install Shader Graph](install-shader-graph.md) * [Upgrade to Shader Graph 10.0.x](Upgrade-Guide-10-0-x.md) * [Get started with Shader Graph](Getting-Started.md) - * [Creating a new Shader Graph Asset](Create-Shader-Graph.md) - * [My first Shader Graph](First-Shader-Graph.md) - * [Create a new shader graph from a template](create-shader-graph-template.md) + * [Create a shader graph asset](Create-Shader-Graph.md) + * [Add and connect nodes](Create-Node-Menu.md) + * [Create a shader graph and use it with a material](First-Shader-Graph.md) * [Shader Graph UI reference](ui-reference.md) * [Shader Graph template browser](template-browser.md) * [Shader Graph Window](Shader-Graph-Window.md) - * [Blackboard](Blackboard.md) + * [Master Stack](Master-Stack.md) * [Main Preview](Main-Preview.md) + * [Blackboard](Blackboard.md) * [Graph Inspector](Internal-Inspector.md) - * [Create Node Menu](Create-Node-Menu.md) - * [Graph Settings Tab](Graph-Settings-Tab.md) - * [Master Stack](Master-Stack.md) + * [Graph Settings Tab](Graph-Settings-Tab.md) * [Shader Graph Preferences](Shader-Graph-Preferences.md) * [Shader Graph Project Settings](Shader-Graph-Project-Settings.md) * [Shader Graph Keyboard Shortcuts](Keyboard-shortcuts.md) @@ -317,8 +316,10 @@ * [Parallax Mapping](Parallax-Mapping-Node.md) * [Parallax Occlusion Mapping](Parallax-Occlusion-Mapping-Node.md) * [Block Nodes](Block-Node.md) - * [Built In Blocks](Built-In-Blocks.md) - * [Terrain Texture](Terrain-Texture-Node.md) + * [Built In Blocks](Built-In-Blocks.md) + * [Terrain](Terrain-Nodes.md) + * [Terrain Properties](Terrain-Properties-Node.md) + * [Terrain Texture](Terrain-Texture-Node.md) * [Samples](ShaderGraph-Samples.md) * [Feature Examples](Shader-Graph-Sample-Feature-Examples.md) * [Production Ready Shaders](Shader-Graph-Sample-Production-Ready.md) diff --git a/Packages/com.unity.shadergraph/Documentation~/Terrain-Nodes.md b/Packages/com.unity.shadergraph/Documentation~/Terrain-Nodes.md new file mode 100644 index 00000000000..5f1502c0750 --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Terrain-Nodes.md @@ -0,0 +1,6 @@ +# Terrain nodes + +| Topic | Description | +| :--- | :--- | +| **[Terrain Properties](Terrain-Properties-Node.md)** | Input properties from the actively rendered Terrain into the Contexts of a Terrain Lit shader graph. | +| **[Terrain Texture](Terrain-Texture-Node.md)** | Sample textures, masks and other properties from the Terrain Layers of a terrain material, adjust them, and input them into the Contexts of a Terrain Lit shader graph. | diff --git a/Packages/com.unity.shadergraph/Documentation~/Terrain-Properties-Node.md b/Packages/com.unity.shadergraph/Documentation~/Terrain-Properties-Node.md new file mode 100644 index 00000000000..a836928e51e --- /dev/null +++ b/Packages/com.unity.shadergraph/Documentation~/Terrain-Properties-Node.md @@ -0,0 +1,15 @@ +# Terrain Properties Node + +## Description + +Use the Terrain Properties node to input properties from the actively rendered Terrain into the Contexts of a Terrain Lit shader graph. + +The Terrain Properties node is compatible only with Terrain Lit shader graphs. You can't use it with other types of shaders. + +## Ports + +| Name | Direction | Type | Description | +|:-----------------|:-----------------|:------------|:-------------| +| Max Local Height | Output | float | The maximum local height stored in the Terrain heightmap. Unlike the actual values stored in the heightmap, this is not a normalized value. | +| Basemap Distance | Output | float | The basemap distance as set in the Terrain's settings. | +| Layers Count | Output | uint | The number of Terrain Layers assigned to the Terrain. | diff --git a/Packages/com.unity.shadergraph/Documentation~/create-shader-graph-template.md b/Packages/com.unity.shadergraph/Documentation~/create-shader-graph-template.md deleted file mode 100644 index 5e791693749..00000000000 --- a/Packages/com.unity.shadergraph/Documentation~/create-shader-graph-template.md +++ /dev/null @@ -1,20 +0,0 @@ -# Create a new shader graph from a template - -To create a new shader graph from a template, follow these steps: - -1. In the **Project** window, right-click and select **Create** > **Shader Graph** > **From Template**. - - The [template browser](template-browser.md) opens. - -1. Select the desired template and click **Create**. - - Unity creates a new shader graph asset in your project. - -1. Name the shader graph asset. - -You can now edit the graph in the [Shader Graph window](Shader-Graph-Window.md). - -## Additional resources - -* [Shader Graph template browser](template-browser.md) -* [Create a custom shader graph template](template-browser.md#create-a-custom-shader-graph-template) diff --git a/Packages/com.unity.shadergraph/Documentation~/images/Blackboard.png b/Packages/com.unity.shadergraph/Documentation~/images/Blackboard.png deleted file mode 100644 index d640d95c4bf..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/Blackboard.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/Inspector.png b/Packages/com.unity.shadergraph/Documentation~/images/Inspector.png deleted file mode 100644 index d84f421f3e1..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/Inspector.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MainPreview.png b/Packages/com.unity.shadergraph/Documentation~/images/MainPreview.png deleted file mode 100644 index 58aeed8c6d5..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MainPreview.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_01.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_01.png deleted file mode 100644 index 592e811dcc9..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_01.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_02.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_02.png deleted file mode 100644 index 04fc3b16446..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_02.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_03.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_03.png deleted file mode 100644 index db0ba8f5099..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_03.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_04.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_04.png deleted file mode 100644 index bf11c53a696..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_04.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_05.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_05.png deleted file mode 100644 index 4aa103b2bca..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_05.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_06.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_06.png deleted file mode 100644 index 02105363417..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_06.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_07.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_07.png deleted file mode 100644 index ebe636f976e..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_07.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_08.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_08.png deleted file mode 100644 index b3029961798..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_08.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_09.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_09.png deleted file mode 100644 index 6b595db6f84..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_09.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_10.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_10.png deleted file mode 100644 index 4a5591fd796..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_10.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_11.png b/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_11.png deleted file mode 100644 index 720ce333461..00000000000 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/MyFirstShaderGraph_11.png and /dev/null differ diff --git a/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png b/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png index 2f1479a1849..c505be42269 100644 Binary files a/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png and b/Packages/com.unity.shadergraph/Documentation~/images/ShaderGraphWindow.png differ diff --git a/Packages/com.unity.shadergraph/Documentation~/ui-reference.md b/Packages/com.unity.shadergraph/Documentation~/ui-reference.md index 4abf26114eb..00e36e1dac8 100644 --- a/Packages/com.unity.shadergraph/Documentation~/ui-reference.md +++ b/Packages/com.unity.shadergraph/Documentation~/ui-reference.md @@ -5,14 +5,11 @@ Explore the main user interface elements you need to know to create and configur | Topic | Description | | :--- | :--- | | [Shader Graph template browser](template-browser.md) | Browse the list of available templates to create your shader graphs from. | -| [Shader Graph Window](Shader-Graph-Window.md) | Display and edit your shader graph assets in Unity, including the Blackboard, the Main Preview, and the Graph Inspector. | -| [Create Node Menu](Create-Node-Menu.md) | Create nodes in your graph and create block nodes in the Master Stack. | -| [Graph Settings Tab](Graph-Settings-Tab.md) | Change settings that affect your shader graph as a whole. | -| [Master Stack](Master-Stack.md) | Explore the end point of a shader graph, which defines the final surface appearance of a shader. | +| [Shader Graph Window](Shader-Graph-Window.md) | Display and edit your shader graph assets in Unity, including the [Master Stack](Master-Stack.md), the [Main Preview](Main-Preview.md), the [Blackboard](Blackboard.md), and the [Graph Inspector](Internal-Inspector.md). | | [Shader Graph Preferences](Shader-Graph-Preferences.md) | Define shader graph settings for your system. | | [Shader Graph Project Settings](Shader-Graph-Project-Settings.md) | Define shader graph settings for your entire project. | | [Shader Graph Keyboard Shortcuts](Keyboard-shortcuts.md) | Use keyboard shortcuts to work more efficiently when you're using Shader Graph. | ## Additional resources -* [Node Library](Node-Library.md) \ No newline at end of file +* [Node Library](Node-Library.md) diff --git a/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs b/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs index 3537a87b587..4c654ea1e87 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Graphs/VirtualTextureShaderProperty.cs @@ -207,9 +207,10 @@ internal void AddTextureInfo(List infos) var textureInfo = new PropertyCollector.TextureInfo { name = layerRefName, - textureId = texture != null ? texture.GetInstanceID() : 0, + textureId = texture != null ? texture.GetEntityId() : EntityId.None, dimension = texture != null ? texture.dimension : UnityEngine.Rendering.TextureDimension.Any, - modifiable = true + modifiable = true, + generatePropertyBlock = generatePropertyBlock }; infos.Add(textureInfo); } diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs index 709bb00d708..2d8e4e4b3ef 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultBitmapTextNode.cs @@ -35,7 +35,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("float4 {0} = float4(1, 1, 0, 1);", outputVarName); - sb.AppendLine("[branch] if (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeBitmapText)"); + sb.AppendLine("[branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (!(GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0)))"); using (sb.BlockScope()) { bool hasTint = GetInputNodeFromSlot(k_InputSlotIdTint) != null; @@ -43,6 +43,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.tint = {0};", hasTint ? GetSlotValue(k_InputSlotIdTint, generationMode) : "IN.color"); sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.textureSlot = IN.typeTexSettings.y;"); sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.uv = IN.uvClip.xy;"); + sb.AppendLine("Unity_UIE_EvaluateBitmapNode_Input.opacity = IN.typeTexSettings.z;"); sb.AppendLine("CommonFragOutput Unity_UIE_EvaluateBitmapNode_Output = uie_std_frag_bitmap_text(Unity_UIE_EvaluateBitmapNode_Input);"); sb.AppendLine("{0}.rgb = Unity_UIE_EvaluateBitmapNode_Output.color.rgb;", outputVarName); // To correctly apply the opacity we have to multiply the alpha values by the input color's alpha if input color is not used as the tint diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs index b4665271ab9..8791c282b74 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/DefaultSDFTextNode.cs @@ -35,7 +35,7 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("float4 {0} = float4(1, 1, 0, 1);", outputVarName); - sb.AppendLine("[branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeSdfText)"); + sb.AppendLine("[branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0))"); using (sb.BlockScope()) { bool hasTint = GetInputNodeFromSlot(k_InputSlotIdTint) != null; diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs index 6c2cffbc114..4d35f17f2fb 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeBranchNode.cs @@ -95,45 +95,50 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); } } - sb.AppendLine("else [branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && TestType(IN.typeTexSettings.x, k_FragTypeSdfText))"); + sb.AppendLine("else [branch] if ((_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && TestType(IN.typeTexSettings.x, k_FragTypeText))"); using (sb.BlockScope()) { - if (GetInputNodeFromSlot(k_InputSlotIdSdfText) != null) + sb.AppendLine("[branch] if (GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0)"); + using (sb.BlockScope()) { - sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdSdfText, generationMode)); - sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdSdfText, generationMode)); + if (GetInputNodeFromSlot(k_InputSlotIdSdfText) != null) + { + sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdSdfText, generationMode)); + sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdSdfText, generationMode)); + } + else + { + sb.AppendLine("SdfTextFragInput Unity_UIE_RenderTypeSwitchNode_SdfText_Input;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.tint = IN.color;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textureSlot = IN.typeTexSettings.y;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.uv = IN.uvClip.xy;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.extraDilate = IN.circle.x;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textCoreLoc = round(IN.textCoreLoc);"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.opacity = IN.typeTexSettings.z;"); + sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_sdf_text(Unity_UIE_RenderTypeSwitchNode_SdfText_Input);"); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); + } } - else + sb.AppendLine("else"); + using (sb.BlockScope()) { - sb.AppendLine("SdfTextFragInput Unity_UIE_RenderTypeSwitchNode_SdfText_Input;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.tint = IN.color;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textureSlot = IN.typeTexSettings.y;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.uv = IN.uvClip.xy;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.extraDilate = IN.circle.x;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.textCoreLoc = round(IN.textCoreLoc);"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_SdfText_Input.opacity = IN.typeTexSettings.z;"); - sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_sdf_text(Unity_UIE_RenderTypeSwitchNode_SdfText_Input);"); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); - } - } - sb.AppendLine("else [branch] if (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY && TestType(IN.typeTexSettings.x, k_FragTypeBitmapText))"); - using (sb.BlockScope()) - { - if (GetInputNodeFromSlot(k_InputSlotIdBitmapText) != null) - { - sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); - sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); - } - else - { - sb.AppendLine("BitmapTextFragInput Unity_UIE_RenderTypeSwitchNode_BitmapText_Input;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.tint = IN.color;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.textureSlot = IN.typeTexSettings.y;"); - sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.uv = IN.uvClip.xy;"); - sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_bitmap_text(Unity_UIE_RenderTypeSwitchNode_BitmapText_Input);"); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); - sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); + if (GetInputNodeFromSlot(k_InputSlotIdBitmapText) != null) + { + sb.AppendLine("{0} = {1}.rgb;", outputVarNameColor, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); + sb.AppendLine("{0} = {1}.a;", outputVarNameAlpha, GetSlotValue(k_InputSlotIdBitmapText, generationMode)); + } + else + { + sb.AppendLine("BitmapTextFragInput Unity_UIE_RenderTypeSwitchNode_BitmapText_Input;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.tint = IN.color;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.textureSlot = IN.typeTexSettings.y;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.uv = IN.uvClip.xy;"); + sb.AppendLine("Unity_UIE_RenderTypeSwitchNode_BitmapText_Input.opacity = IN.typeTexSettings.z;"); + sb.AppendLine("CommonFragOutput Unity_UIE_RenderTypeSwitchNode_Output = uie_std_frag_bitmap_text(Unity_UIE_RenderTypeSwitchNode_BitmapText_Input);"); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.rgb;", outputVarNameColor); + sb.AppendLine("{0} = Unity_UIE_RenderTypeSwitchNode_Output.color.a;", outputVarNameAlpha); + } } } sb.AppendLine("else"); // k_FragTypeSvgGradient diff --git a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs index 965f96a56b4..3aaed5f3bcf 100644 --- a/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs +++ b/Packages/com.unity.shadergraph/Editor/Data/Nodes/UI/RenderTypeNode.cs @@ -41,8 +41,8 @@ public void GenerateNodeCode(ShaderStringBuilder sb, GenerationMode generationMo { sb.AppendLine("bool {0} = _UIE_RENDER_TYPE_SOLID || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeSolid;", GetVariableNameForSlot(k_OutputSlotIdSolid)); sb.AppendLine("bool {0} = _UIE_RENDER_TYPE_TEXTURE || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeTexture;", GetVariableNameForSlot(k_OutputSlotIdTexture)); - sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeSdfText;", GetVariableNameForSlot(k_OutputSlotIdSDFText)); - sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeBitmapText;", GetVariableNameForSlot(k_OutputSlotIdBitmapText)); + sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0);", GetVariableNameForSlot(k_OutputSlotIdSDFText)); + sb.AppendLine("bool {0} = (_UIE_RENDER_TYPE_TEXT || _UIE_RENDER_TYPE_ANY) && round(IN.typeTexSettings.x) == k_FragTypeText && (!(GetTextureInfo(IN.typeTexSettings.y).sdfScale > 0.0));", GetVariableNameForSlot(k_OutputSlotIdBitmapText)); sb.AppendLine("bool {0} = _UIE_RENDER_TYPE_GRADIENT || _UIE_RENDER_TYPE_ANY && round(IN.typeTexSettings.x) == k_FragTypeSvgGradient;", GetVariableNameForSlot(k_OutputSlotIdGradient)); } diff --git a/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs b/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs index 464f339083a..5528667d9c6 100644 --- a/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs +++ b/Packages/com.unity.shadergraph/Editor/Drawing/PreviewManager.cs @@ -102,7 +102,7 @@ void SetupUITKPanelSettings() m_PreviewElement.style.bottom = 16; root.Add(m_PreviewElement); m_PreviewShadedElement = m_PreviewElement.Q("shader"); - UIElementsUtility.RegisterCachedPanel(m_PreviewPanelSettings.GetInstanceID(), m_PreviewPanelSettings.panel); + UIElementsUtility.RegisterCachedPanel(m_PreviewPanelSettings.GetEntityId(), m_PreviewPanelSettings.panel); SetupUITKFonts(); } @@ -1517,7 +1517,7 @@ public void Dispose() if (m_PreviewPanelSettings != null) { - UIElementsUtility.RemoveCachedPanel(m_PreviewPanelSettings.GetInstanceID()); + UIElementsUtility.RemoveCachedPanel(m_PreviewPanelSettings.GetEntityId()); Object.DestroyImmediate(m_PreviewPanelSettings); m_PreviewPanelSettings = null; } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs b/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs index c4b63e3be8f..d0a96c4089e 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs @@ -15,6 +15,7 @@ public struct TextureInfo public EntityId textureId; public TextureDimension dimension; public bool modifiable; + public bool generatePropertyBlock; } bool m_ReadOnly; @@ -268,7 +269,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.texture != null ? prop.value.texture.GetEntityId() : EntityId.None, dimension = TextureDimension.Tex2D, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } @@ -283,7 +285,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.textureArray != null ? prop.value.textureArray.GetEntityId() : EntityId.None, dimension = TextureDimension.Tex2DArray, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } @@ -298,7 +301,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.texture != null ? prop.value.texture.GetEntityId() : EntityId.None, dimension = TextureDimension.Tex3D, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } @@ -313,7 +317,8 @@ public List GetConfiguredTextures() name = prop.referenceName, textureId = prop.value.cubemap != null ? prop.value.cubemap.GetEntityId() : EntityId.None, dimension = TextureDimension.Cube, - modifiable = prop.modifiable + modifiable = prop.modifiable, + generatePropertyBlock = prop.generatePropertyBlock }; result.Add(textureInfo); } diff --git a/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs b/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs index b5eb5949896..6f348d985cd 100644 --- a/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs +++ b/Packages/com.unity.shadergraph/Editor/Generation/ShaderGraphVfxAsset.cs @@ -95,7 +95,7 @@ internal ConcretePrecision concretePrecision internal void SetTextureInfos(IList textures) { - m_TextureInfos = textures.Select(t => new TextureInfo(t.name, EditorUtility.EntityIdToObject(t.textureId) as Texture, t.dimension)).ToArray(); + m_TextureInfos = textures.Where(t => t.generatePropertyBlock).Select(t => new TextureInfo(t.name, EditorUtility.EntityIdToObject(t.textureId) as Texture, t.dimension)).ToArray(); } internal void SetOutputs(OutputMetadata[] outputs) diff --git a/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphImporterEditor.cs b/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphImporterEditor.cs index 2ed7fe41729..e85cc0ce175 100644 --- a/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphImporterEditor.cs +++ b/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphImporterEditor.cs @@ -64,7 +64,7 @@ GraphData GetGraphData(AssetImporter importer) ShowGraphEditWindow(importer.assetPath); } - using (var horizontalScope = new GUILayout.HorizontalScope("box")) + using (var horizontalScope = new GUILayout.HorizontalScope()) { AssetImporter importer = target as AssetImporter; string assetName = Path.GetFileNameWithoutExtension(importer.assetPath); diff --git a/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs b/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs index dcd8c508c17..0ad2212d83f 100644 --- a/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs +++ b/Packages/com.unity.shadergraph/Editor/Importers/ShaderGraphTemplateHelper.cs @@ -34,6 +34,8 @@ public string OpenSaveFileDialog() public GraphViewTemplateWindow.ISaveFileDialogHelper saveFileDialogHelper { get; set; } = new SaveFileDialog(); + public void RaiseImportSampleDependencies(PackageManager.PackageInfo packageInfo, PackageManager.UI.Sample sample) { } + public void RaiseTemplateUsed(GraphViewTemplateDescriptor usedTemplate) => ShaderGraphAnalytics.SendShaderGraphTemplateEvent(usedTemplate); diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/GraphLogicAndPhilosophy.md b/Packages/com.unity.visualeffectgraph/Documentation~/GraphLogicAndPhilosophy.md index 359448c9c88..0db9c7ac30d 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/GraphLogicAndPhilosophy.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/GraphLogicAndPhilosophy.md @@ -89,8 +89,12 @@ If you change the value of a setting, you need to recompile the Graph to see the ### Groups -You can group Nodes together to organize your graphs. You can drag grouped Nodes around together and even give them a title to describe what the group does. To add a Group, select multiple Nodes, right-click, and select **Group Selection**. +You can group Nodes and Sticky Notes together to organize your graphs. You can drag Groups around together and even give them a title to describe what the Group does. + +* To create an empty Group, right-click anywhere in the workspace and select **Create Group Node**. + +* To group multiple items, select all the targeted items, right-click on one of them, and select **Group Selection**. ### Sticky Notes -Sticky Notes are draggable comment elements you can add to leave explanations or reminders for co-workers or yourself. +Sticky Notes are draggable comment elements you can add to leave explanations or reminders for co-workers or yourself. For more details, refer to [Sticky Notes](StickyNotes.md). diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/StickyNotes.md b/Packages/com.unity.visualeffectgraph/Documentation~/StickyNotes.md index b354091c749..32926ec02e3 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/StickyNotes.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/StickyNotes.md @@ -29,18 +29,18 @@ You can also resize Sticky Notes. You can resize the Sticky Note manually or the #### Duplicating -You can also cut, copy, paste, and duplicate Sticky Notes. For information on how to perform these actions, see [duplicating elements](VisualEffectGraphWindow.md#copy-cut-and-paste-and-duplicate-elements). +You can cut, copy, paste, and duplicate Sticky Notes. For information on how to perform these actions, refer to [Duplicating elements](VisualEffectGraphWindow.md#copy-cut-and-paste-and-duplicate-elements). -#### Context menu +#### Grouping -To open the context menu for the Sticky Note, right-click anywhere on the Sticky Note. The options in the context menu are as follows. +You can group Sticky Notes with Nodes and other Sticky Notes within the graph. For more information about Group management, refer to [Groups](GraphLogicAndPhilosophy.md#groups). -| **Option** | **Description** | -| -------------------------- | ------------------------------------------------------------ | -| **Dark Theme/Light Theme** | Toggles the color theme of the Sticky Note between light theme and dark theme. | -| **Text Size** | Resizes the font in the text areas to the following values: | -| Small | Title: 20
Body: 11 | -| Medium | Title: 40
Body: 24 | -| Large | Title: 60
Body: 36 | -| Huge | Title: 80
Body: 56 | -| **Fit To Text** | Resizes the Sticky Note so that it precisely fits the text areas.
**Note**: If your title spreads over more than a single line, this horizontally resizes the Sticky Note to the smallest size where the title text fits on a single line. | +#### Option menu + +When you select a Sticky Note, a menu appears above it, with the following options: + +| **Option** | **Description** | +| :--- | :--- | +| **Colors** | Changes the color theme of the Sticky Note: yellow (default), blue, or red. | +| **Font Size** | Resizes the text of the Sticky Note's title and body. The options are:
  • **Small**: Sets the title to 20pt and the body to 11pt.
  • **Medium**: Sets the title to 40pt and the body to 24pt.
  • **Large**: Sets the title to 60pt and the body to 36pt.
  • **Huge**: Sets the title to 80pt and the body to 56pt.
| +| **Adjust to the note's content** | Resizes the Sticky Note so that it precisely fits the text areas.
**Note**: If your title spreads over more than a single line, this horizontally resizes the Sticky Note to the minimum size needed to fit the title text onto a single line. | diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md index bb93a54f5ce..802734e35e1 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/TableOfContents.md @@ -58,10 +58,10 @@ * [Spawner Callbacks](SpawnerCallbacks.md) * [Realistic smoke lighting](six-way-lighting-landing.md) * [Realistic smoke lighting with six-way lighting](six-way-lighting.md) - * [Use tools to generate six-way lightmap textures](use-tools-generate-six-way-lightmap-textures.md) + * [Generate six-way lightmap textures for visual effects](use-tools-generate-six-way-lightmap-textures.md) * [Import six-way lightmap textures into unity](import-six-way-lightmap-textures-unity.md) - * [Create and configure a six-way lit particle system](create-configure-six-way-lit-particle-system.md) - * [Customize free six-way lighting lightmap textures](create-effects-with-six-way-lighting.md) + * [Create a six-way lit particle system in Visual Effect Graph](create-configure-six-way-lit-particle-system.md) + * [Customize existing six-way lightmap textures](create-effects-with-six-way-lighting.md) * [Six-way smoke lit reference](six-way-lighting-reference.md) * [Node Library](node-library.md) * [Context](Context.md) @@ -97,7 +97,7 @@ * [Collision Depth Buffer](Block-CollideWithDepthBuffer.md) * [Kill Shape](Block-KillShape.md) * [Trigger Shape](Block-TriggerShape.md) - * [Flipbook Player](Block-FlipbookPlayer.md) + * [Flipbook Player](Block-FlipbookPlayer.md) * [Force](Force.md) * [Attractor Shape Signed Distance Field](Block-ConformToSignedDistanceField.md) * [Attractor Shape Sphere](Block-ConformToSphere.md) diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md b/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md index 897f48c345f..e1b719d9fd1 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/sg-working-with.md @@ -94,7 +94,7 @@ Shader Graph does not support some features in specific Targets. - [Fog Volume Shader Graph](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/fog-volume-master-stack-reference.html) - [Motion vectors](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@latest?subfolder=/manual/Motion-Vectors.html) for vertex animation. - The URP does not support the following: - - [Decal Shader Graph](https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@latest?subfolder=/manual/decal-shader.html. + - [Decal Shader Graph](https://docs.unity3d.com/Documentation/Manual/urp/prebuilt-shader-graphs-urp-decal.html) - The Visual Effect Target (deprecated) does not support: - HDRP or Universal material types. - Access to the shader's Vertex stage. diff --git a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md index 99e733cb2d4..9cba768bb52 100644 --- a/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md +++ b/Packages/com.unity.visualeffectgraph/Documentation~/six-way-lighting-landing.md @@ -5,10 +5,11 @@ Implement custom lighting models to have more control over the visual style of s | Page | Description | |-------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------| | [Realistic smoke lighting with six-way lighting]( six-way-lighting.md) | Learn how and why to use six-way lighting in Unity to illuminate smoke. | -| [Use tools to generate six-way lightmap textures](use-tools-generate-six-way-lightmap-textures.md) | Learn how to create six-way lightmap textures in your preferred VFX tool for use in Unity. | +| [Generate six-way lightmap textures for visual effects](use-tools-generate-six-way-lightmap-textures.md) | Learn how to create six-way lightmap textures in your preferred VFX tool for use in Unity. | | [Import six-way lightmap textures into Unity](import-six-way-lightmap-textures-unity.md) | Learn how to import and configure six-way lightmap textures for use in Visual Effect Graph. | -| [Create and configure a six-way lit particle system](create-configure-six-way-lit-particle-system.md) | Learn how to achieve enhanced realism for smoke or explosion effects. | -| [Customize free six-way lighting lightmap textures](create-effects-with-six-way-lighting.md) | Learn how to generate high-quality smoke or dust effects with free lightmap textures. | +| [Create a six-way lit particle system in Visual Effect Graph](create-configure-six-way-lit-particle-system.md) | Learn how to achieve enhanced realism for smoke or explosion effects. | +| [Customize existing six-way lightmap textures](create-effects-with-six-way-lighting.md) | Learn how to generate high-quality smoke or dust effects with free lightmap textures. | +| [Six-way smoke lit reference](six-way-lighting-reference.md) | Explore the properties of the **Smoke Shader UI**.| ## Additional resources diff --git a/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs b/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs index 5f419eab265..852546742da 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Core/VFXConverter.cs @@ -192,7 +192,7 @@ public static object ConvertTo(object value, Type type) { if (value == null) return null; - if (value is UnityObject obj && obj == null && obj.GetInstanceID() != 0) + if (value is UnityObject obj && obj == null && obj.GetEntityId() != EntityId.None) return obj; if (type == typeof(GraphicsBuffer)) return null; diff --git a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs index 3a20442301c..ae59a71cf0b 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/FilterPopup/VFXFilterWindow.cs @@ -1020,7 +1020,9 @@ private float GetTextMatchScore(string text, ref string pattern, string[] patter matchHighlight = text; foreach (var match in s_PatternMatches) { - matchHighlight = matchHighlight.Replace(match, $"#@{match}#", StringComparison.OrdinalIgnoreCase); + int index = matchHighlight.IndexOf(match, StringComparison.InvariantCultureIgnoreCase); + matchHighlight = matchHighlight.Insert(index, "#@"); + matchHighlight = matchHighlight.Insert(index + 2 + match.Length, "#"); } return score / text.Length; diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs index a40a35d9431..a325de77c99 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboard.cs @@ -147,6 +147,7 @@ enum ViewMode const string PropertiesCategoryTitle = "Properties"; const string BuiltInAttributesCategoryTitle = "Built-in Attributes"; const string AttributesCategoryTitle = "Attributes"; + const uint MaximumAttemptsToScrollToSelection = 10; static readonly Rect defaultRect = new Rect(100, 100, 300, 500); static System.Reflection.PropertyInfo s_LayoutManual = typeof(VisualElement).GetProperty("isLayoutManual", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); @@ -1393,17 +1394,10 @@ public void Update(bool force = false) m_Treeview.RefreshItems(); UpdateSubtitle(); SynchronizeExpandState(); - if (m_pendingSelectionItems.Count > 0) + if (m_Treeview.selectedItem != null) { - var lastItemToSelect = m_ParametersController.SelectMany(GetDataRecursive).LastOrDefault(x => m_pendingSelectionItems.Contains(x.data.title)); - if (lastItemToSelect.data != null) - { - m_Treeview.ScrollToItemById(lastItemToSelect.id); - } - else - { - m_pendingSelectionItems.Clear(); - } + EditorApplication.delayCall += () => ScrollToSelection(); + m_pendingSelectionItems.Clear(); } } finally @@ -1412,6 +1406,30 @@ public void Update(bool force = false) } } + /// + /// Scroll to selection and check on next frame if it has properly scrolled. + /// If not try again, but there's a maximum retry attempts to avoid infinite loop + /// + private void ScrollToSelection(uint iteration = 0) + { + if (iteration >= MaximumAttemptsToScrollToSelection) + return; + + m_Treeview.ScrollToItem(m_Treeview.selectedIndex); + EditorApplication.delayCall += () => + { + var element = m_Treeview.GetRootElementForIndex(m_Treeview.selectedIndex); + if (element == null) + { + ScrollToSelection(iteration + 1); + } + else if (!m_Treeview.Q().worldBound.Overlaps(element.worldBound)) + { + ScrollToSelection(iteration + 1); + } + }; + } + private int SortCategory(string category, List parameters) { switch (category) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs index 3fcdf939e3f..472a0736018 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Blackboard/VFXBlackboardPropertyView.cs @@ -289,6 +289,7 @@ public void SelfChange(int change) } else { + TryUnregisterSubproperties(false); m_Property = null; m_ExposedProperty = null; m_SubProperties = null; @@ -313,15 +314,7 @@ public void SelfChange(int change) private void RecreateSubproperties(ref int insertIndex) { - if (m_SubProperties != null) - { - foreach (var subProperty in m_SubProperties) - { - (subProperty.provider as Controller).UnregisterHandler(this); - subProperty.RemoveFromHierarchy(); - } - } - else + if (!TryUnregisterSubproperties(true)) { m_SubProperties = new List(); } @@ -333,6 +326,23 @@ private void RecreateSubproperties(ref int insertIndex) } } + bool TryUnregisterSubproperties(bool removeFromHierarchy) + { + if (m_SubProperties != null) + { + foreach (var subProperty in m_SubProperties) + { + (subProperty.provider as Controller).UnregisterHandler(this); + if (removeFromHierarchy) + subProperty.RemoveFromHierarchy(); + } + + return true; + } + + return false; + } + void OnAttachToPanel(AttachToPanelEvent e) { RegisterCallback(OnGeometryChanged); diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs index fc89979f8f0..b1bfcd6f3c0 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXNodeController.cs @@ -221,6 +221,28 @@ public virtual void OnEdgeFromOutputGoingToBeRemoved(VFXDataAnchorController myO public virtual void WillCreateLink(ref VFXSlot myInput, ref VFXSlot otherOutput, bool revertTypeConstraint = false) { + CheckWillCreateCycle(myInput, otherOutput); + } + + private void CheckWillCreateCycle(VFXSlot input, VFXSlot output) + { + // Break cycles only for GPU events + VFXBasicGPUEvent gpuEvent = null; + VFXBlock triggerBlock = null; + if (output.owner is VFXBasicGPUEvent) + { + gpuEvent = input.owner as VFXBasicGPUEvent; + triggerBlock = input.owner as VFXBlock; + } + else if (input.owner is VFXBasicGPUEvent) + { + gpuEvent = input.owner as VFXBasicGPUEvent; + triggerBlock = output.owner as VFXBlock; + } + if (gpuEvent != null && triggerBlock != null) + { + VFXContext.BreakCyclesHorizontal(triggerBlock.GetParent(), gpuEvent, true); // always notify + } } protected virtual bool UpdateSlots(List newAnchors, IEnumerable slotList, bool expanded, bool input) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs index 52f94a45eee..01eeca28942 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/Controllers/VFXParameterController.cs @@ -672,51 +672,53 @@ public VFXValueFilter valueFilter static float RangeToFloat(object value) { - if (value != null) - { - if (value.GetType() == typeof(float)) - { - return (float)value; - } - else if (value.GetType() == typeof(int)) - { - return (float)(int)value; - } - else if (value.GetType() == typeof(uint)) - { - return (float)(uint)value; - } - } - return 0.0f; + if (value is float f) + return f; + if (value is int i) + return i; + if (value is uint u) + return u; + return 0f; } public object minValue { - get { return model.min; } + get => model.min; set { if (value != null) { - model.min = value; - if (RangeToFloat(this.value) < RangeToFloat(value)) + var floatValue = RangeToFloat(value); + var maxFloatValue = RangeToFloat(maxValue); + if (floatValue < maxFloatValue || this.model.min == null) { - this.value = value; + model.min = value; + if (RangeToFloat(this.value) < floatValue) + { + this.value = value; + } } + model.Invalidate(VFXModel.InvalidationCause.kParamChanged); } } } public object maxValue { - get { return model.max; } + get => model.max; set { if (value != null) { - model.max = value; - if (RangeToFloat(this.value) > RangeToFloat(value)) + var floatValue = RangeToFloat(value); + var minFloatValue = RangeToFloat(minValue); + if (floatValue > minFloatValue) { - this.value = value; + model.max = value; + if (RangeToFloat(this.value) > floatValue || this.model.max == null) + { + this.value = value; + } } model.Invalidate(VFXModel.InvalidationCause.kParamChanged); @@ -740,11 +742,12 @@ public object value if (valueFilter == VFXValueFilter.Range) { - if (RangeToFloat(value) < RangeToFloat(minValue)) + var floatValue = RangeToFloat(value); + if (floatValue < RangeToFloat(minValue)) { value = minValue; } - if (RangeToFloat(value) > RangeToFloat(maxValue)) + if (floatValue > RangeToFloat(maxValue)) { value = maxValue; } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs index f37fe2c98e5..ab9a5e8cd48 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Elements/VFXNodeUI.cs @@ -85,7 +85,7 @@ public VFXNodeController controller protected virtual void OnNewController() { if (controller != null) - viewDataKey = $"NodeID-{controller.model.GetInstanceID()}"; + viewDataKey = $"NodeID-{controller.model.GetEntityId()}"; } public void OnSelectionMouseDown(MouseDownEvent e) diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs index 75c801a5368..683a9f36314 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/VFXComponentBoard.cs @@ -861,11 +861,8 @@ void OnSend() } } - [System.Obsolete("VFXComponentBoardBoundsSystemUIFactory is deprecated and will be removed. Use UxmlElementAttribute instead.", false)] - class VFXComponentBoardBoundsSystemUIFactory : UxmlFactory - { } - - class VFXComponentBoardBoundsSystemUI : VisualElement + [UxmlElement] + partial class VFXComponentBoardBoundsSystemUI : VisualElement { public void Setup(VFXView vfxView, string systemName, VFXBoundsRecorder boundsRecorder) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs index 4eb39adf348..722db581de8 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/Controller/VFXViewController.cs @@ -1557,6 +1557,9 @@ public void ForceReload() Clear(); ModelChanged(model); GraphChanged(); + + var window = VFXViewWindow.GetWindow(this.graph, false, false); + window?.graphView?.blackboard.Update(true); } bool m_Syncing; @@ -1749,6 +1752,15 @@ public void SetCategoryExpanded(string categoryName, bool expanded) } } + private void ReorderParameters() + { + var index = 0; + foreach (var parameter in m_ParameterControllers.OrderBy(x => x.Value.order)) + { + parameter.Value.order = index++; + } + } + private void AddControllersFromModel(VFXModel model) { List newControllers = new List(); @@ -1815,7 +1827,8 @@ private void AddControllersFromModel(VFXModel model) parameter.ValidateNodes(); - m_ParameterControllers[parameter] = new VFXParameterController(parameter, this); + var newParameterController = new VFXParameterController(parameter, this) { order = m_ParameterControllers.Count }; + m_ParameterControllers[parameter] = newParameterController; m_SyncedModels[model] = new List(); } @@ -1856,10 +1869,11 @@ private void RemoveControllersFromModel(VFXModel model) } m_SyncedModels.Remove(model); } - if (model is VFXParameter) + if (model is VFXParameter parameter) { - m_ParameterControllers[model as VFXParameter].OnDisable(); - m_ParameterControllers.Remove(model as VFXParameter); + m_ParameterControllers[parameter].OnDisable(); + m_ParameterControllers.Remove(parameter); + ReorderParameters(); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs index a1656eaec32..8dfa49c2f7a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopy.cs @@ -270,9 +270,10 @@ Parameter CreateParameter(VFXParameter parameter, ParameterNode[] nodes) { return new Parameter { - originalInstanceID = parameter.GetInstanceID(), + originalInstanceID = parameter.GetEntityId(), name = parameter.exposedName, category = parameter.category, + order = parameter.order, value = new VFXSerializableObject(parameter.type, parameter.value), exposed = parameter.exposed, isOutput = parameter.isOutput, diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs index 7fd5894e1ec..70635318659 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXCopyPasteCommon.cs @@ -135,6 +135,7 @@ protected struct Parameter public int originalInstanceID; public string name; public string category; + public int order; public VFXSerializableObject value; public bool exposed; public VFXValueFilter valueFilter; diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs index ae66df92b3e..31c53e4163d 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXHelpDropdownButton.cs @@ -53,21 +53,27 @@ protected override void OnMainButton() void InstallSample(string sampleName) { - var sample = Sample.FindByPackage(VisualEffectGraphPackageInfo.name, null).SingleOrDefault(x => x.displayName == sampleName); + var searchResult = Sample.FindByPackage(VisualEffectGraphPackageInfo.name, null); + var sample = searchResult.SingleOrDefault(x => x.displayName == sampleName); if (!string.IsNullOrEmpty(sample.displayName)) { - if (!sample.isImported) - { - sample.Import(); - } - else + var importMode = Sample.ImportOptions.None; + if (sample.isImported) { var reinstall = EditorUtility.DisplayDialog("Warning", "This sample package is already installed.\nDo you want to reinstall it?", "Yes", "No"); if (reinstall) { - sample.Import(Sample.ImportOptions.OverridePreviousImports); + importMode = Sample.ImportOptions.OverridePreviousImports; + } + else + { + return; } } + + var packageInfo = PackageManager.PackageInfo.FindForAssetPath(VisualEffectGraphPackageInfo.assetPackagePath); + VFXTemplateHelperInternal.ImportSampleDependencies(packageInfo, sample); + sample.Import(importMode); } else { diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs index 6f99bfb9ee8..a73b9b6e283 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXPaste.cs @@ -824,7 +824,7 @@ private void PasteParameters(VFXViewController viewController, SerializableGraph foreach (var parameter in serializableGraph.parameterNodes) { // if we have a parameter with the same name use it else create it with the copied data - VFXParameter p = viewController.graph.children.OfType().FirstOrDefault(t => t.GetInstanceID() == parameter.originalInstanceID); + VFXParameter p = viewController.graph.children.OfType().FirstOrDefault(t => t.GetEntityId() == parameter.originalInstanceID); if (p == null) { Type type = parameter.value.type; @@ -891,6 +891,9 @@ private void PasteParameters(VFXViewController viewController, SerializableGraph var groupChanged = false; viewController.SyncControllerFromModel(ref groupChanged); + var newVfxParameterController = viewController.GetParameterController(newVfxParameter); + var sourceVFXParameterController = viewController.parameterControllers.Single(x => string.Compare(x.exposedName, parameter.name, StringComparison.InvariantCultureIgnoreCase) == 0); + viewController.SetParametersOrder(newVfxParameterController, sourceVFXParameterController.order + 1); newBlackboardItems.Add(newVfxParameter.exposedName); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs index ceb9fa87a97..f1c80cc3e3b 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/GraphView/Views/VFXView.cs @@ -2752,6 +2752,7 @@ void InsertFromTemplate(string templatePath, string assetPath) public void AddStickyNote(Vector2 position) { var group = selection.OfType().FirstOrDefault(); + group ??= GetPickedGroupNode(position); position = contentViewContainer.WorldToLocal(position); controller.AddStickyNote(position, group?.controller); } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs index 9d5173a1971..ce739a198ad 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VFXAssetEditor.cs @@ -166,6 +166,11 @@ public static bool OnOpenVFX(EntityId entityId, int line) ReorderableList m_ReorderableList; List m_OutputContexts = new List(); VFXGraph m_CurrentGraph; + bool showUpdateModeCategory = true; + bool showInitialStateCategory = true; + bool showInstancingCategory = true; + bool showShadersCategory = true; + bool showOutputOrderCategory = true; void OnReorder(ReorderableList list) { @@ -174,7 +179,7 @@ void OnReorder(ReorderableList list) m_OutputContexts[i].vfxSystemSortPriority = i; } - if (VFXViewWindow.GetAllWindows().All(x => x.graphView?.controller?.graph.visualEffectResource.GetInstanceID() != m_CurrentGraph.visualEffectResource.GetInstanceID() || !x.hasFocus)) + if (VFXViewWindow.GetAllWindows().All(x => x.graphView?.controller?.graph.visualEffectResource.GetEntityId() != m_CurrentGraph.visualEffectResource.GetEntityId() || !x.hasFocus)) { // Do we need a compileReporter here? AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(m_CurrentGraph.visualEffectResource)); @@ -194,11 +199,6 @@ private void DrawOutputContextItem(Rect rect, int index, bool isActive, bool isF EditorGUI.LabelField(rect, EditorGUIUtility.TempContent(fullName)); } - private void DrawHeader(Rect rect) - { - EditorGUI.LabelField(rect, EditorGUIUtility.TrTextContent("Output Render Order")); - } - static Mesh s_CubeWireFrame; void OnEnable() { @@ -221,12 +221,9 @@ void OnEnable() }; } - m_ReorderableList = new ReorderableList(m_OutputContexts, typeof(IVFXSubRenderer)); - m_ReorderableList.displayRemove = false; - m_ReorderableList.displayAdd = false; + m_ReorderableList = new ReorderableList(m_OutputContexts, typeof(IVFXSubRenderer), true, false, false, false); + m_ReorderableList.showDefaultBackground = false; m_ReorderableList.onReorderCallback = OnReorder; - m_ReorderableList.drawHeaderCallback = DrawHeader; - m_ReorderableList.drawElementCallback = DrawOutputContextItem; var targetResources = targets.Cast().Select(t => t.GetResource()).Where(t => t != null).ToArray(); @@ -658,8 +655,9 @@ public override VisualElement CreateInspectorGUI() if (importers.Count > 0) { root.styleSheets.Add(VFXView.LoadStyleSheet("VisualEffectAssetEditor")); - var header = new Label("Template"); + var header = new Foldout { text = "Template Info" }; header.AddToClassList("inspector-header"); + header.focusable = false; root.Add(header); var allImportersSerializedObject = new SerializedObject(importers.ToArray()); @@ -684,10 +682,10 @@ public override VisualElement CreateInspectorGUI() } } }); - root.Add(useAsTemplateCheckbox); + header.Add(useAsTemplateCheckbox); var expander = new Foldout { text = "Template", style = { marginLeft = 15f } }; - root.Add(expander); + header.Add(expander); // Name field var nameTooltip = targets.Length == 1 @@ -773,121 +771,127 @@ private void OnInspectorGUIEmbedded() var processEveryFrameContent = EditorGUIUtility.TrTextContent("Exact Fixed Time", "Only relevant when using Fixed Delta Time. When enabled, several updates can be processed per frame (e.g.: if a frame is 10ms and the fixed frame rate is set to 5 ms, the effect will update twice with a 5ms deltaTime instead of once with a 10ms deltaTime). This method is expensive and should only be used for high-end scenarios."); var ignoreTimeScaleContent = EditorGUIUtility.TrTextContent("Ignore Time Scale", "When enabled, the computed visual effect delta time ignores the game Time Scale value (Play Rate is still applied)."); - EditorGUI.BeginChangeCheck(); - - VisualEffectEditor.ShowHeader(EditorGUIUtility.TrTextContent("Update mode"), false, false); - bool newFixedDeltaTime = EditorGUILayout.Toggle(deltaTimeContent, initialFixedDeltaTime ?? false); - bool newExactFixedTimeStep = false; - EditorGUI.showMixedValue = !initialProcessEveryFrame.HasValue; - EditorGUI.BeginDisabledGroup((!initialFixedDeltaTime.HasValue || !initialFixedDeltaTime.Value) && !resourceUpdateModeProperty.hasMultipleDifferentValues); - newExactFixedTimeStep = EditorGUILayout.Toggle(processEveryFrameContent, initialProcessEveryFrame ?? false); - EditorGUI.EndDisabledGroup(); - EditorGUI.showMixedValue = !initialIgnoreGameTimeScale.HasValue; - bool newIgnoreTimeScale = EditorGUILayout.Toggle(ignoreTimeScaleContent, initialIgnoreGameTimeScale ?? false); + VisualEffectAsset asset = (VisualEffectAsset)target; + VisualEffectResource resource = asset.GetResource(); - if (EditorGUI.EndChangeCheck()) + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Update mode"), showUpdateModeCategory, out showUpdateModeCategory)) { - if (!resourceUpdateModeProperty.hasMultipleDifferentValues) - { - var newUpdateMode = (VFXUpdateMode)0; - if (!newFixedDeltaTime) - newUpdateMode = newUpdateMode | VFXUpdateMode.DeltaTime; - if (newExactFixedTimeStep) - newUpdateMode = newUpdateMode | VFXUpdateMode.ExactFixedTimeStep; - if (newIgnoreTimeScale) - newUpdateMode = newUpdateMode | VFXUpdateMode.IgnoreTimeScale; - - resourceUpdateModeProperty.intValue = (int)newUpdateMode; - resourceObject.ApplyModifiedProperties(); - } - else + if (showUpdateModeCategory) { - var resourceUpdateModeProperties = resourceUpdateModeProperty.serializedObject.targetObjects.Select(o => new SerializedObject(o).FindProperty(resourceUpdateModeProperty.propertyPath)); - foreach (var property in resourceUpdateModeProperties) + EditorGUI.BeginChangeCheck(); + + bool newFixedDeltaTime = EditorGUILayout.Toggle(deltaTimeContent, initialFixedDeltaTime ?? false); + bool newExactFixedTimeStep = false; + EditorGUI.showMixedValue = !initialProcessEveryFrame.HasValue; + EditorGUI.BeginDisabledGroup((!initialFixedDeltaTime.HasValue || !initialFixedDeltaTime.Value) && !resourceUpdateModeProperty.hasMultipleDifferentValues); + newExactFixedTimeStep = EditorGUILayout.Toggle(processEveryFrameContent, initialProcessEveryFrame ?? false); + EditorGUI.EndDisabledGroup(); + EditorGUI.showMixedValue = !initialIgnoreGameTimeScale.HasValue; + bool newIgnoreTimeScale = EditorGUILayout.Toggle(ignoreTimeScaleContent, initialIgnoreGameTimeScale ?? false); + + if (EditorGUI.EndChangeCheck()) { - var updateMode = (VFXUpdateMode)property.intValue; - - if (initialFixedDeltaTime.HasValue) + if (!resourceUpdateModeProperty.hasMultipleDifferentValues) { + var newUpdateMode = (VFXUpdateMode)0; if (!newFixedDeltaTime) - updateMode = updateMode | VFXUpdateMode.DeltaTime; - else - updateMode = updateMode & ~VFXUpdateMode.DeltaTime; + newUpdateMode = newUpdateMode | VFXUpdateMode.DeltaTime; + if (newExactFixedTimeStep) + newUpdateMode = newUpdateMode | VFXUpdateMode.ExactFixedTimeStep; + if (newIgnoreTimeScale) + newUpdateMode = newUpdateMode | VFXUpdateMode.IgnoreTimeScale; + + resourceUpdateModeProperty.intValue = (int)newUpdateMode; + resourceObject.ApplyModifiedProperties(); } else { - if (newFixedDeltaTime) - updateMode = updateMode & ~VFXUpdateMode.DeltaTime; - } + var resourceUpdateModeProperties = resourceUpdateModeProperty.serializedObject.targetObjects.Select(o => new SerializedObject(o).FindProperty(resourceUpdateModeProperty.propertyPath)); + foreach (var property in resourceUpdateModeProperties) + { + var updateMode = (VFXUpdateMode)property.intValue; - if (newExactFixedTimeStep) - updateMode = updateMode | VFXUpdateMode.ExactFixedTimeStep; - else if (initialProcessEveryFrame.HasValue) - updateMode = updateMode & ~VFXUpdateMode.ExactFixedTimeStep; + if (initialFixedDeltaTime.HasValue) + { + if (!newFixedDeltaTime) + updateMode = updateMode | VFXUpdateMode.DeltaTime; + else + updateMode = updateMode & ~VFXUpdateMode.DeltaTime; + } + else + { + if (newFixedDeltaTime) + updateMode = updateMode & ~VFXUpdateMode.DeltaTime; + } - if (newIgnoreTimeScale) - updateMode = updateMode | VFXUpdateMode.IgnoreTimeScale; - else if (initialIgnoreGameTimeScale.HasValue) - updateMode = updateMode & ~VFXUpdateMode.IgnoreTimeScale; + if (newExactFixedTimeStep) + updateMode = updateMode | VFXUpdateMode.ExactFixedTimeStep; + else if (initialProcessEveryFrame.HasValue) + updateMode = updateMode & ~VFXUpdateMode.ExactFixedTimeStep; - property.intValue = (int)updateMode; - property.serializedObject.ApplyModifiedProperties(); + if (newIgnoreTimeScale) + updateMode = updateMode | VFXUpdateMode.IgnoreTimeScale; + else if (initialIgnoreGameTimeScale.HasValue) + updateMode = updateMode & ~VFXUpdateMode.IgnoreTimeScale; + + property.intValue = (int)updateMode; + property.serializedObject.ApplyModifiedProperties(); + } + } } - } - } - VisualEffectAsset asset = (VisualEffectAsset)target; - VisualEffectResource resource = asset.GetResource(); - //The following should be working, and works for newly created systems, but fails for old systems, - //due probably to incorrectly pasting the VFXData when creating them. - // bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children - // .OfType().Any(d => d.boundsMode == BoundsSettingMode.Automatic); + //The following should be working, and works for newly created systems, but fails for old systems, + //due probably to incorrectly pasting the VFXData when creating them. + // bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children + // .OfType().Any(d => d.boundsMode == BoundsSettingMode.Automatic); - bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children - .OfType() - .Select(x => x.GetData()) - .OfType() - .Any(x => x.boundsMode == BoundsSettingMode.Automatic); + bool hasAutomaticBoundsSystems = resource.GetOrCreateGraph().children + .OfType() + .Select(x => x.GetData()) + .OfType() + .Any(x => x.boundsMode == BoundsSettingMode.Automatic); - using (new EditorGUI.DisabledScope(hasAutomaticBoundsSystems)) - { - EditorGUILayout.BeginHorizontal(); - EditorGUI.showMixedValue = cullingFlagsProperty.hasMultipleDifferentValues; - string forceSimulateTooltip = hasAutomaticBoundsSystems - ? " When using systems with Bounds Mode set to Automatic, this has to be set to Always recompute bounds and simulate." - : ""; - EditorGUILayout.PrefixLabel(EditorGUIUtility.TrTextContent("Culling Flags", "Specifies how the system recomputes its bounds and simulates when off-screen." + forceSimulateTooltip)); - EditorGUI.BeginChangeCheck(); + using (new EditorGUI.DisabledScope(hasAutomaticBoundsSystems)) + { + EditorGUILayout.BeginHorizontal(); + EditorGUI.showMixedValue = cullingFlagsProperty.hasMultipleDifferentValues; + string forceSimulateTooltip = hasAutomaticBoundsSystems + ? " When using systems with Bounds Mode set to Automatic, this has to be set to Always recompute bounds and simulate." + : ""; + EditorGUI.BeginChangeCheck(); + int newOption = EditorGUILayout.Popup( + EditorGUIUtility.TrTextContent("Culling Flags", "Specifies how the system recomputes its bounds and simulates when off-screen." + forceSimulateTooltip), + Array.IndexOf(k_CullingOptionsValue, (VFXCullingFlags)cullingFlagsProperty.intValue), + k_CullingOptionsContents); + if (EditorGUI.EndChangeCheck()) + { + cullingFlagsProperty.intValue = (int)k_CullingOptionsValue[newOption]; + resourceObject.ApplyModifiedProperties(); + } + } - int newOption = - EditorGUILayout.Popup( - Array.IndexOf(k_CullingOptionsValue, (VFXCullingFlags)cullingFlagsProperty.intValue), - k_CullingOptionsContents); - if (EditorGUI.EndChangeCheck()) - { - cullingFlagsProperty.intValue = (int)k_CullingOptionsValue[newOption]; - resourceObject.ApplyModifiedProperties(); + EditorGUILayout.EndHorizontal(); } } - EditorGUILayout.EndHorizontal(); - DrawInstancingGUI(); - VisualEffectEditor.ShowHeader(EditorGUIUtility.TrTextContent("Initial state"), false, false); - if (prewarmDeltaTime != null && prewarmStepCount != null) + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Initial state"), showInitialStateCategory, out showInitialStateCategory)) { - DisplayPrewarmInspectorGUI(resourceObject, prewarmDeltaTime, prewarmStepCount); - } + if (showInitialStateCategory && prewarmDeltaTime != null && prewarmStepCount != null) + { + DisplayPrewarmInspectorGUI(resourceObject, prewarmDeltaTime, prewarmStepCount); + } - if (initialEventName != null) - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = initialEventName.hasMultipleDifferentValues; - EditorGUILayout.PropertyField(initialEventName, new GUIContent("Initial Event Name", "Sets the name of the event which triggers once the system is activated. Default: ‘OnPlay’.")); - if (EditorGUI.EndChangeCheck()) + if (showInitialStateCategory && initialEventName != null) { - resourceObject.ApplyModifiedProperties(); + EditorGUI.BeginChangeCheck(); + EditorGUI.showMixedValue = initialEventName.hasMultipleDifferentValues; + EditorGUILayout.PropertyField(initialEventName, new GUIContent("Initial Event Name", "Sets the name of the event which triggers once the system is activated. Default: ‘OnPlay’.")); + if (EditorGUI.EndChangeCheck()) + { + resourceObject.ApplyModifiedProperties(); + } } } @@ -899,79 +903,72 @@ private void OnInspectorGUIEmbedded() m_OutputContexts.Clear(); m_OutputContexts.AddRange(resource.GetOrCreateGraph().children.OfType().OrderBy(t => t.vfxSystemSortPriority)); - m_ReorderableList.DoLayoutList(); - - VisualEffectEditor.ShowHeader(EditorGUIUtility.TrTextContent("Shaders"), false, false); - - string assetPath = AssetDatabase.GetAssetPath(asset); - UnityObject[] objects = AssetDatabase.LoadAllAssetsAtPath(assetPath); - string directory = Path.GetDirectoryName(assetPath) + "/" + VFXExternalShaderProcessor.k_ShaderDirectory + "/" + asset.name + "/"; - - foreach (var obj in objects) + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Output Render Order"), showOutputOrderCategory, out showOutputOrderCategory)) { - if (obj is ComputeShader || obj is Shader) + if (showOutputOrderCategory) { - GUILayout.BeginHorizontal(); - Rect r = GUILayoutUtility.GetRect(0, 18, GUILayout.ExpandWidth(true)); - - int buttonsWidth = VFXExternalShaderProcessor.allowExternalization ? 240 : 160; - - int index = resource.GetShaderIndex(obj); - var shader = obj; + m_ReorderableList.DoLayoutList(); + } + } - Rect labelR = r; - labelR.width -= buttonsWidth; - GUI.Label(labelR, shader.name.Replace('\n', ' ')); + using (VisualEffectEditor.ShowAssetHeader(EditorGUIUtility.TrTextContent("Shaders"), showShadersCategory, out showShadersCategory)) + { + if (showShadersCategory) + { + string assetPath = AssetDatabase.GetAssetPath(asset); + UnityObject[] objects = AssetDatabase.LoadAllAssetsAtPath(assetPath); + string directory = Path.GetDirectoryName(assetPath) + "/" + VFXExternalShaderProcessor.k_ShaderDirectory + "/" + asset.name + "/"; - if (index >= 0) + foreach (var shader in objects) { - if (VFXExternalShaderProcessor.allowExternalization && index < resource.GetShaderSourceCount()) + if (shader is ComputeShader or Shader) { - string shaderSourceName = resource.GetShaderSourceName(index); - string externalPath = directory + shaderSourceName; + GUILayout.BeginHorizontal(); - externalPath = directory + shaderSourceName.Replace('/', '_') + VFXExternalShaderProcessor.k_ShaderExt; + int index = resource.GetShaderIndex(shader); + EditorGUILayout.LabelField(shader.name.Replace('\n', ' ')); - Rect buttonRect = r; - buttonRect.xMin = labelR.xMax; - buttonRect.width = 80; - labelR.width += 80; - if (System.IO.File.Exists(externalPath)) + if (index >= 0) { - if (GUI.Button(buttonRect, "Reveal External")) + if (VFXExternalShaderProcessor.allowExternalization && index < resource.GetShaderSourceCount()) { - EditorUtility.RevealInFinder(externalPath); + string shaderSourceName = resource.GetShaderSourceName(index); + string externalPath = directory + shaderSourceName; + + externalPath = directory + shaderSourceName.Replace('/', '_') + VFXExternalShaderProcessor.k_ShaderExt; + + if (System.IO.File.Exists(externalPath)) + { + if (GUILayout.Button("Reveal External", GUILayout.Width(80))) + { + EditorUtility.RevealInFinder(externalPath); + } + } + else + { + if (GUILayout.Button("Externalize", GUILayout.Width(80))) + { + Directory.CreateDirectory(directory); + + File.WriteAllText(externalPath, "//" + shaderSourceName + "," + index.ToString() + "\n//Don't delete the previous line or this one\n" + resource.GetShaderSource(index)); + } + } } - } - else - { - if (GUI.Button(buttonRect, "Externalize")) - { - Directory.CreateDirectory(directory); - File.WriteAllText(externalPath, "//" + shaderSourceName + "," + index.ToString() + "\n//Don't delete the previous line or this one\n" + resource.GetShaderSource(index)); + if (GUILayout.Button("Show Generated", GUILayout.Width(110))) + { + resource.ShowGeneratedShaderFile(index); } } - } - Rect buttonR = r; - buttonR.xMin = labelR.xMax; - buttonR.width = 110; - labelR.width += 110; - if (GUI.Button(buttonR, "Show Generated")) - { - resource.ShowGeneratedShaderFile(index); - } - } + if (GUILayout.Button("Select", GUILayout.Width(50))) + { + Selection.activeObject = shader; + } - Rect selectButtonR = r; - selectButtonR.xMin = labelR.xMax; - selectButtonR.width = 50; - if (GUI.Button(selectButtonR, "Select")) - { - Selection.activeObject = shader; + GUILayout.EndHorizontal(); + } } - GUILayout.EndHorizontal(); } } } @@ -981,35 +978,39 @@ private void OnInspectorGUIEmbedded() private void DrawInstancingGUI() { - VisualEffectEditor.ShowHeader(k_InstancingContent, false, false); - - EditorGUI.BeginChangeCheck(); - - VFXInstancingDisabledReason disabledReason = (VFXInstancingDisabledReason)instancingDisabledReasonProperty.intValue; - bool forceDisabled = disabledReason != VFXInstancingDisabledReason.None; - if (forceDisabled) + using (VisualEffectEditor.ShowAssetHeader(k_InstancingContent, showInstancingCategory, out showInstancingCategory)) { - System.Text.StringBuilder reasonString = new System.Text.StringBuilder("Instancing not available:"); - GetInstancingDisabledReasons(reasonString, disabledReason); - EditorGUILayout.HelpBox(reasonString.ToString(), MessageType.Info); - } + if (showInstancingCategory) + { + EditorGUI.BeginChangeCheck(); - VFXInstancingMode instancingMode = forceDisabled ? VFXInstancingMode.Disabled : (VFXInstancingMode)instancingModeProperty.intValue; - EditorGUI.BeginDisabled(forceDisabled); - instancingMode = (VFXInstancingMode)EditorGUILayout.EnumPopup(k_InstancingModeContent, instancingMode); - EditorGUI.EndDisabled(); + VFXInstancingDisabledReason disabledReason = (VFXInstancingDisabledReason)instancingDisabledReasonProperty.intValue; + bool forceDisabled = disabledReason != VFXInstancingDisabledReason.None; + if (forceDisabled) + { + System.Text.StringBuilder reasonString = new System.Text.StringBuilder("Instancing not available:"); + GetInstancingDisabledReasons(reasonString, disabledReason); + EditorGUILayout.HelpBox(reasonString.ToString(), MessageType.Info); + } - int instancingCapacity = instancingCapacityProperty.intValue; - if (instancingMode == VFXInstancingMode.Custom) - { - instancingCapacity = EditorGUILayout.DelayedIntField(k_InstancingCapacityContent, instancingCapacity); - } + VFXInstancingMode instancingMode = forceDisabled ? VFXInstancingMode.Disabled : (VFXInstancingMode)instancingModeProperty.intValue; + EditorGUI.BeginDisabled(forceDisabled); + instancingMode = (VFXInstancingMode)EditorGUILayout.EnumPopup(k_InstancingModeContent, instancingMode); + EditorGUI.EndDisabled(); - if (EditorGUI.EndChangeCheck()) - { - instancingModeProperty.intValue = (int)instancingMode; - instancingCapacityProperty.intValue = System.Math.Max(instancingCapacity, 1); - resourceObject.ApplyModifiedProperties(); + int instancingCapacity = instancingCapacityProperty.intValue; + if (instancingMode == VFXInstancingMode.Custom) + { + instancingCapacity = EditorGUILayout.DelayedIntField(k_InstancingCapacityContent, instancingCapacity); + } + + if (EditorGUI.EndChangeCheck()) + { + instancingModeProperty.intValue = (int)instancingMode; + instancingCapacityProperty.intValue = System.Math.Max(instancingCapacity, 1); + resourceObject.ApplyModifiedProperties(); + } + } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs index df33d5b3412..fa06f5159b7 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Inspector/VisualEffectEditor.cs @@ -670,34 +670,83 @@ protected virtual void EditorModeInspectorButton() { } - public static bool ShowHeader(GUIContent nameContent, bool displayFoldout, bool foldoutState, string preferenceName = null) + private class HeaderScope : IDisposable { - float height = Styles.categoryHeader.CalcHeight(nameContent, 4000) + 3; - - Rect rect = GUILayoutUtility.GetRect(1, height - 1); + public enum HeaderType + { + AssetHeader, + ComponentHeader, + SubHeader, + } - rect.width += rect.x; - rect.x = 0; + readonly HeaderType m_HeaderType; - if (Event.current.type == EventType.Repaint) - Styles.categoryHeader.Draw(rect, nameContent, false, true, true, false); + public bool ShowContent { get; } - bool result = false; - if (displayFoldout) + public HeaderScope(HeaderType headerType, bool foldoutState, GUIContent nameContent, string preferenceName = null) { - rect.x += 14; - rect.width -= 2; - result = EditorGUI.Toggle(rect, foldoutState, Styles.foldoutStyle); + m_HeaderType = headerType; + switch (m_HeaderType) + { + case HeaderType.AssetHeader: + var toggleState = false; + ShowContent = EditorGUILayout.ToggleTitlebar(foldoutState, nameContent, ref toggleState, true); + break; + case HeaderType.ComponentHeader: + ShowContent = EditorGUILayout.BeginFoldoutHeaderGroup(foldoutState, nameContent); + break; + case HeaderType.SubHeader: + EditorGUI.indentLevel += 1; + ShowContent = EditorGUILayout.Foldout(foldoutState, nameContent, true); + break; + default: + throw new ArgumentOutOfRangeException(); + } + if (!string.IsNullOrEmpty(preferenceName)) + { + EditorPrefs.SetBool(preferenceName, ShowContent); + } } - EditorGUI.indentLevel = result ? 1 : 0; - - if (preferenceName != null && result != foldoutState) + public void Dispose() { - EditorPrefs.SetBool(preferenceName, result); + switch (m_HeaderType) + { + case HeaderType.AssetHeader: + break; + case HeaderType.ComponentHeader: + EditorGUILayout.EndFoldoutHeaderGroup(); + break; + case HeaderType.SubHeader: + EditorGUI.indentLevel -= 1; + EditorGUILayout.Space(); + break; + default: + throw new ArgumentOutOfRangeException(); + } } + } - return result; + public static IDisposable ShowSubHeader(GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + return ShowHeader(HeaderScope.HeaderType.SubHeader, nameContent, foldoutState, out showContent, preferenceName); + } + + public static IDisposable ShowAssetHeader(GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + return ShowHeader(HeaderScope.HeaderType.AssetHeader, nameContent, foldoutState, out showContent, preferenceName); + } + + public static IDisposable ShowComponentHeader(GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + return ShowHeader(HeaderScope.HeaderType.ComponentHeader, nameContent, foldoutState, out showContent, preferenceName); + } + + private static IDisposable ShowHeader(HeaderScope.HeaderType headerType, GUIContent nameContent, bool foldoutState, out bool showContent, string preferenceName = null) + { + var indentScope = new HeaderScope(headerType, foldoutState, nameContent, preferenceName); + showContent = indentScope.ShowContent; + return indentScope; } protected virtual void AssetField(VisualEffectResource resource) @@ -740,6 +789,7 @@ void InitialEventField(VisualEffectResource resource) using (new GUILayout.HorizontalScope()) { var rect = EditorGUILayout.GetControlRect(false, GUI.skin.textField.CalcHeight(exampleGUIContent, 10000)); + rect.xMin += 16f; var toggleRect = rect; toggleRect.yMin += 2.0f; toggleRect.width = Styles.overrideWidth; @@ -811,7 +861,7 @@ bool ShowCategory(GUIContent nameContent, bool foldoutState) public override void OnInspectorGUI() { GUILayout.Space(6); - showGeneralCategory = ShowHeader(Contents.headerGeneral, true, showGeneralCategory, kGeneralFoldoutStatePreferenceName); + using (ShowComponentHeader(Contents.headerGeneral, showGeneralCategory, out showGeneralCategory, kGeneralFoldoutStatePreferenceName)) {} m_SingleSerializedObject.Update(); if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet @@ -848,7 +898,7 @@ public override void OnInspectorGUI() DrawInstancingProperties(); DrawParameters(resource); } - EditorGUI.indentLevel = 0; + if (serializedObject.ApplyModifiedProperties()) { foreach (var window in VFXViewWindow.GetAllWindows()) @@ -867,11 +917,11 @@ protected virtual void DrawParameters(VisualEffectResource resource) if (resource != null) graph = resource.GetOrCreateGraph(); - if (graph == null) { - ShowHeader(Contents.headerProperties, true, showPropertyCategory); - EditorGUILayout.HelpBox(Contents.graphInBundle.text.ToString(), MessageType.Info, true); + using var headerScope = ShowComponentHeader(Contents.headerProperties, showPropertyCategory, out showPropertyCategory, kPropertyFoldoutStatePreferenceName); + if (showPropertyCategory) + EditorGUILayout.HelpBox(Contents.graphInBundle.text.ToString(), MessageType.Info, true); } else { @@ -900,152 +950,121 @@ protected virtual void DrawParameters(VisualEffectResource resource) if (graph.m_ParameterInfo != null) { - showPropertyCategory = ShowHeader(Contents.headerProperties, true, showPropertyCategory, kPropertyFoldoutStatePreferenceName); - - if (showPropertyCategory) + using (ShowComponentHeader(Contents.headerProperties, showPropertyCategory, out showPropertyCategory, kPropertyFoldoutStatePreferenceName)) { - var stack = new List(); - int currentCount = graph.m_ParameterInfo.Length; - if (currentCount == 0) + if (showPropertyCategory) { - GUILayout.Label("No Property exposed in the Visual Effect Graph"); - } - else - { - EditorModeInspectorButton(); - } - - bool ignoreUntilNextCat = false; - - foreach (var param in graph.m_ParameterInfo) - { - EditorGUI.indentLevel = stack.Count; - --currentCount; - - var parameter = param; - if (parameter.descendantCount > 0) + EditorGUI.indentLevel++; + var stack = new List(); + int currentCount = graph.m_ParameterInfo.Length; + if (currentCount == 0) { - stack.Add(currentCount); - currentCount = parameter.descendantCount; + GUILayout.Label("No Property exposed in the Visual Effect Graph"); } + else + { + EditorModeInspectorButton(); + } + + bool ignoreUntilNextCat = false; - if (currentCount == 0 && stack.Count > 0) + foreach (var param in graph.m_ParameterInfo) { - do + EditorGUI.indentLevel = stack.Count; + --currentCount; + + var parameter = param; + if (parameter.descendantCount > 0) { - currentCount = stack.Last(); - stack.RemoveAt(stack.Count - 1); + stack.Add(currentCount); + currentCount = parameter.descendantCount; } - while (currentCount == 0); - } - if (string.IsNullOrEmpty(parameter.sheetType)) - { - if (!string.IsNullOrEmpty(parameter.name)) + if (currentCount == 0 && stack.Count > 0) { - if (string.IsNullOrEmpty(parameter.realType)) // This is a category + do { - bool wasIgnored = ignoreUntilNextCat; - ignoreUntilNextCat = false; - var nameContent = GetGUIContent(parameter.name); - - bool prevState = EditorPrefs.GetBool("VFX-category-" + parameter.name, true); - bool currentState = ShowCategory(nameContent, prevState); + currentCount = stack.Last(); + stack.RemoveAt(stack.Count - 1); + } while (currentCount == 0); + } - if (currentState != prevState) + if (string.IsNullOrEmpty(parameter.sheetType)) + { + if (!string.IsNullOrEmpty(parameter.name)) + { + if (string.IsNullOrEmpty(parameter.realType)) // This is a category { - EditorPrefs.SetBool("VFX-category-" + parameter.name, currentState); - } + bool wasIgnored = ignoreUntilNextCat; + ignoreUntilNextCat = false; + var nameContent = GetGUIContent(parameter.name); + + bool prevState = EditorPrefs.GetBool("VFX-category-" + parameter.name, true); + bool currentState = ShowCategory(nameContent, prevState); - if (!currentState) - ignoreUntilNextCat = true; + if (currentState != prevState) + { + EditorPrefs.SetBool("VFX-category-" + parameter.name, currentState); + } + + if (!currentState) + ignoreUntilNextCat = true; + } + else if (!ignoreUntilNextCat) + EmptyLineControl(parameter.name, parameter.tooltip, parameter.spaceable ? parameter.space : (VFXSpace?)null, stack.Count, resource); } - else if (!ignoreUntilNextCat) - EmptyLineControl(parameter.name, parameter.tooltip, parameter.spaceable ? parameter.space : (VFXSpace?)null, stack.Count, resource); } - } - else if (!ignoreUntilNextCat) - { - SerializedProperty sourceProperty = null; + else if (!ignoreUntilNextCat) + { + SerializedProperty sourceProperty = null; - m_PropertyToProp[parameter.sheetType].TryGetValue(parameter.path, out sourceProperty); + m_PropertyToProp[parameter.sheetType].TryGetValue(parameter.path, out sourceProperty); - //< Prepare potential indirection - bool wasNewProperty = false; - bool wasNotOverriddenProperty = false; + //< Prepare potential indirection + bool wasNewProperty = false; + bool wasNotOverriddenProperty = false; - SerializedProperty actualDisplayedPropertyValue = null; - SerializedProperty actualDisplayedPropertyOverridden = null; - if (sourceProperty == null) - { - s_FakeObjectSerializedCache.Update(); - var fakeField = s_FakeObjectSerializedCache.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - fakeField.InsertArrayElementAtIndex(fakeField.arraySize); - var newFakeEntry = fakeField.GetArrayElementAtIndex(fakeField.arraySize - 1); - newFakeEntry.FindPropertyRelative("m_Name").stringValue = param.path; - newFakeEntry.FindPropertyRelative("m_Overridden").boolValue = false; - - actualDisplayedPropertyOverridden = newFakeEntry.FindPropertyRelative("m_Overridden"); - actualDisplayedPropertyValue = newFakeEntry.FindPropertyRelative("m_Value"); - SetObjectValue(actualDisplayedPropertyValue, parameter.defaultValue.Get()); - - wasNewProperty = true; - } - else - { - actualDisplayedPropertyOverridden = sourceProperty.FindPropertyRelative("m_Overridden"); - actualDisplayedPropertyValue = sourceProperty.FindPropertyRelative("m_Value"); - if (!actualDisplayedPropertyOverridden.boolValue) + SerializedProperty actualDisplayedPropertyValue = null; + SerializedProperty actualDisplayedPropertyOverridden = null; + if (sourceProperty == null) { s_FakeObjectSerializedCache.Update(); - - actualDisplayedPropertyOverridden = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyOverridden.propertyPath); - actualDisplayedPropertyValue = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyValue.propertyPath); + var fakeField = s_FakeObjectSerializedCache.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + fakeField.InsertArrayElementAtIndex(fakeField.arraySize); + var newFakeEntry = fakeField.GetArrayElementAtIndex(fakeField.arraySize - 1); + newFakeEntry.FindPropertyRelative("m_Name").stringValue = param.path; + newFakeEntry.FindPropertyRelative("m_Overridden").boolValue = false; + + actualDisplayedPropertyOverridden = newFakeEntry.FindPropertyRelative("m_Overridden"); + actualDisplayedPropertyValue = newFakeEntry.FindPropertyRelative("m_Value"); SetObjectValue(actualDisplayedPropertyValue, parameter.defaultValue.Get()); - wasNotOverriddenProperty = true; + wasNewProperty = true; } - } - - //< Actual display - GUIContent nameContent = GetGUIContent(parameter.name, parameter.tooltip); - - bool wasOverriden = actualDisplayedPropertyOverridden.boolValue; - - bool overrideMixed = false; - bool valueMixed = false; - if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet - { - foreach (var otherObject in m_OtherSerializedObjects) + else { - var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - SerializedProperty otherSourceProperty = null; - for (int i = 0; i < otherSourceVfxField.arraySize; ++i) + actualDisplayedPropertyOverridden = sourceProperty.FindPropertyRelative("m_Overridden"); + actualDisplayedPropertyValue = sourceProperty.FindPropertyRelative("m_Value"); + if (!actualDisplayedPropertyOverridden.boolValue) { - otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); - var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; - if (nameProperty == parameter.path) - { - break; - } - otherSourceProperty = null; - } + s_FakeObjectSerializedCache.Update(); - if (otherSourceProperty != null) - { - overrideMixed = overrideMixed || (wasOverriden != otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue); - } - else - { - overrideMixed = overrideMixed || wasOverriden; + actualDisplayedPropertyOverridden = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyOverridden.propertyPath); + actualDisplayedPropertyValue = s_FakeObjectSerializedCache.FindProperty(actualDisplayedPropertyValue.propertyPath); + SetObjectValue(actualDisplayedPropertyValue, parameter.defaultValue.Get()); + + wasNotOverriddenProperty = true; } - if (overrideMixed) - break; } - if (overrideMixed) - valueMixed = true; - else + //< Actual display + GUIContent nameContent = GetGUIContent(parameter.name, parameter.tooltip); + + bool wasOverriden = actualDisplayedPropertyOverridden.boolValue; + + bool overrideMixed = false; + bool valueMixed = false; + if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet { foreach (var otherObject in m_OtherSerializedObjects) { @@ -1056,130 +1075,174 @@ protected virtual void DrawParameters(VisualEffectResource resource) otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; if (nameProperty == parameter.path) + { break; + } + otherSourceProperty = null; } if (otherSourceProperty != null) { - var otherValue = GetObjectValue(otherSourceProperty.FindPropertyRelative("m_Value")); - if (otherValue == null) - valueMixed = valueMixed || GetObjectValue(actualDisplayedPropertyValue) != null; - else - valueMixed = valueMixed || !otherValue.Equals(GetObjectValue(actualDisplayedPropertyValue)); + overrideMixed = overrideMixed || (wasOverriden != otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue); + } + else + { + overrideMixed = overrideMixed || wasOverriden; } - if (valueMixed) + if (overrideMixed) break; } - } - } - bool overridenChanged = false; - if (DisplayProperty(ref parameter, nameContent, actualDisplayedPropertyOverridden, actualDisplayedPropertyValue, overrideMixed, valueMixed, out overridenChanged) || overridenChanged) - { - if (!overridenChanged) // the value has changed - { - if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet + + if (overrideMixed) + valueMixed = true; + else { foreach (var otherObject in m_OtherSerializedObjects) { - var singleSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - SerializedProperty singleSourceProperty = null; - for (int i = 0; i < singleSourceVfxField.arraySize; ++i) + var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + SerializedProperty otherSourceProperty = null; + for (int i = 0; i < otherSourceVfxField.arraySize; ++i) { - singleSourceProperty = singleSourceVfxField.GetArrayElementAtIndex(i); - var nameProperty = singleSourceProperty.FindPropertyRelative("m_Name").stringValue; + otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); + var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; if (nameProperty == parameter.path) - { break; - } - singleSourceProperty = null; + otherSourceProperty = null; } - if (singleSourceProperty == null) - { - singleSourceVfxField.InsertArrayElementAtIndex(singleSourceVfxField.arraySize); - var newEntry = singleSourceVfxField.GetArrayElementAtIndex(singleSourceVfxField.arraySize - 1); - newEntry.FindPropertyRelative("m_Overridden").boolValue = true; - SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); - newEntry.FindPropertyRelative("m_Name").stringValue = param.path; - PropertyOverrideChanged(); - } - else + if (otherSourceProperty != null) { - singleSourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; - SetObjectValue(singleSourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + var otherValue = GetObjectValue(otherSourceProperty.FindPropertyRelative("m_Value")); + if (otherValue == null) + valueMixed = valueMixed || GetObjectValue(actualDisplayedPropertyValue) != null; + else + valueMixed = valueMixed || !otherValue.Equals(GetObjectValue(actualDisplayedPropertyValue)); } - otherObject.ApplyModifiedProperties(); + + if (valueMixed) + break; } } } - if (wasNewProperty) - { - var sourceVfxField = m_VFXPropertySheet.FindPropertyRelative(parameter.sheetType + ".m_Array"); - //We start editing a new exposed value which wasn't stored in this Visual Effect Component - sourceVfxField.InsertArrayElementAtIndex(sourceVfxField.arraySize); - var newEntry = sourceVfxField.GetArrayElementAtIndex(sourceVfxField.arraySize - 1); - - newEntry.FindPropertyRelative("m_Overridden").boolValue = true; - SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); - newEntry.FindPropertyRelative("m_Name").stringValue = param.path; - PropertyOverrideChanged(); - } - else if (wasNotOverriddenProperty && !overridenChanged) - { - if (!actualDisplayedPropertyOverridden.boolValue) - { - //The value has been directly changed, change overridden state and recopy new value - SetObjectValue(sourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); - } - sourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; - PropertyOverrideChanged(); - } - else if (wasOverriden != actualDisplayedPropertyOverridden.boolValue) + + bool overridenChanged = false; + if (DisplayProperty(ref parameter, nameContent, actualDisplayedPropertyOverridden, actualDisplayedPropertyValue, overrideMixed, valueMixed, out overridenChanged) || overridenChanged) { - sourceProperty.FindPropertyRelative("m_Overridden").boolValue = actualDisplayedPropertyOverridden.boolValue; - if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet + if (!overridenChanged) // the value has changed { - foreach (var otherObject in m_OtherSerializedObjects) + if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet { - var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); - SerializedProperty otherSourceProperty = null; - for (int i = 0; i < otherSourceVfxField.arraySize; ++i) + foreach (var otherObject in m_OtherSerializedObjects) { - otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); - var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; - if (nameProperty == parameter.path) + var singleSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + SerializedProperty singleSourceProperty = null; + for (int i = 0; i < singleSourceVfxField.arraySize; ++i) { - break; + singleSourceProperty = singleSourceVfxField.GetArrayElementAtIndex(i); + var nameProperty = singleSourceProperty.FindPropertyRelative("m_Name").stringValue; + if (nameProperty == parameter.path) + { + break; + } + + singleSourceProperty = null; } - otherSourceProperty = null; - } - if (otherSourceProperty == null) - { - if (!wasOverriden) + + if (singleSourceProperty == null) { - otherSourceVfxField.InsertArrayElementAtIndex(otherSourceVfxField.arraySize); - var newEntry = otherSourceVfxField.GetArrayElementAtIndex(otherSourceVfxField.arraySize - 1); + singleSourceVfxField.InsertArrayElementAtIndex(singleSourceVfxField.arraySize); + var newEntry = singleSourceVfxField.GetArrayElementAtIndex(singleSourceVfxField.arraySize - 1); newEntry.FindPropertyRelative("m_Overridden").boolValue = true; SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); newEntry.FindPropertyRelative("m_Name").stringValue = param.path; PropertyOverrideChanged(); } + else + { + singleSourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; + SetObjectValue(singleSourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + } + + otherObject.ApplyModifiedProperties(); } - else + } + } + + if (wasNewProperty) + { + var sourceVfxField = m_VFXPropertySheet.FindPropertyRelative(parameter.sheetType + ".m_Array"); + //We start editing a new exposed value which wasn't stored in this Visual Effect Component + sourceVfxField.InsertArrayElementAtIndex(sourceVfxField.arraySize); + var newEntry = sourceVfxField.GetArrayElementAtIndex(sourceVfxField.arraySize - 1); + + newEntry.FindPropertyRelative("m_Overridden").boolValue = true; + SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + newEntry.FindPropertyRelative("m_Name").stringValue = param.path; + PropertyOverrideChanged(); + } + else if (wasNotOverriddenProperty && !overridenChanged) + { + if (!actualDisplayedPropertyOverridden.boolValue) + { + //The value has been directly changed, change overridden state and recopy new value + SetObjectValue(sourceProperty.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + } + + sourceProperty.FindPropertyRelative("m_Overridden").boolValue = true; + PropertyOverrideChanged(); + } + else if (wasOverriden != actualDisplayedPropertyOverridden.boolValue) + { + sourceProperty.FindPropertyRelative("m_Overridden").boolValue = actualDisplayedPropertyOverridden.boolValue; + if (m_OtherSerializedObjects != null) // copy the set value to all multi selection by hand, because it might not be at the same array index or already present in the property sheet + { + foreach (var otherObject in m_OtherSerializedObjects) { - otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue = !wasOverriden; - PropertyOverrideChanged(); + var otherSourceVfxField = otherObject.FindProperty("m_PropertySheet." + parameter.sheetType + ".m_Array"); + SerializedProperty otherSourceProperty = null; + for (int i = 0; i < otherSourceVfxField.arraySize; ++i) + { + otherSourceProperty = otherSourceVfxField.GetArrayElementAtIndex(i); + var nameProperty = otherSourceProperty.FindPropertyRelative("m_Name").stringValue; + if (nameProperty == parameter.path) + { + break; + } + + otherSourceProperty = null; + } + + if (otherSourceProperty == null) + { + if (!wasOverriden) + { + otherSourceVfxField.InsertArrayElementAtIndex(otherSourceVfxField.arraySize); + var newEntry = otherSourceVfxField.GetArrayElementAtIndex(otherSourceVfxField.arraySize - 1); + + newEntry.FindPropertyRelative("m_Overridden").boolValue = true; + SetObjectValue(newEntry.FindPropertyRelative("m_Value"), GetObjectValue(actualDisplayedPropertyValue)); + newEntry.FindPropertyRelative("m_Name").stringValue = param.path; + PropertyOverrideChanged(); + } + } + else + { + otherSourceProperty.FindPropertyRelative("m_Overridden").boolValue = !wasOverriden; + PropertyOverrideChanged(); + } + + otherObject.ApplyModifiedProperties(); } - otherObject.ApplyModifiedProperties(); } + + PropertyOverrideChanged(); } - PropertyOverrideChanged(); + m_SingleSerializedObject.ApplyModifiedProperties(); } - m_SingleSerializedObject.ApplyModifiedProperties(); } } } @@ -1193,27 +1256,29 @@ protected virtual void PropertyOverrideChanged() { } private void DrawRendererProperties() { - showRendererCategory = ShowHeader(Contents.headerRenderer, true, showRendererCategory, kRendererFoldoutStatePreferenceName); - - if (showRendererCategory) - m_RendererEditor.OnInspectorGUI(); + using (ShowComponentHeader(Contents.headerRenderer, showRendererCategory, out showRendererCategory, kRendererFoldoutStatePreferenceName)) + { + if (showRendererCategory) + m_RendererEditor.OnInspectorGUI(); + } } private void DrawInstancingProperties() { - showInstancingCategory = ShowHeader(Contents.headerInstancing, true, showInstancingCategory, kInstancingFoldoutStatePreferenceName); - - if (showInstancingCategory) + using (ShowComponentHeader(Contents.headerInstancing, showInstancingCategory, out showInstancingCategory, kInstancingFoldoutStatePreferenceName)) { - EditorGUI.BeginChangeCheck(); - EditorGUILayout.PropertyField(m_AllowInstancing, Contents.allowInstancing); - if (EditorGUI.EndChangeCheck()) + if (showInstancingCategory) { - serializedObject.ApplyModifiedProperties(); - - foreach (var visualEffect in targets.OfType()) + EditorGUI.BeginChangeCheck(); + EditorGUILayout.PropertyField(m_AllowInstancing, Contents.allowInstancing); + if (EditorGUI.EndChangeCheck()) { - visualEffect.RecreateData(); + serializedObject.ApplyModifiedProperties(); + + foreach (var visualEffect in targets.OfType()) + { + visualEffect.RecreateData(); + } } } } @@ -1300,111 +1365,95 @@ public void OnInspectorGUI() { m_SerializedRenderers.Update(); - EditorGUI.indentLevel += 1; - // Ugly hack to indent the header group because "indentLevel" is not taken into account - var x = EditorStyles.inspectorDefaultMargins.padding.left; - EditorStyles.inspectorDefaultMargins.padding.left -= 24; - bool showProbesCategory = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowProbesCategory, Contents.probeSettings); - if (showProbesCategory != m_ShowProbesCategory) + using (ShowSubHeader(Contents.probeSettings, m_ShowProbesCategory, out m_ShowProbesCategory, kRendererProbesFoldoutStatePreferenceName)) { - m_ShowProbesCategory = showProbesCategory; - EditorPrefs.SetBool(kRendererProbesFoldoutStatePreferenceName, m_ShowProbesCategory); - } - - if (m_ShowProbesCategory) - { - bool showReflectionProbeUsage = m_ReflectionProbeUsage != null && SupportedRenderingFeatures.active.reflectionProbes; - - var srpAssetType = GraphicsSettings.currentRenderPipelineAssetType; - if (srpAssetType is not null && srpAssetType.ToString().Contains("UniversalRenderPipeline")) + if (m_ShowProbesCategory) { - //Reflection Probe Usage option has been removed in URP but the VFXRenderer uses ReflectionProbeUsage.Off by default - //We are temporarily letting this option reachable until the C++ doesn't change the default value - showReflectionProbeUsage = m_ReflectionProbeUsage != null; - } + bool showReflectionProbeUsage = m_ReflectionProbeUsage != null && SupportedRenderingFeatures.active.reflectionProbes; - if (showReflectionProbeUsage) - { - Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); - EditorGUI.BeginProperty(r, Contents.reflectionProbeUsageStyle, m_ReflectionProbeUsage); - EditorGUI.BeginChangeCheck(); - var newValue = EditorGUI.EnumPopup(r, Contents.reflectionProbeUsageStyle, (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue); - if (EditorGUI.EndChangeCheck()) - m_ReflectionProbeUsage.intValue = (int)(ReflectionProbeUsage)newValue; - EditorGUI.EndProperty(); - } - - if (m_LightProbeUsage != null) - { - Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); - EditorGUI.BeginProperty(r, Contents.lightProbeUsageStyle, m_LightProbeUsage); - EditorGUI.BeginChangeCheck(); - var newValue = EditorGUI.EnumPopup(r, Contents.lightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue); - if (EditorGUI.EndChangeCheck()) - m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue; - EditorGUI.EndProperty(); + var srpAssetType = GraphicsSettings.currentRenderPipelineAssetType; + if (srpAssetType is not null && srpAssetType.ToString().Contains("UniversalRenderPipeline")) + { + //Reflection Probe Usage option has been removed in URP but the VFXRenderer uses ReflectionProbeUsage.Off by default + //We are temporarily letting this option reachable until the C++ doesn't change the default value + showReflectionProbeUsage = m_ReflectionProbeUsage != null; + } - if (!m_LightProbeUsage.hasMultipleDifferentValues && m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume) + if (showReflectionProbeUsage) { - if (!LightProbeProxyVolume.isFeatureSupported || !SupportedRenderingFeatures.active.lightProbeProxyVolumes) - EditorGUILayout.HelpBox(Contents.lightProbeVolumeUnsupportedNote.text, MessageType.Warning); - EditorGUILayout.PropertyField(m_LightProbeVolumeOverride, Contents.lightProbeVolumeOverrideStyle); + Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); + EditorGUI.BeginProperty(r, Contents.reflectionProbeUsageStyle, m_ReflectionProbeUsage); + EditorGUI.BeginChangeCheck(); + var newValue = EditorGUI.EnumPopup(r, Contents.reflectionProbeUsageStyle, (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue); + if (EditorGUI.EndChangeCheck()) + m_ReflectionProbeUsage.intValue = (int)(ReflectionProbeUsage)newValue; + EditorGUI.EndProperty(); } - } - bool useReflectionProbes = m_ReflectionProbeUsage != null && !m_ReflectionProbeUsage.hasMultipleDifferentValues && (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue != ReflectionProbeUsage.Off; - bool lightProbesEnabled = m_LightProbeUsage != null && !m_LightProbeUsage.hasMultipleDifferentValues && (LightProbeUsage)m_LightProbeUsage.intValue != LightProbeUsage.Off; - bool needsProbeAnchor = useReflectionProbes || lightProbesEnabled; + if (m_LightProbeUsage != null) + { + Rect r = EditorGUILayout.GetControlRect(true, EditorGUI.kSingleLineHeight, EditorStyles.popup); + EditorGUI.BeginProperty(r, Contents.lightProbeUsageStyle, m_LightProbeUsage); + EditorGUI.BeginChangeCheck(); + var newValue = EditorGUI.EnumPopup(r, Contents.lightProbeUsageStyle, (LightProbeUsage)m_LightProbeUsage.intValue); + if (EditorGUI.EndChangeCheck()) + m_LightProbeUsage.intValue = (int)(LightProbeUsage)newValue; + EditorGUI.EndProperty(); - if (needsProbeAnchor) - EditorGUILayout.PropertyField(m_ProbeAnchor, Contents.lightProbeAnchorStyle); - } - EditorGUILayout.EndFoldoutHeaderGroup(); + if (!m_LightProbeUsage.hasMultipleDifferentValues && m_LightProbeUsage.intValue == (int)LightProbeUsage.UseProxyVolume) + { + if (!LightProbeProxyVolume.isFeatureSupported || !SupportedRenderingFeatures.active.lightProbeProxyVolumes) + EditorGUILayout.HelpBox(Contents.lightProbeVolumeUnsupportedNote.text, MessageType.Warning); + EditorGUILayout.PropertyField(m_LightProbeVolumeOverride, Contents.lightProbeVolumeOverrideStyle); + } + } - var showAdditionnalCategory = EditorGUILayout.BeginFoldoutHeaderGroup(m_ShowAdditionnalCategory, Contents.otherSettings); - if (showAdditionnalCategory != m_ShowAdditionnalCategory) - { - m_ShowAdditionnalCategory = showAdditionnalCategory; - EditorPrefs.SetBool(kRendererAdditionnalSettingsFoldoutStatePreferenceName, m_ShowAdditionnalCategory); + bool useReflectionProbes = m_ReflectionProbeUsage != null && !m_ReflectionProbeUsage.hasMultipleDifferentValues && (ReflectionProbeUsage)m_ReflectionProbeUsage.intValue != ReflectionProbeUsage.Off; + bool lightProbesEnabled = m_LightProbeUsage != null && !m_LightProbeUsage.hasMultipleDifferentValues && (LightProbeUsage)m_LightProbeUsage.intValue != LightProbeUsage.Off; + bool needsProbeAnchor = useReflectionProbes || lightProbesEnabled; + + if (needsProbeAnchor) + EditorGUILayout.PropertyField(m_ProbeAnchor, Contents.lightProbeAnchorStyle); + } } - if (showAdditionnalCategory) + using (ShowSubHeader(Contents.otherSettings, m_ShowAdditionnalCategory, out m_ShowAdditionnalCategory, kRendererAdditionnalSettingsFoldoutStatePreferenceName)) { - if (m_RenderingLayerMask != null && GraphicsSettings.isScriptableRenderPipelineEnabled) + if (m_ShowAdditionnalCategory) { - var mask = m_Renderers[0].renderingLayerMask; - - EditorGUI.BeginChangeCheck(); - mask = EditorGUILayout.RenderingLayerMaskField(Contents.renderingLayerMaskStyle, mask); - if (EditorGUI.EndChangeCheck()) + if (m_RenderingLayerMask != null && GraphicsSettings.isScriptableRenderPipelineEnabled) { - Undo.RecordObjects(m_SerializedRenderers.targetObjects, "Set rendering layer mask"); - for (var i = 0; i < m_SerializedRenderers.targetObjects.Length; i++) + var mask = m_Renderers[0].renderingLayerMask; + + EditorGUI.BeginChangeCheck(); + mask = EditorGUILayout.RenderingLayerMaskField(Contents.renderingLayerMaskStyle, mask); + if (EditorGUI.EndChangeCheck()) { - var r = m_SerializedRenderers.targetObjects[i] as VFXRenderer; - if (r == null) - continue; - r.renderingLayerMask = mask; - EditorUtility.SetDirty(r); + Undo.RecordObjects(m_SerializedRenderers.targetObjects, "Set rendering layer mask"); + for (var i = 0; i < m_SerializedRenderers.targetObjects.Length; i++) + { + var r = m_SerializedRenderers.targetObjects[i] as VFXRenderer; + if (r == null) + continue; + r.renderingLayerMask = mask; + EditorUtility.SetDirty(r); + } } } - } - if (m_RendererPriority != null && SupportedRenderingFeatures.active.rendererPriority) - { - EditorGUILayout.PropertyField(m_RendererPriority, Contents.rendererPriorityStyle); - } + if (m_RendererPriority != null && SupportedRenderingFeatures.active.rendererPriority) + { + EditorGUILayout.PropertyField(m_RendererPriority, Contents.rendererPriorityStyle); + } - if (m_SortingOrder != null && m_SortingLayerID != null) - { - var hasPrefabOverride = HasPrefabOverride(m_SortingLayerID); - SortingLayerField(Contents.sortingLayerStyle, m_SortingLayerID, hasPrefabOverride ? Contents.boldPopupStyle : EditorStyles.popup, hasPrefabOverride ? EditorStyles.boldLabel : EditorStyles.label); - EditorGUILayout.PropertyField(m_SortingOrder, Contents.sortingOrderStyle); + if (m_SortingOrder != null && m_SortingLayerID != null) + { + var hasPrefabOverride = HasPrefabOverride(m_SortingLayerID); + SortingLayerField(Contents.sortingLayerStyle, m_SortingLayerID, hasPrefabOverride ? Contents.boldPopupStyle : EditorStyles.popup, hasPrefabOverride ? EditorStyles.boldLabel : EditorStyles.label); + EditorGUILayout.PropertyField(m_SortingOrder, Contents.sortingOrderStyle); + } } } - EditorGUILayout.EndFoldoutHeaderGroup(); - EditorStyles.inspectorDefaultMargins.padding.left = x; - EditorGUI.indentLevel -= 1; m_SerializedRenderers.ApplyModifiedProperties(); } @@ -1505,30 +1554,16 @@ protected static class Styles public static readonly GUIStyle toggleStyle; public static readonly GUIStyle toggleMixedStyle; - public static readonly GUIStyle categoryHeader; - public static readonly GUILayoutOption MiniButtonWidth = GUILayout.Width(56); - public static readonly GUILayoutOption PlayControlsHeight = GUILayout.Height(24); public const float overrideWidth = 16; static Styles() { var builtInSkin = GetCurrentSkin(); foldoutStyle = new GUIStyle(EditorStyles.foldout); - foldoutStyle.fontStyle = FontStyle.Bold; - toggleStyle = new GUIStyle(builtInSkin.GetStyle("ShurikenToggle")); toggleMixedStyle = new GUIStyle(builtInSkin.GetStyle("ShurikenCheckMarkMixed")); - categoryHeader = new GUIStyle(builtInSkin.label); - categoryHeader.fontStyle = FontStyle.Bold; - categoryHeader.border.left = 2; - categoryHeader.padding.left = 32; - categoryHeader.padding.top = 2; - categoryHeader.border.right = 2; - - //TODO change to editor resources calls - categoryHeader.normal.background = (Texture2D)AssetDatabase.LoadAssetAtPath(VisualEffectAssetEditorUtility.editorResourcesPath + (EditorGUIUtility.isProSkin ? "/VFX/cat-background-dark.png" : "/VFX/cat-background-light.png")); } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs index 0f3a82ca75a..9a6df5fa796 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/HLSL/CustomHLSL.cs @@ -235,7 +235,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!ReferenceEquals(m_ShaderFile, null)) { - dependencies.Add(m_ShaderFile.GetInstanceID()); + dependencies.Add(m_ShaderFile.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs index 3bfcf24416b..b9b5be9310f 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/Implementations/Spawn/VFXSpawnerCustomWrapper.cs @@ -86,7 +86,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (customBehavior != null) { - dependencies.Add(customBehavior.GetInstanceID()); + dependencies.Add(customBehavior.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs index 4363f9986db..121cb483c8a 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Blocks/VFXSubgraphBlock.cs @@ -27,7 +27,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(m_Subgraph, null)) { - dependencies.Add(m_Subgraph.GetInstanceID()); + dependencies.Add(m_Subgraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs index c7ee59cff23..0caf5788226 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXComposedShading.cs @@ -52,7 +52,7 @@ ShaderGraphVfxAsset GetOrRefreshShaderGraphObject(List<(string error, VFXErrorTy errors.Add(("DeprecatedOldShaderGraph", VFXErrorType.Error, ParticleShadingShaderGraph.kErrorOldSG)); currentShaderGraph = VFXResources.errorFallbackShaderGraph; - } + } else if (VFXLibrary.currentSRPBinder != null && !VFXLibrary.currentSRPBinder.IsShaderVFXCompatible(currentShaderGraph)) { if (errors != null) @@ -191,7 +191,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!ReferenceEquals(shaderGraph, null)) { - dependencies.Add(shaderGraph.GetInstanceID()); + dependencies.Add(shaderGraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs index 9dee93e077b..e634605c3de 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/Implementations/VFXStaticMeshOutput.cs @@ -64,7 +64,7 @@ private Shader GetOrRefreshShaderGraphObject(bool refreshErrors = true) var wasShaderGraphMissing = m_IsShaderGraphMissing; var meshShader = ((VFXDataMesh)GetData()).shader; //This is the only place where shader property is updated or read - if (meshShader == null && !object.ReferenceEquals(meshShader, null) && meshShader.GetInstanceID() != 0) + if (meshShader == null && !object.ReferenceEquals(meshShader, null) && meshShader.GetEntityId() != EntityId.None) { var assetPath = AssetDatabase.GetAssetPath(meshShader.GetEntityId()); @@ -109,7 +109,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(shader, null)) { - dependencies.Add(shader.GetInstanceID()); + dependencies.Add(shader.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs index ad6480cf8e7..6c3a9ccd83e 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXAbstractComposedParticleOutput.cs @@ -421,11 +421,17 @@ public sealed override void CheckGraphBeforeImport() { if (m_Topology != null && m_Shading != null) { + var currentName = name; MarkCacheAsDirty(); base.CheckGraphBeforeImport(); if (!VFXGraph.explicitCompile) { - ResyncSlots(true); + bool slotChanged = ResyncSlots(true); + if (!slotChanged && currentName != name) + { + //`Invalidate(this, InvalidationCause.kUIChangedTransient)` won't trigger Modified/onModified + Invalidate(InvalidationCause.kUIChangedTransient); + } } } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs index cefa53d77a0..745bd795c05 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs @@ -449,6 +449,8 @@ protected static void InnerLink(VFXContext from, VFXContext to, int fromIndex, i } } + BreakCyclesVertical(from, to, notify); + if (VFXData.CanConvert(from.ownedType, to.ownedType) && from.ownedType.HasFlag(VFXDataType.Particle)) to.InnerSetData(from.GetData(), false); @@ -477,6 +479,95 @@ private static void InnerUnlink(VFXContext from, VFXContext to, int fromIndex = } } + private static readonly string k_BreakCycleWarning = "The newly connected edge created a cycle in the graph, disconnecting another edge."; + public static bool BreakCyclesVertical(VFXContext from, VFXContext to, bool notify) => BreakCyclesVertical(from, to, notify, new HashSet()); + + private static bool BreakCyclesVertical(VFXContext from, VFXContext to, bool notify, HashSet contexts, bool first = true) + { + bool found = false; + if (from == to) + { + found = true; + } + else if (!contexts.Contains(from)) + { + contexts.Add(from); + if (from is VFXBasicGPUEvent gpuEvent) + { + Debug.Assert(gpuEvent.inputSlots.Count == 1); + var fromSlot = from.inputSlots[0]; + foreach (var toSlot in fromSlot.LinkedSlots.ToArray()) // TODO: Remove copy + { + var block = toSlot.owner as VFXBlock; + if (BreakCyclesVertical(block.GetParent(), to, notify, contexts, false)) + { + // Try to break horizontal links that cause a cycle + if (first) + { + Debug.LogWarning(k_BreakCycleWarning); + fromSlot.Unlink(toSlot, notify); + } + found |= true; + } + } + } + else + { + foreach (var inputSlot in from.inputFlowSlot) + { + foreach (var link in inputSlot.link) + { + found |= BreakCyclesVertical(link.context, to, notify, contexts, first); + } + } + } + } + return found; + } + + public static bool BreakCyclesHorizontal(VFXContext from, VFXContext to, bool notify) => BreakCyclesHorizontal(from, to, notify, new HashSet()); + + private static bool BreakCyclesHorizontal(VFXContext from, VFXContext to, bool notify, HashSet contexts) + { + bool found = false; + if (!contexts.Contains(from)) + { + contexts.Add(from); + if (from is VFXBasicGPUEvent gpuEvent) + { + Debug.Assert(gpuEvent.inputSlots.Count == 1); + var fromSlot = from.inputSlots[0]; + foreach (var toSlot in fromSlot.LinkedSlots) + { + var block = toSlot.owner as VFXBlock; + found |= BreakCyclesHorizontal(block.GetParent(), to, notify, contexts); + } + } + else + { + for (int slotIndex = 0; slotIndex < from.inputFlowSlot.Length; ++slotIndex) + { + var inputSlot = from.inputFlowSlot[slotIndex]; + foreach (var link in inputSlot.link.ToArray()) + { + // Try to break vertical links that cause a cycle + if (link.context == to) + { + Debug.LogWarning(k_BreakCycleWarning); + InnerUnlink(link.context, from, link.slotIndex, slotIndex, notify); + found = true; + } + else + { + found |= BreakCyclesHorizontal(link.context, to, notify, contexts); + } + } + } + } + } + return found; + } + public VFXContextSlot[] inputFlowSlot { get { return m_InputFlowSlot == null ? new VFXContextSlot[] { } : m_InputFlowSlot; } } public VFXContextSlot[] outputFlowSlot { get { return m_OutputFlowSlot == null ? new VFXContextSlot[] { } : m_OutputFlowSlot; } } protected virtual int inputFlowCount { get { return 1; } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs index 27792a11ba2..5f4c87bd947 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Contexts/VFXSubgraphContext.cs @@ -44,7 +44,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(m_Subgraph, null)) { - dependencies.Add(m_Subgraph.GetInstanceID()); + dependencies.Add(m_Subgraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs index 1e3efc4d25d..d90b5bc27d8 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/CustomHLSL.cs @@ -228,7 +228,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!ReferenceEquals(m_ShaderFile, null)) { - dependencies.Add(m_ShaderFile.GetInstanceID()); + dependencies.Add(m_ShaderFile.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs index e4bd869d448..7a4d83bc7af 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/LookAt.cs @@ -32,8 +32,8 @@ protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpressi VFXExpression viewVector = to - from; - VFXExpression z = VFXOperatorUtility.Normalize(viewVector); - VFXExpression x = VFXOperatorUtility.Normalize(VFXOperatorUtility.Cross(up, z)); + VFXExpression z = VFXOperatorUtility.SafeNormalize(viewVector); + VFXExpression x = VFXOperatorUtility.SafeNormalize(VFXOperatorUtility.Cross(up, z)); VFXExpression y = VFXOperatorUtility.Cross(z, x); VFXExpression matrix = new VFXExpressionAxisToMatrix(x, y, z, from); diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs index cf4d5a66b39..99a8db383b3 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/Operators/VFXSubgraphOperator.cs @@ -191,7 +191,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(m_Subgraph, null)) { - dependencies.Add(m_Subgraph.GetInstanceID()); + dependencies.Add(m_Subgraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs index 82503b02cdf..7333b3bb253 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/Models/VFXGraph.cs @@ -1710,6 +1710,7 @@ private VFXGraphCompiledData compiledData [SerializeField] private int m_ResourceVersion; + [NonSerialized] private bool m_GraphSanitized = false; private bool m_ExpressionGraphDirty = true; private bool m_ExpressionValuesDirty = true; diff --git a/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs b/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs index 1ecb6c294be..c683a1defb7 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/ShaderGraph/VFXShaderGraphParticleOutput.cs @@ -99,7 +99,7 @@ public override void GetImportDependentAssets(HashSet dependencies) base.GetImportDependentAssets(dependencies); if (!object.ReferenceEquals(shaderGraph, null)) { - dependencies.Add(shaderGraph.GetInstanceID()); + dependencies.Add(shaderGraph.GetEntityId()); } } diff --git a/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs b/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs index 4c17b9c2c33..1a7dfedd433 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/TemplateWindow/VFXTemplateHelperInternal.cs @@ -1,6 +1,7 @@ using System; - +using System.Reflection; using UnityEditor.Experimental.GraphView; +using UnityEngine; namespace UnityEditor.VFX { @@ -35,6 +36,33 @@ public string OpenSaveFileDialog() public GraphViewTemplateWindow.ISaveFileDialogHelper saveFileDialogHelper { get; set; } = new SaveFileDialog(); + public static void ImportSampleDependencies(PackageManager.PackageInfo packageInfo, PackageManager.UI.Sample sample) + { + try + { + var sampleDependencyImporterType = typeof(Rendering.DebugState).Assembly.GetType("SampleDependencyImporter"); + var instanceProperty = sampleDependencyImporterType.GetProperty("instance", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static); + var importerInstance = instanceProperty.GetValue(null); + var importSampleDependenciesMethod = sampleDependencyImporterType.GetMethod( + "ImportSampleDependencies", + BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance, + null, + new Type[] { typeof(PackageManager.PackageInfo), typeof(PackageManager.UI.Sample) }, + null); + importSampleDependenciesMethod.Invoke(importerInstance, new object[] { packageInfo, sample }); + } + catch (Exception e) + { + Debug.LogError("ImportSampleDependencies unexpected failure, SampleDependencyImporter might have been changed or has been moved."); + Debug.LogException(e); + } + } + + public void RaiseImportSampleDependencies(PackageManager.PackageInfo packageInfo, PackageManager.UI.Sample sample) + { + ImportSampleDependencies(packageInfo, sample); + } + /// /// This method is called each time a template is used. /// This is the good place to implement analytics diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png deleted file mode 100644 index 4d10cda3334..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png.meta b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png.meta deleted file mode 100644 index 56dfd883e76..00000000000 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-dark.png.meta +++ /dev/null @@ -1,130 +0,0 @@ -fileFormatVersion: 2 -guid: d333db22a2cc31e48a5aba38045265db -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 13 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - flipGreenChannel: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMipmapLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 0 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 - swizzle: 50462976 - cookieLightType: 1 - platformSettings: - - serializedVersion: 4 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: CloudRendering - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - customData: - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spriteCustomMetadata: - entries: [] - nameFileIdTable: {} - mipmapLimitGroupName: - pSDRemoveMatte: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png deleted file mode 100644 index c342a2795a8..00000000000 Binary files a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png and /dev/null differ diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png.meta b/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png.meta deleted file mode 100644 index 5b3e648f33a..00000000000 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/VFX/cat-background-light.png.meta +++ /dev/null @@ -1,130 +0,0 @@ -fileFormatVersion: 2 -guid: ccda2131ef139a440a193699457e1561 -TextureImporter: - internalIDToNameTable: [] - externalObjects: {} - serializedVersion: 13 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapsPreserveCoverage: 0 - alphaTestReferenceValue: 0.5 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - flipGreenChannel: 0 - isReadable: 0 - streamingMipmaps: 0 - streamingMipmapsPriority: 0 - vTOnly: 0 - ignoreMipmapLimit: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - serializedVersion: 2 - filterMode: 1 - aniso: 1 - mipBias: 0 - wrapU: 1 - wrapV: 1 - wrapW: 0 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spritePixelsToUnits: 100 - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spriteGenerateFallbackPhysicsShape: 1 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - singleChannelComponent: 0 - flipbookRows: 1 - flipbookColumns: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - ignorePngGamma: 0 - applyGammaDecoding: 1 - swizzle: 50462976 - cookieLightType: 1 - platformSettings: - - serializedVersion: 4 - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: Standalone - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - - serializedVersion: 4 - buildTarget: CloudRendering - maxTextureSize: 2048 - resizeAlgorithm: 0 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - ignorePlatformSupport: 0 - androidETC2FallbackOverride: 0 - forceMaximumCompressionQuality_BC6H_BC7: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - customData: - physicsShape: [] - bones: [] - spriteID: - internalID: 0 - vertices: [] - indices: - edges: [] - weights: [] - secondaryTextures: [] - spriteCustomMetadata: - entries: [] - nameFileIdTable: {} - mipmapLimitGroupName: - pSDRemoveMatte: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss index 78f41cf7ec7..6ebce066842 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VFXFilterWindow.uss @@ -112,6 +112,7 @@ Label { padding: 0; flex-grow: 0; color: var(--unity-colors-default-text); + white-space: pre; } .nodes-label-spacer { diff --git a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss index dacd20e36d0..412c1345012 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss +++ b/Packages/com.unity.visualeffectgraph/Editor/UIResources/uss/VisualEffectAssetEditor.uss @@ -1,12 +1,25 @@ .inspector-header { - -unity-font-style: bold; - margin: 4px 0; - height: 19px; - padding-left: 32px; + margin: 0 -4px 4px 0; + padding: 0 4px 0 15px; -unity-text-align: middle-left; +} + +.inspector-header > .unity-foldout__toggle { + margin: 0 0px 4px -15px; + padding-left: 4px; + height: 21px; border-width: 1px 0 0 0; border-color: var(--unity-colors-default-border); - background-color: var(--unity-colors-tab-background); + background-color: var(--unity-colors-inspector_titlebar-background); +} + +.inspector-header > .unity-foldout__toggle:hover { + background-color: var(--unity-colors-inspector_titlebar-background-hover); +} + +.inspector-header > .unity-foldout__toggle Label { + margin-left: 16px; + -unity-font-style: bold; } .unity-base-text-field__input--multiline { @@ -14,3 +27,4 @@ max-height: 128px; white-space: normal; } + diff --git a/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs b/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs index b0f061680b8..2bfd029af48 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/VFXAnalytics.cs @@ -123,7 +123,7 @@ public void UpdateGraphData(VFXView view) return; } - var instanceId = view.controller.model.asset.GetInstanceID(); + var instanceId = view.controller.model.asset.GetEntityId(); var graphInfo = openedGraphInfo.SingleOrDefault(x => x.graph_id == instanceId); if (graphInfo.graph_id > 0) { diff --git a/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs b/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs index ef0e7893ee3..2512589d565 100644 --- a/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs +++ b/Packages/com.unity.visualeffectgraph/Editor/VFXAssetEditorUtility.cs @@ -180,7 +180,7 @@ public override void Action(EntityId entityId, string pathName, string resourceF { CreateTemplateAsset(pathName, templatePath); var resource = VisualEffectResource.GetResourceAtPath(pathName); - ProjectWindowUtil.FrameObjectInProjectWindow(resource.asset.GetInstanceID()); + ProjectWindowUtil.FrameObjectInProjectWindow(resource.asset.GetEntityId()); } } @@ -189,7 +189,7 @@ internal class DoCreateNewSubgraphOperator : AssetCreationEndAction public override void Action(EntityId entityId, string pathName, string resourceFile) { var sg = CreateNew(pathName); - ProjectWindowUtil.FrameObjectInProjectWindow(sg.GetInstanceID()); + ProjectWindowUtil.FrameObjectInProjectWindow(sg.GetEntityId()); } } @@ -242,7 +242,7 @@ public static void CreateVisualEffectSubgraph(string fileName, string temp { templateString = System.IO.File.ReadAllText(templatePath + templateName); - ProjectWindowUtil.CreateAssetWithContent(fileName, templateString, texture); + ProjectWindowUtil.CreateAssetWithTextContent(fileName, templateString, texture); } catch (System.Exception e) { diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta index 5f2f864a227..b0ca76ce65f 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/AngularVelocity.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX explains the usage of the Angular velocity attribute that can be used to control particles rotation. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 711415350ba8e734199e4d3ef52f18c6, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta index 762d7261ae4..6a5fb348df8 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BasicTexIndex.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX shows how to set the output settings to use a flipbook and their relationship with the texIndex attribute. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: ec5b3fc4b1b065c48aa4944f0496294a, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta index 7e0e227d529..698da5c8555 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/BoundsGizmo.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: The Bounds are used to cull the VFX when it's not in the camera frustum. This VFX explains the importance of Bounds and how to properly set them. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: ebac51e649dc3cd418ec7486775452ad, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta index cb6ecbc9c66..3dabbdaf593 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Capacity.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'Capacity Count is used for the particle Memory allocation of a system. This VFX explains what capacity is and how to use the VFX Control to set the Capacity. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 4564276fcad6d6c4fba693a4a9552555, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta index 9c36bfe6df3..1dafe3bb6aa 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionAdvanced.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX explains how to use a Signed Distance Field Collider, which can be very useful when you want particles to collide with complex shapes. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 009b7316c3ad821499a08d63c2b179e4, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta index 1d8c6f26d9c..c34177cb1ea 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionBasicProperties.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX Graph, shows the use of a standard Collider Block and how the different Collision Properties like Bounce, Friction and/or Roughness can influence the collision response of the particles. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: c95ee797abda9044db03398c3f647520, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta index f9d040eea26..17ff4eb7ec2 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/CollisionSimple.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX shows some usage of the different collider blocks available to allow particles to collide with simple shapes. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: de6ccea3a4ae74245b8f069b29a51210, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta index c6829b4657e..1fb4defd9b6 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/Context&Flow.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX is intended to provide an overview and basic understanding of how data flow is articulated in VFX Graph. It also presents an overview of the most frequently used Context Blocks. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 7fe3e7cbc6de1f9479895e82ad729e23, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta index 1b3c024a04d..e0c208a5fbb 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/DecalParticles.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This example shows how to leverage the Decal Output to stick and project animated decals onto an animated skinned mesh renderer. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 79996b38f37551f40bad61027b8f1e0b, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta index 1c6e108f7f0..bbd7e318ede 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookBlending.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX illustrates the differences between a traditional frame blending and a frame blending using motion vectors. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 952793e298fc73447af1c50dbaaeae35, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta index 4dbe3496d86..44b2fcc7fad 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/FlipbookMode.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'This VFX shows how to set up the output settings to use a Sprite sheet. It also shows the differences between Flipbook Uvs and Flipbook Blend Uvs and the basic usage of the Flipbook Player Block to animate the texture. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 519de46f323653c4ba92a6e1c1ac56df, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta index 3d520ec41ca..76e4d225d29 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripGPUEvents.vfx.meta @@ -12,7 +12,7 @@ VisualEffectImporter: the creation of one strip per Parent''s particle when dealing with trigger events. Each headphone jack is made of a particle mesh and spawns particles along its path. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 1e7dce32229b8194691947a4f42f7b70, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta index ab5b5c971e2..da894b78188 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripSingleBurst.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make multiple trails with one single burst of particles. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 19ccc7b20971d2948ba209ca9352967d, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta index b29a935f8eb..99d1d43a286 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsPeriodicBurst.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make a new trail for each periodic burst within a single VFX system. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: ae0d422301fa1ef47871f86b8c7f2ad4, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta index f9a355bc1eb..420dd8f51b0 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultiStripsSpawnRate.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make multiple trails out of a continuous spawn rate of particles. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: fe70339a289765e48b1d8950b4737299, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta index 368ddd012c5..0f2b03ed68b 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/MultipleOutputs.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX Graph shows how you can add several outputs to render each particle multiple times. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 1ac2a2a6763112b4ea3929fb00f980ba, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta index 35d6655fc19..434a93207c3 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientAdvanced.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This example shows how to use the Advanced mode of the orient block, which allows you to control how a particle is being oriented. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: fa359bb45eebf334abfc735206cd5e80, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta index 0554ef6b56c..2fc868f602c 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFaceCamera.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX is an example to demonstrate the use of the Orient Block and how to make particles always face the camera's position. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: f3ff69036f241894985f257fb3924148, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta index a82595b247b..7b95c5ea581 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/OrientFixedAxis.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX is an example to demonstrate the use of the Orient Block and to align particles in a specific direction while still facing the camera plane. This mode is often used for rendering particles of grass. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 04febbab5a711e04aa699f6fd56723c8, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta index b9d13a77fa8..260c830f9f4 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAdvanced.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'This VFX gives an example of how to manipulate the pivot of your particle to get interesting motion. This example also demonstrates the ShaderGraph integration and how you can control ShaderGraph through VFX Graph. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 29251384520d95f4fa010437bf43287e, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta index 3d956ddd5c9..aee79c08bb8 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/PivotAttribute.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: The VFX is a basic example to help understand what the particle pivot attribute is and how to manipulate it. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: f297419265452a34ab1ce86a44ca54f4, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta index 754b589acdc..c73eb4848fc 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/RotationAngle.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: It's often really useful to be able to rotate particles. This VFX shows how to rotate particles thanks to the Angle attribute. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 0fb02ec51733f84499bed29bbbb0b51e, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta index 414dd285608..315c57a66c4 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleMesh.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX gives an example of how to sample a Mesh to spawn particles on its surface and inherit its Vertex Color. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: cf5431c245bed834286ccdc9b3fd2622, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta index 548eb50a72b..34ddf48f8fd 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSDF.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: 'This VFX demonstrates how to sample an SDF to have particles crawling on the surface of a mesh. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: a3c11027cf8e8584b96716d5079df100, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta index 9d56a0f5cbf..1c8adb8b1ea 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleSkinnedMesh.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This basic example shows how to sample a Skinned Mesh and spawn particles on its surface. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 57b45e399d8fe394a98a5675906c287d, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta index 9df6053f7a8..a74f2ef70d4 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SampleTexture2D.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX demonstrates how to use the texture2D sample operator to determine the color of particles and perform rejection sampling. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 3d351a536d397c14ab916464f774d4f2, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta index 3b760717125..dce409318db 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/SpawnContext.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: This VFX is intended to provide information related to the Spawn Contex. What is the Spawn Context, what options can be found in the inspector but also extra informations - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 92301f5ec2ae13446a380b57f6d3614f, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta index ace1846b14e..8a8494da4fa 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripGPUEvent.vfx.meta @@ -12,7 +12,7 @@ VisualEffectImporter: strips. This example shows an example of a growing mushroom's VFX, with the mushroom\u2019s hat being particle meshes and the mushroom\u2019s foot made with particle strips." - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 9ffdc5aacc959004da707eadc155e7ef, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta index 9d7f6311331..e141ed3c8ec 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripProperties.vfx.meta @@ -11,7 +11,7 @@ VisualEffectImporter: to draw a quad between each particle. This example demonstrates a straightforward Strip setup. It explains the various strip properties and attributes that control its visual appearance and behavior. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 4dbffa047362c514b908a7a03ae268c0, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta index cbafb150da5..7d1d2483347 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/StripSpawnRate.vfx.meta @@ -10,7 +10,7 @@ VisualEffectImporter: strips, this can have some implications for how you need to set up your VFX. This example shows you how to make a single trail out of a continuous spawn rate of particles. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 2d93269a4dab963498f57d6e5b488bb1, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta index 2b940c2cb78..9f147caf541 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TexIndexAdvanced.vfx.meta @@ -9,7 +9,7 @@ VisualEffectImporter: description: 'This complex VFX is composed of several systems that are playing with the texIndex attribute in a creative way in order to: Control the texIndex thanks to time, noise, and even particle position. ' - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: 80592822edf375347952a1be729773d2, type: 3} userData: assetBundleName: diff --git a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta index c876f71dafb..92d705cc1cb 100644 --- a/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta +++ b/Packages/com.unity.visualeffectgraph/Samples~/VFXLearningTemplates/VFX/TriggerEventCollide.vfx.meta @@ -8,7 +8,7 @@ VisualEffectImporter: category: Learning Templates description: This VFX is displaying an advanced usage of the Trigger on Collide block that allows you to spawn particles when the particle collides. - icon: {fileID: 2800000, guid: 49836be3225b70342b4057f6bf94b554, type: 3} + icon: {fileID: 2800000, guid: ce3ba62f9452ddd4fbadb663ac249d93, type: 3} thumbnail: {fileID: 2800000, guid: af98832125f677e4abbc689a14b778b9, type: 3} userData: assetBundleName: diff --git a/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs b/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs index fc954bf83f2..e2084bb145c 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.brg/Scripts/RenderBRG.cs @@ -117,7 +117,6 @@ public unsafe class RenderBRG : MonoBehaviour private BatchRendererGroup m_BatchRendererGroup; private GraphicsBuffer m_GPUPersistentInstanceData; - private GraphicsBuffer m_Globals; private bool m_initialized; @@ -813,12 +812,6 @@ void Start() m_drawBatches = new NativeList(Allocator.Persistent); m_drawRanges = new NativeList(Allocator.Persistent); - // Fill global data (shared between all batches) - m_Globals = new GraphicsBuffer(GraphicsBuffer.Target.Constant, - 1, - UnsafeUtility.SizeOf()); - m_Globals.SetData(new [] { BatchRendererGroupGlobals.Default }); - m_brgBufferTarget = BatchRendererGroup.BufferTarget; m_instances = new NativeList(1024, Allocator.Persistent); @@ -1167,10 +1160,6 @@ private static void ExtractMatrices( void Update() { - // TODO: Implement delta update for transforms - // https://docs.unity3d.com/ScriptReference/Transform-hasChanged.html - // https://docs.unity3d.com/ScriptReference/Jobs.TransformAccess.html - Shader.SetGlobalConstantBuffer(BatchRendererGroupGlobals.kGlobalsPropertyId, m_Globals, 0, m_Globals.stride); } private void OnDisable() @@ -1182,7 +1171,6 @@ private void OnDisable() if (m_initialized) { m_GPUPersistentInstanceData.Dispose(); - m_Globals.Dispose(); m_renderers.Dispose(); m_pickingIDs.Dispose(); diff --git a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs index 798ea1366fc..d1eda97e573 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.urp/Scripts/Editor/MultipleViewGCTest.cs @@ -4,6 +4,7 @@ using UnityEngine.Profiling; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; +using UnityEngine.TestTools; [TestFixture] public class MultipleViewGCTest : MonoBehaviour @@ -58,6 +59,9 @@ public void TearDown() } [Test] + [UnityPlatform(exclude = new RuntimePlatform[] { + RuntimePlatform.WindowsEditor // Disabled for Instability https://jira.unity3d.com/browse/UUM-125567 + })] public void RenderSceneAndGameView() { Profiler.BeginSample("GC_Alloc_URP_MultipleViews"); diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage new file mode 100644 index 00000000000..890aab574d0 --- /dev/null +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de336b15867e0b4bc642367631c7b5a92fd788137673aeeafe2d0dd0340d2974 +size 8407 diff --git a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/361_UIToolkit_Blending.unity.meta b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage.meta similarity index 74% rename from Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/361_UIToolkit_Blending.unity.meta rename to Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage.meta index b2f02188851..d0e474eaee5 100644 --- a/Tests/SRPTests/Projects/UniversalGraphicsTest_Foundation/Assets/Scenes/361_UIToolkit_Blending.unity.meta +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4ecd08597ff2da342b149c57aa96d35b +guid: 1e6864d5f25f95f40b7b3df2ba067e83 DefaultImporter: externalObjects: {} userData: diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs index 60cb9400ede..18ea4c1b569 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXAdditionalPackageTest.cs @@ -18,6 +18,16 @@ public class VFXAdditionalPackageTest private static readonly string kSampleExpectedPath = "Assets/Samples"; + [Test] + public void ImportSampleDependencies_Reflection_Still_Valid() + { + var packageInfo = PackageManager.PackageInfo.FindForAssetPath(VisualEffectGraphPackageInfo.assetPackagePath); + var sample = Sample.FindByPackage(VisualEffectGraphPackageInfo.name, null).FirstOrDefault(); + Assert.IsNotNull(packageInfo); + Assert.IsNotNull(sample); + VFXTemplateHelperInternal.ImportSampleDependencies(packageInfo, sample); + } + [SerializeField] private string m_CurrentMatch; @@ -55,7 +65,7 @@ public IEnumerator Check_Additional_Doesnt_Generate_Any_Errors([ValueSource(name //Workaround for UUM-63664 var current = matching[0]; { - SampleDependencyImporter.instance.ImportSampleDependencies(searchRequest.Result[0], current); + VFXTemplateHelperInternal.ImportSampleDependencies(searchRequest.Result[0], current); } var result = current.Import(Sample.ImportOptions.HideImportWindow | Sample.ImportOptions.OverridePreviousImports); diff --git a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs index d4c31148281..f53407ba5d7 100644 --- a/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs +++ b/Tests/SRPTests/Packages/com.unity.testing.visualeffectgraph/Tests/Editor/VFXViewWindowTest.cs @@ -8,6 +8,7 @@ using UnityEditor.VFX.UI; using UnityEngine; using UnityEngine.TestTools; +using UnityEngine.UIElements; using UnityEngine.VFX; namespace UnityEditor.VFX.Test @@ -208,5 +209,34 @@ public IEnumerator Repro_CustomHLSL_In_Subgraph() AssetDatabase.SaveAssets(); Assert.IsFalse(EditorUtility.IsDirty(vfxGraph)); } + + [UnityTest, Description("Repro UUM-114261")] + public IEnumerator Switch_SG_And_Name_Updated_In_VFX_Controller() + { + var packagePath = "Packages/com.unity.testing.visualeffectgraph/Tests/Editor/Data/Repro_114261.unitypackage"; + var vfxPath = VFXTestCommon.tempBasePath + "/VFX_114261.vfx"; + var sgUnlitPath = VFXTestCommon.tempBasePath + "/SG_114261_Unlit.shadergraph"; + var sgLitPath = VFXTestCommon.tempBasePath + "/SG_114261_Lit.shadergraph"; + + AssetDatabase.ImportPackageImmediately(packagePath); + + var resource = VisualEffectResource.GetResourceAtPath(vfxPath); + var window = VFXViewWindow.GetWindow(resource, true, true); + window.LoadResource(resource, null); + yield return null; + + var vfxContextUI = window.graphView.GetAllContexts().Single(o => o.controller.model is VFXAbstractComposedParticleOutput); + var subtitle = vfxContextUI.Q