diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2203_PlanarProbes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2203_PlanarProbes.png index 0d2db277cb8..601cd6483d2 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2203_PlanarProbes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2203_PlanarProbes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c2404848b74f836a33eacaebddf9d39ff9051dcf60e299b96867c320c2c867a -size 199328 +oid sha256:46edac4447cc323137e4d5272afded2ceeb27a8627658aff81ef7656e8aa6f95 +size 202999 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2220_SmoothPlanarReflection.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2220_SmoothPlanarReflection.png index 365bf9ce4b5..05766d1e2b1 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2220_SmoothPlanarReflection.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2220_SmoothPlanarReflection.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28144b01e81901df5ac133426cfca12fa98418e04c3192d810abf2b3bc89ee07 -size 86199 +oid sha256:cbc21e7d732e3aa83de2c20fbf1c83e6211bac1050a76b140c4f58e4e7e7415d +size 72120 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2203_PlanarProbes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2203_PlanarProbes.png index 0d2db277cb8..c282f7b33af 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2203_PlanarProbes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2203_PlanarProbes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c2404848b74f836a33eacaebddf9d39ff9051dcf60e299b96867c320c2c867a -size 199328 +oid sha256:f118ebdc84ed48803ecff7955e148d35a8300e9842362435cb9a17ee2eedead3 +size 202784 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2220_SmoothPlanarReflection.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2220_SmoothPlanarReflection.png index 904536ae9ba..79c13a010f6 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2220_SmoothPlanarReflection.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2220_SmoothPlanarReflection.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bebcd93c19fe39d5be990a4626ef17aec0c426e70ffb5ac86fd7a849c6b77394 -size 74131 +oid sha256:602d4fbb73442e4891115bf378fdd6d59c01053d1b13017c7fba1653292d32c2 +size 72146 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2203_PlanarProbes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2203_PlanarProbes.png index 0d2db277cb8..5a551d8ceec 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2203_PlanarProbes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2203_PlanarProbes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c2404848b74f836a33eacaebddf9d39ff9051dcf60e299b96867c320c2c867a -size 199328 +oid sha256:156252597240686296ccccf0b6114d226893354166f1c5d64cc62f4fd458ce7c +size 202778 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2220_SmoothPlanarReflection.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2220_SmoothPlanarReflection.png index 6e73999ec5c..93c491eae1c 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2220_SmoothPlanarReflection.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2220_SmoothPlanarReflection.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:338814a551aff45c57516d627fddacea9d791db63aa29df6cea0c171af93eb5e -size 86171 +oid sha256:d50bdfaf57c22c8b92e9ae8d4a5344ed9f82d774266c25885319ec693a5d030e +size 72147 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2203_PlanarProbes.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2203_PlanarProbes.png index 0d2db277cb8..48a96810519 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2203_PlanarProbes.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2203_PlanarProbes.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2c2404848b74f836a33eacaebddf9d39ff9051dcf60e299b96867c320c2c867a -size 199328 +oid sha256:166daf5a03ab0b3127c8a1c445b3618a291189d166eb4f2b63547be69cdc20c0 +size 202981 diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2220_SmoothPlanarReflection.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2220_SmoothPlanarReflection.png index 365bf9ce4b5..05766d1e2b1 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2220_SmoothPlanarReflection.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2220_SmoothPlanarReflection.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:28144b01e81901df5ac133426cfca12fa98418e04c3192d810abf2b3bc89ee07 -size 86199 +oid sha256:cbc21e7d732e3aa83de2c20fbf1c83e6211bac1050a76b140c4f58e4e7e7415d +size 72120 diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index e8e77476474..2a5a3cce674 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -42,6 +42,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fixed issue with automatic exposure settings not updating scene view. - Fixed issue with velocity rejection in post-DoF TAA. Fixing this reduces ghosting (case 1304381). - Fixed missing option to use POM on emissive for tessellated shaders. +- Fixed resize IES when already baked in the Atlas 1299233 +- Fixed an issue in the planar reflection probe convolution. +- Fixed Rough Distortion frame setting not greyed out when Distortion is disabled in HDRP Asset +- Fixed ability to override AlphaToMask FrameSetting while camera in deferred lit shader mode +- Fixed issue with physically-based DoF computation and transparent materials with depth-writes ON. +- Fixed issue of accessing default frame setting stored in current HDRPAsset instead fo the default HDRPAsset +- Fixed SSGI frame setting not greyed out while SSGI is disabled in HDRP Asset ### Changed - Updated the tooltip for the Decal Angle Fade property (requires to enable Decal Layers in both HDRP asset and Frame settings) (case 1308048). diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs index 619b407cef6..9694a3fbba0 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/FrameSettingsUI.Drawers.cs @@ -135,7 +135,8 @@ static HDRenderPipelineAsset GetHDRPAssetFor(Editor owner) static FrameSettings GetDefaultFrameSettingsFor(Editor owner) { - HDRenderPipelineAsset hdrpAsset = GetHDRPAssetFor(owner); + HDRenderPipelineAsset hdrpAsset = HDRenderPipeline.defaultAsset; + return owner is IDefaultFrameSettingsType getType ? hdrpAsset.GetDefaultFrameSettings(getType.GetFrameSettingsType()) : hdrpAsset.GetDefaultFrameSettings(FrameSettingsRenderType.Camera); @@ -181,60 +182,27 @@ static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, bool msaaEnablable = hdrpSettings.supportMSAA && ((hdrpAssetSupportForward && (frameSettingsOverrideToForward || defaultForwardUsed)) || hdrpAssetIsForward) && !hdrpSettings.supportRayTracing; area.AmmendInfo(FrameSettingsField.MSAA, overrideable: () => msaaEnablable, - overridedDefaultValue: msaaEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.MSAA), - customOverrideable: () => - { - switch (hdrpSettings.supportedLitShaderMode) - { - case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly: - return false; //negative dependency - case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly: - return true; //negative dependency - case RenderPipelineSettings.SupportedLitShaderMode.Both: - return !(frameSettingsOverrideToForward || defaultForwardUsed); //negative dependency - default: - throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode"); - } - }); + ignoreDependencies: true, + overridedDefaultValue: msaaEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.MSAA)); + + bool msaaIsOff = (msaaEnablable && serialized.GetOverrides(FrameSettingsField.MSAA)) ? !(serialized.IsEnabled(FrameSettingsField.MSAA) ?? false) : !defaultFrameSettings.IsEnabled(FrameSettingsField.MSAA); + area.AmmendInfo(FrameSettingsField.AlphaToMask, + overrideable: () => msaaEnablable && !msaaIsOff, + ignoreDependencies: true, + overridedDefaultValue: msaaEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.AlphaToMask) && !msaaIsOff); bool defaultDeferredUsed = !serialized.GetOverrides(FrameSettingsField.LitShaderMode) && defaultShaderLitMode == LitShaderMode.Deferred; bool depthPrepassEnablable = (hdrpAssetSupportDeferred && (defaultDeferredUsed || frameSettingsOverrideToDeferred)) || (hdrpAssetIsDeferred); area.AmmendInfo(FrameSettingsField.DepthPrepassWithDeferredRendering, overrideable: () => depthPrepassEnablable, - overridedDefaultValue: depthPrepassEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.DepthPrepassWithDeferredRendering), - customOverrideable: () => - { - switch (hdrpSettings.supportedLitShaderMode) - { - case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly: - return false; - case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly: - return true; - case RenderPipelineSettings.SupportedLitShaderMode.Both: - return frameSettingsOverrideToDeferred || defaultDeferredUsed; - default: - throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode"); - } - }); + ignoreDependencies: true, + overridedDefaultValue: depthPrepassEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.DepthPrepassWithDeferredRendering)); bool clearGBufferEnablable = (hdrpAssetSupportDeferred && (defaultDeferredUsed || frameSettingsOverrideToDeferred)) ||(hdrpAssetIsDeferred); area.AmmendInfo(FrameSettingsField.ClearGBuffers, overrideable: () => clearGBufferEnablable, - overridedDefaultValue: clearGBufferEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.ClearGBuffers), - customOverrideable: () => - { - switch (hdrpSettings.supportedLitShaderMode) - { - case RenderPipelineSettings.SupportedLitShaderMode.ForwardOnly: - return false; - case RenderPipelineSettings.SupportedLitShaderMode.DeferredOnly: - return true; - case RenderPipelineSettings.SupportedLitShaderMode.Both: - return frameSettingsOverrideToDeferred || defaultDeferredUsed; - default: - throw new System.ArgumentOutOfRangeException("Unknown ShaderLitMode"); - } - }); + ignoreDependencies: true, + overridedDefaultValue: clearGBufferEnablable && defaultFrameSettings.IsEnabled(FrameSettingsField.ClearGBuffers)); area.AmmendInfo(FrameSettingsField.RayTracing, overrideable: () => hdrpSettings.supportRayTracing); #if !ENABLE_VIRTUALTEXTURES @@ -246,6 +214,7 @@ static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, area.AmmendInfo(FrameSettingsField.Decals, overrideable: () => hdrpSettings.supportDecals); area.AmmendInfo(FrameSettingsField.DecalLayers, overrideable: () => hdrpSettings.supportDecalLayers); area.AmmendInfo(FrameSettingsField.Distortion, overrideable: () => hdrpSettings.supportDistortion); + area.AmmendInfo(FrameSettingsField.RoughDistortion, overrideable: () => hdrpSettings.supportDistortion); area.AmmendInfo(FrameSettingsField.Postprocess, overrideable: () => (frameSettingType != FrameSettingsRenderType.CustomOrBakedReflection && frameSettingType != FrameSettingsRenderType.RealtimeReflection)); @@ -261,14 +230,16 @@ static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.lodBiasQualityLevel.intValue, customSetter: v => serialized.lodBiasQualityLevel.intValue = (int)v, - customOverrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.OverrideQualitySettings, + overrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.OverrideQualitySettings, + ignoreDependencies: true, hasMixedValues: serialized.lodBiasQualityLevel.hasMultipleDifferentValues); area.AmmendInfo(FrameSettingsField.LODBias, overridedDefaultValue: hdrpSettings.lodBias[serialized.lodBiasQualityLevel.intValue], customGetter: () => serialized.lodBias.floatValue, customSetter: v => serialized.lodBias.floatValue = (float)v, - customOverrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.FromQualitySettings, + overrideable: () => serialized.lodBiasMode.GetEnumValue() != LODBiasMode.FromQualitySettings, + ignoreDependencies: true, labelOverride: serialized.lodBiasMode.GetEnumValue() == LODBiasMode.ScaleQualitySettings ? "Scale Factor" : "LOD Bias", hasMixedValues: serialized.lodBias.hasMultipleDifferentValues); @@ -283,14 +254,16 @@ static void Drawer_SectionRenderingSettings(SerializedFrameSettings serialized, overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.maximumLODLevelQualityLevel.intValue, customSetter: v => serialized.maximumLODLevelQualityLevel.intValue = (int)v, - customOverrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.OverrideQualitySettings, + overrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.OverrideQualitySettings, + ignoreDependencies: true, hasMixedValues: serialized.maximumLODLevelQualityLevel.hasMultipleDifferentValues); area.AmmendInfo(FrameSettingsField.MaximumLODLevel, overridedDefaultValue: hdrpSettings.maximumLODLevel[serialized.maximumLODLevelQualityLevel.intValue], customGetter: () => serialized.maximumLODLevel.intValue, customSetter: v => serialized.maximumLODLevel.intValue = (int)v, - customOverrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.FromQualitySettings, + overrideable: () => serialized.maximumLODLevelMode.GetEnumValue() != MaximumLODLevelMode.FromQualitySettings, + ignoreDependencies: true, labelOverride: serialized.maximumLODLevelMode.GetEnumValue() == MaximumLODLevelMode.OffsetQualitySettings ? "Offset Factor" : "Maximum LOD Level", hasMixedValues: serialized.maximumLODLevel.hasMultipleDifferentValues); @@ -322,6 +295,7 @@ static void Drawer_SectionLightingSettings(SerializedFrameSettings serialized, E area.AmmendInfo(FrameSettingsField.SSR, overrideable: () => hdrpSettings.supportSSR); area.AmmendInfo(FrameSettingsField.TransparentSSR, overrideable: () => (hdrpSettings.supportSSR && hdrpSettings.supportSSRTransparent)); area.AmmendInfo(FrameSettingsField.SSAO, overrideable: () => hdrpSettings.supportSSAO); + area.AmmendInfo(FrameSettingsField.SSGI, overrideable: () => hdrpSettings.supportSSGI); // SSS area.AmmendInfo( @@ -334,26 +308,29 @@ static void Drawer_SectionLightingSettings(SerializedFrameSettings serialized, E overridedDefaultValue: SssQualityMode.FromQualitySettings, customGetter: () => serialized.sssQualityMode.GetEnumValue(), customSetter: v => serialized.sssQualityMode.SetEnumValue((SssQualityMode)v), - customOverrideable: () => hdrpSettings.supportSubsurfaceScattering - && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false), + overrideable: () => hdrpSettings.supportSubsurfaceScattering + && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false), + ignoreDependencies: true, hasMixedValues: serialized.sssQualityMode.hasMultipleDifferentValues ); area.AmmendInfo(FrameSettingsField.SssQualityLevel, overridedDefaultValue: ScalableLevel3ForFrameSettingsUIOnly.Low, customGetter: () => (ScalableLevel3ForFrameSettingsUIOnly)serialized.sssQualityLevel.intValue, // 3 levels customSetter: v => serialized.sssQualityLevel.intValue = Math.Max(0, Math.Min((int)v, 2)), // Levels 0-2 - customOverrideable: () => hdrpSettings.supportSubsurfaceScattering - && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) - && (serialized.sssQualityMode.GetEnumValue() == SssQualityMode.FromQualitySettings), + overrideable: () => hdrpSettings.supportSubsurfaceScattering + && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) + && (serialized.sssQualityMode.GetEnumValue() == SssQualityMode.FromQualitySettings), + ignoreDependencies: true, hasMixedValues: serialized.sssQualityLevel.hasMultipleDifferentValues ); area.AmmendInfo(FrameSettingsField.SssCustomSampleBudget, overridedDefaultValue: (int)DefaultSssSampleBudgetForQualityLevel.Low, customGetter: () => serialized.sssCustomSampleBudget.intValue, customSetter: v => serialized.sssCustomSampleBudget.intValue = Math.Max(1, Math.Min((int)v, (int)DefaultSssSampleBudgetForQualityLevel.Max)), - customOverrideable: () => hdrpSettings.supportSubsurfaceScattering - && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) - && (serialized.sssQualityMode.GetEnumValue() != SssQualityMode.FromQualitySettings), + overrideable: () => hdrpSettings.supportSubsurfaceScattering + && (serialized.IsEnabled(FrameSettingsField.SubsurfaceScattering) ?? false) + && (serialized.sssQualityMode.GetEnumValue() != SssQualityMode.FromQualitySettings), + ignoreDependencies: true, hasMixedValues: serialized.sssCustomSampleBudget.hasMultipleDifferentValues ); diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs index d2defc63581..ecbb66a9239 100644 --- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs +++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/OverridableFrameSettingsArea.cs @@ -42,7 +42,7 @@ private struct Field { public FrameSettingsField field; public Func overrideable; - public Func customOverrideable; + public bool ignoreDependencies; public Func customGetter; public Action customSetter; public object overridedDefaultValue; @@ -60,7 +60,7 @@ public bool IsOverrideableWithDependencies(SerializedFrameSettings serialized, F FrameSettingsFieldAttribute attribute = attributes[field]; bool locallyOverrideable = overrideable == null || overrideable(); FrameSettingsField[] dependencies = attribute.dependencies; - if (dependencies == null || !locallyOverrideable) + if (dependencies == null || ignoreDependencies || !locallyOverrideable) return locallyOverrideable; bool dependenciesOverrideable = true; @@ -96,7 +96,7 @@ public static OverridableFrameSettingsArea GetGroupContent(int groupIndex, Frame return area; } - public void AmmendInfo(FrameSettingsField field, Func overrideable = null, Func customGetter = null, Action customSetter = null, object overridedDefaultValue = null, Func customOverrideable = null, string labelOverride = null, bool hasMixedValues = false) + public void AmmendInfo(FrameSettingsField field, Func overrideable = null, bool ignoreDependencies = false, Func customGetter = null, Action customSetter = null, object overridedDefaultValue = null, string labelOverride = null, bool hasMixedValues = false) { var matchIndex = fields.FindIndex(f => f.field == field); @@ -106,8 +106,7 @@ public void AmmendInfo(FrameSettingsField field, Func overrideable = null, var match = fields[matchIndex]; if (overrideable != null) match.overrideable = overrideable; - if (customOverrideable != null) - match.customOverrideable = customOverrideable; + match.ignoreDependencies = ignoreDependencies; if (customGetter != null) match.customGetter = customGetter; if (customSetter != null) @@ -123,9 +122,6 @@ public void AmmendInfo(FrameSettingsField field, Func overrideable = null, static bool EvaluateBoolWithOverride(FrameSettingsField field, Field forField, FrameSettings defaultFrameSettings, SerializedFrameSettings serializedFrameSettings, bool negative) { bool value; - if (forField.customOverrideable != null) - return forField.customOverrideable() ^ negative; - if (serializedFrameSettings.GetOverrides(field)) value = serializedFrameSettings.IsEnabled(field) ?? false; else diff --git a/com.unity.render-pipelines.high-definition/Runtime/Core/Debugging/FrameSettingsFieldAttribute.cs b/com.unity.render-pipelines.high-definition/Runtime/Core/Debugging/FrameSettingsFieldAttribute.cs index 66772a438cf..6030b7d8f31 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Core/Debugging/FrameSettingsFieldAttribute.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Core/Debugging/FrameSettingsFieldAttribute.cs @@ -92,7 +92,13 @@ public FrameSettingsFieldAttribute( int customOrderInGroup = -1) { if (string.IsNullOrEmpty(displayedName)) - displayedName = s_FrameSettingsEnumNameMap[autoName].CamelToPascalCaseWithSpace(); + { + if (!s_FrameSettingsEnumNameMap.TryGetValue(autoName, out displayedName)) + { + displayedName = autoName.ToString(); + } + displayedName = displayedName.CamelToPascalCaseWithSpace(); + } // Editor and Runtime debug menu this.group = group; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs index c9492d274a5..5d1eff6be7b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightCookieManager.cs @@ -347,7 +347,7 @@ public void ReserveSpace(Texture cookieA, Texture cookieB) if (width < k_MinCookieSize || height < k_MinCookieSize) return; - if (!m_CookieAtlas.ReserveSpace(m_CookieAtlas.GetTextureID(cookieA, cookieB), width, height)) + if (!m_CookieAtlas.ReserveSpace(cookieA, cookieB, width, height)) m_2DCookieAtlasNeedsLayouting = true; } @@ -375,7 +375,7 @@ public void ReserveSpaceCube(Texture cookie) if (projectionSize < k_MinCookieSize) return; - if (!m_CookieAtlas.ReserveSpace(m_CookieAtlas.GetTextureID(cookie), projectionSize, projectionSize)) + if (!m_CookieAtlas.ReserveSpace(cookie, projectionSize, projectionSize)) m_2DCookieAtlasNeedsLayouting = true; } @@ -391,7 +391,7 @@ public void ReserveSpaceCube(Texture cookieA, Texture cookieB) if (projectionSize < k_MinCookieSize) return; - if (!m_CookieAtlas.ReserveSpace(m_CookieAtlas.GetTextureID(cookieA, cookieB), projectionSize, projectionSize)) + if (!m_CookieAtlas.ReserveSpace(cookieA, cookieB, projectionSize, projectionSize)) m_2DCookieAtlasNeedsLayouting = true; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute index 5e1122d0926..5c45df12f6b 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/PlanarReflectionFiltering.compute @@ -148,8 +148,8 @@ void DownScale(uint3 dispatchThreadId : SV_DispatchThreadID, uint2 groupThreadId { const int2 tapCoord = currentCoord * 2 + uint2(x, y); // If the pixel is outside the current screen size, its weight becomes zero - float weight = tapCoord.x > _CaptureCurrentScreenSize.x || tapCoord.x < 0 - || tapCoord.y > _CaptureCurrentScreenSize.y || tapCoord.y < 0 ? 0.0 : 1.0; + float weight = tapCoord.x >= _CaptureCurrentScreenSize.x || tapCoord.x < 0 + || tapCoord.y >= _CaptureCurrentScreenSize.y || tapCoord.y < 0 ? 0.0 : 1.0; averageColor += LOAD_TEXTURE2D_LOD(_ReflectionColorMipChain, tapCoord, _SourceMipIndex).xyz * weight; sumW += weight; } diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs index a430eb67685..ae75ca5c2b9 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.RenderGraph.cs @@ -573,10 +573,10 @@ TextureHandle DepthOfFieldPass(RenderGraph renderGraph, HDCamera hdCamera, Textu { colorFormat = m_ColorFormat, useMipMap = true, enableRandomWrite = true, name = "DoF Source Pyramid" }); builder.SetRenderFunc( - (DepthofFieldData data, RenderGraphContext ctx) => - { - DoPhysicallyBasedDepthOfField(data.parameters, ctx.cmd, data.source, data.destination, data.fullresCoC, data.prevCoC, data.nextCoC, data.motionVecTexture, data.pingFarRGB, data.taaEnabled); - }); + (DepthofFieldData data, RenderGraphContext ctx) => + { + DoPhysicallyBasedDepthOfField(data.parameters, ctx.cmd, data.source, data.destination, data.fullresCoC, data.prevCoC, data.nextCoC, data.motionVecTexture, data.pingFarRGB, data.depthBuffer, data.taaEnabled); + }); source = passData.destination; m_HDInstance.PushFullScreenDebugTexture(renderGraph, passData.fullresCoC, FullScreenDebugMode.DepthOfFieldCoc); diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs index 38119e7e393..10645bbcc37 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs @@ -707,7 +707,7 @@ void PoolSource(ref RTHandle src, RTHandle dst) var fullresCoC = m_Pool.Get(Vector2.one, k_CoCFormat, true); var colorPyramid = m_Pool.Get(Vector2.one, m_ColorFormat, true); - DoPhysicallyBasedDepthOfField(dofParameters, cmd, source, destination, fullresCoC, prevCoC, nextCoC, motionVecTexture, colorPyramid, taaEnabled); + DoPhysicallyBasedDepthOfField(dofParameters, cmd, source, destination, fullresCoC, prevCoC, nextCoC, motionVecTexture, colorPyramid, depthBuffer, taaEnabled); m_Pool.Recycle(fullresCoC); m_Pool.Recycle(colorPyramid); @@ -2565,7 +2565,7 @@ static void GetMipMapDimensions(RTHandle texture, int lod, out int width, out in } } - static void DoPhysicallyBasedDepthOfField(in DepthOfFieldParameters dofParameters, CommandBuffer cmd, RTHandle source, RTHandle destination, RTHandle fullresCoC, RTHandle prevCoCHistory, RTHandle nextCoCHistory, RTHandle motionVecTexture, RTHandle sourcePyramid, bool taaEnabled) + static void DoPhysicallyBasedDepthOfField(in DepthOfFieldParameters dofParameters, CommandBuffer cmd, RTHandle source, RTHandle destination, RTHandle fullresCoC, RTHandle prevCoCHistory, RTHandle nextCoCHistory, RTHandle motionVecTexture, RTHandle sourcePyramid, RTHandle depthBuffer, bool taaEnabled) { float scale = 1f / (float)dofParameters.resolution; int targetWidth = Mathf.RoundToInt(dofParameters.camera.actualWidth * scale); @@ -2616,6 +2616,7 @@ static void DoPhysicallyBasedDepthOfField(in DepthOfFieldParameters dofParameter cmd.SetComputeVectorParam(cs, HDShaderIDs._Params2, new Vector4(dofParameters.nearMaxBlur, dofParameters.farMaxBlur, 0, 0)); } + cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._CameraDepthTexture, depthBuffer); cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._OutputTexture, fullresCoC); cmd.DispatchCompute(cs, kernel, (dofParameters.camera.actualWidth + 7) / 8, (dofParameters.camera.actualHeight + 7) / 8, dofParameters.camera.viewCount); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl index aa37274b7b9..8ce553b35c6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingIntersection.hlsl @@ -2,7 +2,7 @@ #define UNITY_RAYTRACING_INTERSECTION_INCLUDED // Engine includes -#include "UnityRaytracingMeshUtils.cginc" +#include "UnityRayTracingMeshUtils.cginc" // Raycone structure that defines the stateof the ray struct RayCone diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs index 19c8bf945a2..a763c07bb42 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettings.cs @@ -103,7 +103,7 @@ public enum FrameSettingsField [FrameSettingsField(0, displayedName: "MSAA within Forward", negativeDependencies: new[] { LitShaderMode }, customOrderInGroup: 3, tooltip: "When enabled, Cameras using these Frame Settings calculate MSAA when they render the Scene. Set Lit Shader Mode to Forward to access this option.")] MSAA = 31, /// When enabled, Cameras using these Frame Settings use Alpha To Mask. Activate MSAA to access this option. - [FrameSettingsField(0, displayedName: "Alpha To Mask", positiveDependencies: new[] { MSAA }, customOrderInGroup: 3, tooltip: "When enabled, Cameras using these Frame Settings use Alpha To Mask. Activate MSAA to access this option.")] + [FrameSettingsField(0, displayedName: "Alpha To Mask", negativeDependencies: new[] { LitShaderMode }, positiveDependencies: new[] { MSAA }, customOrderInGroup: 3, tooltip: "When enabled, Cameras using these Frame Settings use Alpha To Mask. Activate MSAA to access this option.")] AlphaToMask = 56, /// When enabled, Cameras using these Frame Settings render opaque GameObjects. [FrameSettingsField(0, autoName: OpaqueObjects, customOrderInGroup: 4, tooltip: "When enabled, Cameras using these Frame Settings render opaque GameObjects.")] @@ -984,14 +984,16 @@ public DebuggerGroup[] Keys var attributes = new Dictionary(); var groups = new List(); + Dictionary frameSettingsEnumNameMap = FrameSettingsFieldAttribute.GetEnumNameMap(); Type type = typeof(FrameSettingsField); var noAttribute = new List(); - foreach (FrameSettingsField value in Enum.GetValues(type)) + foreach (FrameSettingsField enumVal in frameSettingsEnumNameMap.Keys) { - attributes[value] = type.GetField(Enum.GetName(type, value)).GetCustomAttribute(); - if (attributes[value] == null) - noAttribute.Add(value); + attributes[enumVal] = type.GetField(frameSettingsEnumNameMap[enumVal]).GetCustomAttribute(); + if (attributes[enumVal] == null) + noAttribute.Add(enumVal); } + var groupIndexes = attributes.Values.Where(a => a != null).Select(a => a.group).Distinct(); foreach (int groupIndex in groupIndexes) groups.Add(new DebuggerGroup(FrameSettingsHistory.foldoutNames[groupIndex], attributes?.Where(pair => pair.Value?.group == groupIndex)?.OrderBy(pair => pair.Value.orderInGroup).Select(kvp => new DebuggerEntry(Enum.GetName(typeof(FrameSettingsField), kvp.Key), m_FrameSettings.bitDatas[(uint)kvp.Key])).ToArray())); diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsHistory.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsHistory.cs index 37957e30b7d..569514887cd 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsHistory.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Settings/FrameSettingsHistory.cs @@ -108,10 +108,11 @@ static FrameSettingsHistory() { attributes = new Dictionary(); attributesGroup = new Dictionary>>(); + Dictionary frameSettingsEnumNameMap = FrameSettingsFieldAttribute.GetEnumNameMap(); Type type = typeof(FrameSettingsField); - foreach (FrameSettingsField value in Enum.GetValues(type)) + foreach (FrameSettingsField enumVal in frameSettingsEnumNameMap.Keys) { - attributes[value] = type.GetField(Enum.GetName(type, value)).GetCustomAttribute(); + attributes[enumVal] = type.GetField(frameSettingsEnumNameMap[enumVal]).GetCustomAttribute(); } } /// Same than FrameSettings.AggregateFrameSettings but keep history of agregation in a collection for DebugMenu. diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/PowerOfTwoTextureAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/PowerOfTwoTextureAtlas.cs index 4d7e0830bc5..93278574b62 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/PowerOfTwoTextureAtlas.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/PowerOfTwoTextureAtlas.cs @@ -191,26 +191,24 @@ public override bool AllocateTexture(CommandBuffer cmd, ref Vector4 scaleOffset, public void ResetRequestedTexture() => m_RequestedTextures.Clear(); - public bool ReserveSpace(Texture texture) - { - m_RequestedTextures[texture.GetInstanceID()] = new Vector2Int(texture.width, texture.height); + public bool ReserveSpace(Texture texture) => ReserveSpace(texture, texture.width, texture.height); - // new texture - if (!IsCached(out _, texture)) - { - Vector4 scaleBias = Vector4.zero; - if (!AllocateTextureWithoutBlit(texture, texture.width, texture.height, ref scaleBias)) - return false; - } - return true; - } + public bool ReserveSpace(Texture texture, int width, int height) + => ReserveSpace(GetTextureID(texture), width, height); + + // pass width and height for CubeMap (use 2*width) & Texture2D (use width) + public bool ReserveSpace(Texture textureA, Texture textureB, int width, int height) + => ReserveSpace(GetTextureID(textureA, textureB), width, height); - public bool ReserveSpace(int id, int width, int height) + bool ReserveSpace(int id, int width, int height) { m_RequestedTextures[id] = new Vector2Int(width, height); - // new texture - if (!IsCached(out _, id)) + // Cookie texture resolution changing between frame is a special case, so we handle it here. + // The texture will be re-allocated and may cause holes in the atlas texture, which is fine + // because when it doesn't have any more space, it will re-layout the texture correctly. + var cachedSize = GetCachedTextureSize(id); + if (!IsCached(out _, id) || cachedSize.x != width || cachedSize.y != height) { Vector4 scaleBias = Vector4.zero; if (!AllocateTextureWithoutBlit(id, width, height, ref scaleBias)) diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture2DAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture2DAtlas.cs index 5fac496f1f7..2eb683fcb4e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture2DAtlas.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Utility/Texture2DAtlas.cs @@ -140,7 +140,7 @@ class Texture2DAtlas protected bool m_UseMipMaps; protected GraphicsFormat m_Format; private AtlasAllocator m_AtlasAllocator = null; - private Dictionary m_AllocationCache = new Dictionary(); + private Dictionary m_AllocationCache = new Dictionary(); private Dictionary m_IsGPUTextureUpToDate = new Dictionary(); private Dictionary m_TextureHashes = new Dictionary(); @@ -289,7 +289,7 @@ public virtual bool AllocateTextureWithoutBlit(int instanceId, int width, int he if (m_AtlasAllocator.Allocate(ref scaleOffset, width, height)) { scaleOffset.Scale(new Vector4(1.0f / m_Width, 1.0f / m_Height, 1.0f / m_Width, 1.0f / m_Height)); - m_AllocationCache.Add(instanceId, scaleOffset); + m_AllocationCache[instanceId] = (scaleOffset, new Vector2Int(width, height)); MarkGPUTextureInvalid(instanceId); // the texture data haven't been uploaded m_TextureHashes[instanceId] = -1; return true; @@ -346,7 +346,17 @@ public bool IsCached(out Vector4 scaleOffset, Texture texture) => IsCached(out scaleOffset, GetTextureID(texture)); public bool IsCached(out Vector4 scaleOffset, int id) - => m_AllocationCache.TryGetValue(id, out scaleOffset); + { + bool cached = m_AllocationCache.TryGetValue(id, out var value); + scaleOffset = value.scaleOffset; + return cached; + } + + public Vector2Int GetCachedTextureSize(int id) + { + m_AllocationCache.TryGetValue(id, out var value); + return value.size; + } public virtual bool NeedsUpdate(Texture texture, bool needMips = false) { @@ -470,11 +480,16 @@ public virtual bool UpdateTexture(CommandBuffer cmd, Texture texture, ref Vector internal bool EnsureTextureSlot(out bool isUploadNeeded, ref Vector4 scaleBias, int key, int width, int height) { isUploadNeeded = false; - if (m_AllocationCache.TryGetValue(key, out scaleBias)) { return true; } - if (!m_AtlasAllocator.Allocate(ref scaleBias, width, height)) { return false; } + if (m_AllocationCache.TryGetValue(key, out var value)) + { + scaleBias = value.scaleOffset; + return true; + } + if (!m_AtlasAllocator.Allocate(ref scaleBias, width, height)) + return false; isUploadNeeded = true; scaleBias.Scale(new Vector4(1.0f / m_Width, 1.0f / m_Height, 1.0f / m_Width, 1.0f / m_Height)); - m_AllocationCache.Add(key, scaleBias); + m_AllocationCache.Add(key, (scaleBias, new Vector2Int(width, height))); return true; } }