From 7d0fc036745b20222c617aa4bb93255dccd241b5 Mon Sep 17 00:00:00 2001 From: mriegger Date: Mon, 24 May 2021 17:13:14 -0700 Subject: [PATCH 1/2] Fixing spelling in lua files --- .../Materials/Types/StandardMultilayerPBR_ShaderEnable.lua | 4 ++-- .../Assets/Materials/Types/StandardPBR_ShaderEnable.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ShaderEnable.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ShaderEnable.lua index 69df610ab2..778edeea18 100644 --- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ShaderEnable.lua +++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardMultilayerPBR_ShaderEnable.lua @@ -24,7 +24,7 @@ function Process(context) local shadowMap = context:GetShaderByTag("Shadowmap") local forwardPassEDS = context:GetShaderByTag("ForwardPass_EDS") local depthPassWithPS = context:GetShaderByTag("DepthPass_WithPS") - local shadowMapWitPS = context:GetShaderByTag("Shadowmap_WithPS") + local shadowMapWithPS = context:GetShaderByTag("Shadowmap_WithPS") local forwardPass = context:GetShaderByTag("ForwardPass") local shadingAffectsDepth = parallaxEnabled and parallaxPdoEnabled; @@ -34,6 +34,6 @@ function Process(context) forwardPassEDS:SetEnabled(not shadingAffectsDepth) depthPassWithPS:SetEnabled(shadingAffectsDepth) - shadowMapWitPS:SetEnabled(shadingAffectsDepth) + shadowMapWithPS:SetEnabled(shadingAffectsDepth) forwardPass:SetEnabled(shadingAffectsDepth) end diff --git a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua index 2733713122..e502eb38f8 100644 --- a/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua +++ b/Gems/Atom/Feature/Common/Assets/Materials/Types/StandardPBR_ShaderEnable.lua @@ -32,7 +32,7 @@ function Process(context) local lowEndForwardEDS = context:GetShaderByTag("LowEndForward_EDS") local depthPassWithPS = context:GetShaderByTag("DepthPass_WithPS") - local shadowMapWitPS = context:GetShaderByTag("Shadowmap_WithPS") + local shadowMapWithPS = context:GetShaderByTag("Shadowmap_WithPS") local forwardPass = context:GetShaderByTag("ForwardPass") local lowEndForward = context:GetShaderByTag("LowEndForward") @@ -43,7 +43,7 @@ function Process(context) lowEndForwardEDS:SetEnabled(false) depthPassWithPS:SetEnabled(true) - shadowMapWitPS:SetEnabled(true) + shadowMapWithPS:SetEnabled(true) forwardPass:SetEnabled(true) lowEndForward:SetEnabled(true) else @@ -53,7 +53,7 @@ function Process(context) lowEndForwardEDS:SetEnabled((opacityMode == OpacityMode_Opaque) or (opacityMode == OpacityMode_Blended) or (opacityMode == OpacityMode_TintedTransparent)) depthPassWithPS:SetEnabled(opacityMode == OpacityMode_Cutout) - shadowMapWitPS:SetEnabled(opacityMode == OpacityMode_Cutout) + shadowMapWithPS:SetEnabled(opacityMode == OpacityMode_Cutout) forwardPass:SetEnabled(opacityMode == OpacityMode_Cutout) lowEndForward:SetEnabled(opacityMode == OpacityMode_Cutout) end From 14513af1fe035eb59d150b9a7057563a8c37cc34 Mon Sep 17 00:00:00 2001 From: mriegger Date: Tue, 25 May 2021 08:48:18 -0700 Subject: [PATCH 2/2] Fix for lowend pipeline not having shadows (needed update call) --- .../CoreLights/DirectionalLightFeatureProcessor.cpp | 12 +++++++++++- .../CoreLights/DirectionalLightFeatureProcessor.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) 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