From 073092fd7f7e3705cb72e68432982dc47bd3fb9d Mon Sep 17 00:00:00 2001 From: sebastienlagarde Date: Fri, 7 May 2021 13:25:30 +0200 Subject: [PATCH] [HDRP] Add missing very high quality shadow component --- .../Editor/Lighting/HDLightUI.cs | 7 ++++--- .../Runtime/Lighting/Light/HDAdditionalLightData.cs | 2 +- .../Runtime/Lighting/Shadow/HDShadowManager.cs | 4 ++++ .../Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs index a4189d81794..49a974f32c7 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -110,6 +110,8 @@ static HDLightUI() CED.AdditionalPropertiesFoldoutGroup(s_Styles.shadowMapSubHeader, Expandable.ShadowMap, k_ExpandedState, AdditionalProperties.Shadow, k_AdditionalPropertiesState, DrawShadowMapContent, DrawShadowMapAdditionalContent, FoldoutOption.SubFoldout | FoldoutOption.Indent | FoldoutOption.NoSpaceAtEnd)), CED.space, + CED.Conditional((serialized, owner) => k_AdditionalPropertiesState[AdditionalProperties.Shadow] && HasShadowQualitySettingsUI(HDShadowFilteringQuality.VeryHigh, serialized, owner), + CED.FoldoutGroup(s_Styles.veryHighShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawVeryHighShadowSettingsContent)), CED.Conditional((serialized, owner) => k_AdditionalPropertiesState[AdditionalProperties.Shadow] && HasShadowQualitySettingsUI(HDShadowFilteringQuality.High, serialized, owner), CED.FoldoutGroup(s_Styles.highShadowQualitySubHeader, Expandable.ShadowQuality, k_ExpandedState, FoldoutOption.SubFoldout | FoldoutOption.Indent, DrawHighShadowSettingsContent)), CED.Conditional((serialized, owner) => HasShadowQualitySettingsUI(HDShadowFilteringQuality.Medium, serialized, owner), @@ -1339,9 +1341,8 @@ static void DrawHighShadowSettingsContent(SerializedHDLight serialized, Editor o static void DrawVeryHighShadowSettingsContent(SerializedHDLight serialized, Editor owner) { - EditorGUILayout.PropertyField(serialized.kernelSize, s_Styles.kernelSize); - EditorGUILayout.PropertyField(serialized.lightAngle, s_Styles.lightAngle); - EditorGUILayout.PropertyField(serialized.maxDepthBias, s_Styles.maxDepthBias); + // Same as high for now (PCSS) + DrawHighShadowSettingsContent(serialized, owner); } static void SetLightsDirty(Editor owner) diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs index 6cf522b285c..890d31eecd6 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs @@ -2377,7 +2377,7 @@ void SetCommonShadowRequestSettings(HDShadowRequest shadowRequest, VisibleLight // This base bias is a good value if we expose a [0..1] since values within [0..5] are empirically shown to be sensible for the slope-scale bias with the width of our PCF. float baseBias = 5.0f; // If we are PCSS, the blur radius can be quite big, hence we need to tweak up the slope bias - if (filteringQuality == HDShadowFilteringQuality.High) + if (filteringQuality == HDShadowFilteringQuality.High || filteringQuality == HDShadowFilteringQuality.VeryHigh) { if (softness > 0.01f) { diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs index 9657df93e30..ac23b0330af 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowManager.cs @@ -438,6 +438,10 @@ public static DirectionalShadowAlgorithm GetDirectionalShadowAlgorithm() { return DirectionalShadowAlgorithm.PCSS; } + case HDShadowFilteringQuality.VeryHigh: + { + return DirectionalShadowAlgorithm.PCSS; + } } ; return DirectionalShadowAlgorithm.PCF5x5; diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs index 14007e944a0..c856e699449 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs @@ -234,6 +234,9 @@ void InitializeScreenSpaceShadows() case HDShadowFilteringQuality.High: s_ScreenSpaceShadowsMat.EnableKeyword("SHADOW_HIGH"); break; + case HDShadowFilteringQuality.VeryHigh: + s_ScreenSpaceShadowsMat.EnableKeyword("SHADOW_VERY_HIGH"); + break; default: s_ScreenSpaceShadowsMat.EnableKeyword("SHADOW_MEDIUM"); break;