diff --git a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp index 04175c461f..60bf487de3 100644 --- a/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/CoreLights/DirectionalLightFeatureProcessor.cpp @@ -731,11 +731,12 @@ namespace AZ } } } - + // Remove unnecessary camera views in shadow properties - for (uint16_t lightIndex = 0; lightIndex < aznumeric_cast(m_shadowProperties.GetDataCount()); ++lightIndex) + auto& shadowPropertiesVector = m_shadowProperties.GetDataVector(); + for (ShadowProperty& shadowProperty : shadowPropertiesVector) { - AZStd::unordered_map>& cascades = m_shadowProperties.GetData(lightIndex).m_segments; + auto& cascades = shadowProperty.m_segments; for (auto it = cascades.begin(); it != cascades.end();) { if (AZStd::find(cameraViews.begin(), cameraViews.end(), it->first) != cameraViews.end())