diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index ade4b5b592..9b40097716 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -203,7 +203,7 @@ namespace AZ if (m_shadowingLightHandle.IsValid()) { uint32_t shadowFilterMethod = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_shadowFilterMethod; - RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(AZ::Name{"o_directional_shadow_filtering_method"}, AZ::RPI::ShaderOptionValue{shadowFilterMethod}); + RPI::ShaderSystemInterface::Get()->SetGlobalShaderOption(m_directionalShadowFilteringMethodName, AZ::RPI::ShaderOptionValue{shadowFilterMethod}); const uint32_t cascadeCount = m_shadowData.at(nullptr).GetData(m_shadowingLightHandle.GetIndex()).m_cascadeCount; ShadowProperty& property = m_shadowProperties.GetData(m_shadowingLightHandle.GetIndex()); @@ -656,6 +656,7 @@ namespace AZ CacheRenderPipelineIdsForPersistentView(); SetConfigurationToPasses(); SetCameraViewNameToPass(); + UpdateViewsOfCascadeSegments(); } void DirectionalLightFeatureProcessor::CacheCascadedShadowmapsPass() { @@ -1344,6 +1345,15 @@ namespace AZ } } + void DirectionalLightFeatureProcessor::UpdateViewsOfCascadeSegments() + { + if (m_shadowingLightHandle.IsValid()) + { + const uint16_t cascadeCount = GetCascadeCount(m_shadowingLightHandle); + UpdateViewsOfCascadeSegments(m_shadowingLightHandle, cascadeCount); + } + } + Aabb DirectionalLightFeatureProcessor::CalculateShadowViewAabb( LightHandle handle, const RPI::View* cameraView, diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.h b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.h index a276ea3f3e..f8c00c859c 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.h +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.h @@ -296,6 +296,8 @@ namespace AZ //! This updates the shadowmap view. void UpdateShadowmapViews(LightHandle handle); + void UpdateViewsOfCascadeSegments(); + //! This calculate shadow view AABB. Aabb CalculateShadowViewAabb( LightHandle handle, @@ -372,6 +374,7 @@ namespace AZ uint32_t m_shadowmapIndexTableBufferNameIndex = 0; Name m_lightTypeName = Name("directional"); + Name m_directionalShadowFilteringMethodName = Name("o_directional_shadow_filtering_method"); static constexpr const char* FeatureProcessorName = "DirectionalLightFeatureProcessor"; }; } // namespace Render