From b3f1a4655934c63b9e6c380a8e5198c707dc0ea6 Mon Sep 17 00:00:00 2001 From: mrieggeramzn Date: Thu, 19 Aug 2021 15:03:24 -0700 Subject: [PATCH] Fixing the softening boundary width editor options Signed-off-by: mrieggeramzn --- .../CoreLights/AreaLightComponentConfig.h | 3 +++ .../CoreLights/DirectionalLightComponentConfig.h | 2 ++ .../CoreLights/AreaLightComponentConfig.cpp | 11 +++++++++++ .../DirectionalLightComponentConfig.cpp | 16 ++++++++++++++++ .../CoreLights/EditorAreaLightComponent.cpp | 2 +- .../EditorDirectionalLightComponent.cpp | 2 +- 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h index b890b3e264..74eb10fdb6 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/AreaLightComponentConfig.h @@ -124,6 +124,9 @@ namespace AZ //! Returns true if exponential shadow maps are disabled. bool IsEsmDisabled() const; + + //! Returns true if the softening boundary width parameter is disabled. + bool IsSofteningBoundaryWidthDisabled() const; }; } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h index 562750acd5..e7fe692213 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Include/AtomLyIntegration/CommonFeatures/CoreLights/DirectionalLightComponentConfig.h @@ -121,6 +121,8 @@ namespace AZ bool IsShadowFilteringDisabled() const; bool IsShadowPcfDisabled() const; bool IsPcfBoundarySearchDisabled() const; + bool IsSofteningBoundaryWidthDisabled() const; + bool IsEsmDisabled() const; }; } // namespace Render } // namespace AZ diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentConfig.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentConfig.cpp index b9da5ccff4..550a09469f 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentConfig.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/AreaLightComponentConfig.cpp @@ -197,5 +197,16 @@ namespace AZ return !(m_shadowFilterMethod == ShadowFilterMethod::Esm || m_shadowFilterMethod == ShadowFilterMethod::EsmPcf); } + bool AreaLightComponentConfig::IsSofteningBoundaryWidthDisabled() const + { + // softening boundary width is always available with ESM. It controls the width of the blur kernel during the ESM gaussian + // blur passes + if (!IsEsmDisabled()) + return false; + + // with PCF, softening boundary width is used with the boundary search method and NOT the bicubic pcf methods + return IsPcfBoundarySearchDisabled(); + } + } } diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentConfig.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentConfig.cpp index 4e700927e9..86fb97aeba 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentConfig.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/DirectionalLightComponentConfig.cpp @@ -128,5 +128,21 @@ namespace AZ return m_pcfMethod != PcfMethod::BoundarySearch; } + bool DirectionalLightComponentConfig::IsEsmDisabled() const + { + return !(m_shadowFilterMethod == ShadowFilterMethod::Esm || m_shadowFilterMethod == ShadowFilterMethod::EsmPcf); + } + + bool DirectionalLightComponentConfig::IsSofteningBoundaryWidthDisabled() const + { + // softening boundary width is always available with ESM. It controls the width of the blur kernel during the ESM gaussian + // blur passes + if (!IsEsmDisabled()) + return false; + + // with PCF, softening boundary width is used with the boundary search method and NOT the bicubic pcf methods + return IsPcfBoundarySearchDisabled(); + } + } // namespace Render } // namespace AZ diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp index e45f460f18..17fb9a5e1d 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp @@ -162,7 +162,7 @@ namespace AZ ->Attribute(Edit::Attributes::Max, 1.f) ->Attribute(Edit::Attributes::Suffix, " deg") ->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows) - ->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsPcfBoundarySearchDisabled) + ->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsSofteningBoundaryWidthDisabled) ->DataElement(Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_predictionSampleCount, "Prediction sample count", "Sample count for prediction of whether the pixel is on the boundary. Specific to PCF and ESM+PCF.") ->Attribute(Edit::Attributes::Min, 4) diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp index dced9314b7..9f0e06f203 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorDirectionalLightComponent.cpp @@ -141,7 +141,7 @@ namespace AZ ->Attribute(Edit::Attributes::Max, 0.1f) ->Attribute(Edit::Attributes::Suffix, " m") ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) - ->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsPcfBoundarySearchDisabled) + ->Attribute(Edit::Attributes::ReadOnly, &DirectionalLightComponentConfig::IsSofteningBoundaryWidthDisabled) ->DataElement(Edit::UIHandlers::Slider, &DirectionalLightComponentConfig::m_predictionSampleCount, "Prediction sample count", "Sample count for prediction of whether the pixel is on the boundary. " "Specific to PCF and ESM+PCF.")