From 4ac846383aa7253a93638557a093586b822405ac Mon Sep 17 00:00:00 2001 From: mriegger Date: Thu, 10 Jun 2021 19:02:08 -0700 Subject: [PATCH] Fixes from feedback --- .../Assets/Shaders/Shadow/DepthExponentiation.azsl | 4 +--- .../Source/Shadows/ProjectedShadowFeatureProcessor.cpp | 2 ++ .../Code/Source/CoreLights/EditorAreaLightComponent.cpp | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/Shadow/DepthExponentiation.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/Shadow/DepthExponentiation.azsl index c212718bf5..1954605656 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/Shadow/DepthExponentiation.azsl +++ b/Gems/Atom/Feature/Common/Assets/Shaders/Shadow/DepthExponentiation.azsl @@ -56,7 +56,6 @@ void MainCS(uint3 dispatchId: SV_DispatchThreadID) return; // Early return if filter is disabled. } - float depth = 0.; switch (o_shadowmapLightType) { case ShadowmapLightType::Directional: @@ -68,7 +67,7 @@ void MainCS(uint3 dispatchId: SV_DispatchThreadID) // and it often causes light bleeding with ESM. // So this converts it to "depth" to emphasize the difference // within the frustum. - depth = (depthInClip - distanceMin) / (1. - distanceMin); + const float depth = (depthInClip - distanceMin) / (1. - distanceMin); // Todo: Expose Esm exponent slider for directional lights // This would remove the exp calculation below, collapsing it into a subtraction in DirectionalLightShadow.azsli @@ -76,7 +75,6 @@ void MainCS(uint3 dispatchId: SV_DispatchThreadID) const float outValue = exp(EsmExponentialShift * depth); PassSrg::m_outputShadowmap[dispatchId].r = outValue; break; - } case ShadowmapLightType::Spot: { diff --git a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp index 98b2fb9574..ac723508c0 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Shadows/ProjectedShadowFeatureProcessor.cpp @@ -162,6 +162,7 @@ namespace AZ::Render void ProjectedShadowFeatureProcessor::SetPcfMethod(ShadowId id, PcfMethod method) { + AZ_Assert(id.IsValid(), "Invalid ShadowId passed to ProjectedShadowFeatureProcessor::SetPcfMethod()."); ShadowData& shadowData = m_shadowData.GetElement(id.GetIndex()); shadowData.m_pcfMethod = method; @@ -170,6 +171,7 @@ namespace AZ::Render void ProjectedShadowFeatureProcessor::SetEsmExponent(ShadowId id, float exponent) { + AZ_Assert(id.IsValid(), "Invalid ShadowId passed to ProjectedShadowFeatureProcessor::SetEsmExponent()."); ShadowData& shadowData = m_shadowData.GetElement(id.GetIndex()); shadowData.m_esmExponent = exponent; m_deviceBufferNeedsUpdate = true; diff --git a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp index 9f6a427bf4..184f64849f 100644 --- a/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp +++ b/Gems/AtomLyIntegration/CommonFeatures/Code/Source/CoreLights/EditorAreaLightComponent.cpp @@ -180,15 +180,14 @@ namespace AZ ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) ->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows) ->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled) - ->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsShadowPcfDisabled) - ->DataElement( + ->DataElement( Edit::UIHandlers::Slider, &AreaLightComponentConfig::m_esmExponent, "Esm Exponent", - "Exponent used by Esm shadows." - "Larger values increase the sharpness of the border between lit and unlit areas.") + "Exponent used by Esm shadows. " + "Larger values increase the sharpness of the border between lit and unlit areas.") ->Attribute(Edit::Attributes::Min, 50.0f) ->Attribute(Edit::Attributes::Max, 5000.0f) ->Attribute(AZ::Edit::Attributes::Decimals, 0) - ->Attribute(AZ::Edit::Attributes::SliderCurveMidpoint, 0.05) + ->Attribute(AZ::Edit::Attributes::SliderCurveMidpoint, 0.05f) ->Attribute(Edit::Attributes::ChangeNotify, Edit::PropertyRefreshLevels::ValuesOnly) ->Attribute(Edit::Attributes::Visibility, &AreaLightComponentConfig::SupportsShadows) ->Attribute(Edit::Attributes::ReadOnly, &AreaLightComponentConfig::IsEsmDisabled)