diff --git a/Source/Engine/Graphics/Graphics.cpp b/Source/Engine/Graphics/Graphics.cpp index 489299714..a1640c0b4 100644 --- a/Source/Engine/Graphics/Graphics.cpp +++ b/Source/Engine/Graphics/Graphics.cpp @@ -18,6 +18,7 @@ Quality Graphics::SSAOQuality = Quality::Medium; Quality Graphics::VolumetricFogQuality = Quality::High; Quality Graphics::ShadowsQuality = Quality::Medium; Quality Graphics::ShadowMapsQuality = Quality::Medium; +float Graphics::ShadowUpdateRate = 1.0f; bool Graphics::AllowCSMBlending = false; Quality Graphics::GlobalSDFQuality = Quality::High; Quality Graphics::GIQuality = Quality::High; diff --git a/Source/Engine/Graphics/Graphics.h b/Source/Engine/Graphics/Graphics.h index 59c5bfd1c..4c5e0ad26 100644 --- a/Source/Engine/Graphics/Graphics.h +++ b/Source/Engine/Graphics/Graphics.h @@ -48,6 +48,11 @@ public: /// API_FIELD() static Quality ShadowMapsQuality; + /// + /// The global scale for all shadow maps update rate. Can be used to slow down shadows rendering frequency on lower quality settings or low-end platforms. Default 1. + /// + API_FIELD() static float ShadowUpdateRate; + /// /// Enables cascades splits blending for directional light shadows. /// [Deprecated in v1.9] diff --git a/Source/Engine/Renderer/ShadowsPass.cpp b/Source/Engine/Renderer/ShadowsPass.cpp index 9b65e9c3e..b98dd9999 100644 --- a/Source/Engine/Renderer/ShadowsPass.cpp +++ b/Source/Engine/Renderer/ShadowsPass.cpp @@ -224,7 +224,7 @@ struct ShadowAtlasLight const float shadowsUpdateRate = light.ShadowsUpdateRate; const float shadowsUpdateRateAtDistance = shadowsUpdateRate * light.ShadowsUpdateRateAtDistance; float updateRate = Math::Lerp(shadowsUpdateRate, shadowsUpdateRateAtDistance, Math::Saturate(distanceFromView / Distance)); - // TODO: add global shadows update rate scale to be adjusted per-platform + updateRate *= Graphics::ShadowUpdateRate; freezeUpdate = updateRate <= ZeroTolerance; if (freezeUpdate) return 0.0f;