From ed466f6376f2a6bd105c1cf970a554ac7b2e671c Mon Sep 17 00:00:00 2001 From: "adnan.mujkic" Date: Tue, 15 Sep 2026 11:11:50 +0200 Subject: [PATCH] Settings tweaks for better performance --- Config/DefaultEngine.ini | 3 +++ .../Vegetation/MF_WindDirectionAdd.uasset | 4 ++-- Content/Scripts/BP_TimeOfDay.uasset | 4 ++-- Content/UI/OptionsScreen.uasset | 4 ++-- Content/Vegetation/SMF_FlowerRed.uasset | 4 ++-- Content/Vegetation/SMF_FlowerYellow.uasset | 4 ++-- Content/Vegetation/SMF_GrassFoliageNew.uasset | 4 ++-- .../0/8V/LUAATS6M4NHS97CBUGIMYT.uasset | 4 ++-- .../1/KL/OP8Z4H2UJWUNRRUZWFTT6N.uasset | 4 ++-- .../3/HC/8B3IUVFL21S5A7AZXYPDKE.uasset | 4 ++-- .../3/MR/D5JBII8PWTB9TKU2OB88OO.uasset | 4 ++-- .../4/31/3ILPS4P6XVKN4AY6AR9YPY.uasset | 4 ++-- .../5/H3/F81FXBOS8PI369DHMH33TK.uasset | 4 ++-- .../5/ME/36O183J1A9EWZ5VLXJ4FI1.uasset | 4 ++-- .../5/ZZ/QOV2E2OX1QIM6GCD0HLYCH.uasset | 4 ++-- .../8/NW/6PP9E6KBPGMD5Y2ZRSWFDL.uasset | 4 ++-- .../8/U3/IF8UBXCHS290DD2XA11JD5.uasset | 4 ++-- .../A/FP/FKRFVGEJM14C0FQ2PL4URD.uasset | 4 ++-- .../B/JX/B8GD26U4E09IJ6LKJCYJED.uasset | 4 ++-- .../B/S2/W9Y1MY04170LA9NU56DIK9.uasset | 4 ++-- .../D/JS/5YSW3URDY5J8WPQ33I5ZH2.uasset | 4 ++-- .../D/MJ/Q798ERNCOWH3QGCHW6VIM1.uasset | 4 ++-- .../D/W4/NIPFEFVGYJSC7WB142VIEH.uasset | 4 ++-- .../ProjectEleri/Private/TimeOfDayManager.cpp | 18 +++++++++++++++++- Source/ProjectEleri/Public/TimeOfDayManager.h | 17 +++++++++++++++++ 25 files changed, 81 insertions(+), 45 deletions(-) diff --git a/Config/DefaultEngine.ini b/Config/DefaultEngine.ini index f70ea517..9a7d2a9d 100644 --- a/Config/DefaultEngine.ini +++ b/Config/DefaultEngine.ini @@ -165,6 +165,7 @@ r.Lumen.Reflections.HardwareRayTracing.Translucent.Refraction.EnableForProject=F r.Streaming.PoolSize=2048 r.Shadow.CSMCaching=True +r.Shadow.RadiusThreshold=0.04 r.Nanite.ProjectEnabled=False r.Nanite=False @@ -194,6 +195,8 @@ r.VolumetricCloud.ViewRaySampleMaxCount=64 r.DistanceFieldAO=0 r.DistanceFieldShadowing=0 +r.AmbientOcclusionLevels=1 +r.Shadow.CSMCaching=0 [/Script/LinuxTargetPlatform.LinuxTargetSettings] TargetArchitecture=X86_64UnknownLinuxGnu diff --git a/Content/Materials/Vegetation/MF_WindDirectionAdd.uasset b/Content/Materials/Vegetation/MF_WindDirectionAdd.uasset index d996cc65..2a3cbaa4 100644 --- a/Content/Materials/Vegetation/MF_WindDirectionAdd.uasset +++ b/Content/Materials/Vegetation/MF_WindDirectionAdd.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3f7e32cb0f7959ead102c57a4dcbad395a64fac53fa895c2eb195257289a3110 -size 26403 +oid sha256:d21b5d2394d992af7f5cce7b429bc5335b1b25faa5daecf79639061fc5aadb83 +size 27084 diff --git a/Content/Scripts/BP_TimeOfDay.uasset b/Content/Scripts/BP_TimeOfDay.uasset index f9d0a7fd..e02159d1 100644 --- a/Content/Scripts/BP_TimeOfDay.uasset +++ b/Content/Scripts/BP_TimeOfDay.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4fd5931a7f6b038b29e9c368357922bcd921771c4beae00c336623d17b71babb -size 463599 +oid sha256:8c6164451b1645cc92feaafaf18b0d67d8c9f75a8b066959f4aef254af5502c3 +size 462890 diff --git a/Content/UI/OptionsScreen.uasset b/Content/UI/OptionsScreen.uasset index 9b1a7d0a..dbaffd8a 100644 --- a/Content/UI/OptionsScreen.uasset +++ b/Content/UI/OptionsScreen.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f971c08b43551d539296ab4b31d7fc7e0c6723f3bca9712b74135ff9b7690175 -size 1279561 +oid sha256:806a1bd4c853b253fafc2e6c33ed555064110f375de6af2ce06d3cbfe4c1cb11 +size 1278270 diff --git a/Content/Vegetation/SMF_FlowerRed.uasset b/Content/Vegetation/SMF_FlowerRed.uasset index 7926be88..f6486f89 100644 --- a/Content/Vegetation/SMF_FlowerRed.uasset +++ b/Content/Vegetation/SMF_FlowerRed.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dd3f2978dc28ccd7fb632538e66eb85eebe68a96cc703c8fd2e88999f0ee01b7 -size 9107 +oid sha256:398c92447ba3901f81f434d1ca5c623f1f33236ddec2b728c329cfaa3c1d00a7 +size 9529 diff --git a/Content/Vegetation/SMF_FlowerYellow.uasset b/Content/Vegetation/SMF_FlowerYellow.uasset index 4063d97d..188972c8 100644 --- a/Content/Vegetation/SMF_FlowerYellow.uasset +++ b/Content/Vegetation/SMF_FlowerYellow.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7cc653ac0699aa28718df7410a790805ede481877cf247ae8fe406739de09ec7 -size 9523 +oid sha256:64ab0dbe10c95f2aa739b50ff1716afdb7c3c0f0103b56bca2d5b871716a4395 +size 9975 diff --git a/Content/Vegetation/SMF_GrassFoliageNew.uasset b/Content/Vegetation/SMF_GrassFoliageNew.uasset index 98c38ca9..5be57c8a 100644 --- a/Content/Vegetation/SMF_GrassFoliageNew.uasset +++ b/Content/Vegetation/SMF_GrassFoliageNew.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b911e2eda3ef0623fa23e711bc3dbc887b8078bae0e151237a603cbea97f716 -size 9361 +oid sha256:0f045d0666156b22fbfefded22b4fdcc41d992cc83ea09d745b316bbe51e7b92 +size 9605 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/8V/LUAATS6M4NHS97CBUGIMYT.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/8V/LUAATS6M4NHS97CBUGIMYT.uasset index 08b9104f..ca6515d6 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/8V/LUAATS6M4NHS97CBUGIMYT.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/0/8V/LUAATS6M4NHS97CBUGIMYT.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f02cfddd7e48268a4728a5e9ace9fd2a2d7bb2b6ef19485eb033964a34d56a70 -size 10740504 +oid sha256:8cb79c363f2f122c3e4a5a9185842eb496e0abe922a4b33f2f3e9e9fbe32db69 +size 10651744 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/1/KL/OP8Z4H2UJWUNRRUZWFTT6N.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/1/KL/OP8Z4H2UJWUNRRUZWFTT6N.uasset index 89cd774d..922542c9 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/1/KL/OP8Z4H2UJWUNRRUZWFTT6N.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/1/KL/OP8Z4H2UJWUNRRUZWFTT6N.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ef9a85d7cd8fb8335692dc6164ffca71c653f27f39ce30cdededa97f30a276c -size 4168473 +oid sha256:54c83d04ae7c4a73d3cee0d032a06992e560175a0163f195b9bea3bd266bc6e6 +size 4141073 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/HC/8B3IUVFL21S5A7AZXYPDKE.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/HC/8B3IUVFL21S5A7AZXYPDKE.uasset index bdce6492..d168b710 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/HC/8B3IUVFL21S5A7AZXYPDKE.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/HC/8B3IUVFL21S5A7AZXYPDKE.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0fe7de9a903d37a0e0c6107bccdbb0f134d96d988b9640ebd5448a42b85ff4f1 -size 1875543 +oid sha256:cb59cfc28ec787bad68f0da31ca3f59aa153effe0e889ad830abc95b47c29206 +size 1861628 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/MR/D5JBII8PWTB9TKU2OB88OO.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/MR/D5JBII8PWTB9TKU2OB88OO.uasset index 540921a9..5c8811cb 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/MR/D5JBII8PWTB9TKU2OB88OO.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/3/MR/D5JBII8PWTB9TKU2OB88OO.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:603fa886e95b713658b26265d1ba9267931a7e852415740277629b010bcf22d8 -size 4081100 +oid sha256:0d4f153a7b1ebd601a554c809fbf16e1029d4c5b00fb750013d9291b62880cf6 +size 4055414 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/4/31/3ILPS4P6XVKN4AY6AR9YPY.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/4/31/3ILPS4P6XVKN4AY6AR9YPY.uasset index a528d591..d701bd2a 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/4/31/3ILPS4P6XVKN4AY6AR9YPY.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/4/31/3ILPS4P6XVKN4AY6AR9YPY.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ad92e0c26546f1080e4592ec617d51783bf665b2b7dd3c4d508bc92d27c6a31b -size 164858 +oid sha256:644a7a6c8c4df9a606c59b0e1417294179db1e53a90e5a7610b5c2dc10fac23c +size 164470 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/H3/F81FXBOS8PI369DHMH33TK.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/H3/F81FXBOS8PI369DHMH33TK.uasset index e9baa9d5..0f579e2c 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/H3/F81FXBOS8PI369DHMH33TK.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/H3/F81FXBOS8PI369DHMH33TK.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c8e09e2ec2bcdad26abfca5bb8b024bf2f5d7c0ab15275e398c0ff00cd50d6ac -size 522108 +oid sha256:6ef5724330758e3b108d89ba475255ef84556c1698fc9b6a181732c9d95546d6 +size 519208 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ME/36O183J1A9EWZ5VLXJ4FI1.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ME/36O183J1A9EWZ5VLXJ4FI1.uasset index 1ee2d8df..b87a6772 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ME/36O183J1A9EWZ5VLXJ4FI1.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ME/36O183J1A9EWZ5VLXJ4FI1.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:95c5e5c76808fd3d93f39b57b57ee1044ceeffae11a64806155b018ff0270a44 -size 3368318 +oid sha256:f776eaff3e7ede1c0d132be2fcabb0ae2dbd4d3503d0c50d89f49788f356a2bd +size 3343483 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ZZ/QOV2E2OX1QIM6GCD0HLYCH.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ZZ/QOV2E2OX1QIM6GCD0HLYCH.uasset index 2754b5dc..90e8a0bb 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ZZ/QOV2E2OX1QIM6GCD0HLYCH.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/5/ZZ/QOV2E2OX1QIM6GCD0HLYCH.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:aa8fa26fea9d6f658985de9326fb6839c87a36546483a06c1929124e9b4f4c54 -size 6577854 +oid sha256:310bb6492df6c5de1a709c508e4ba7e61533dc5a7bd383ad2ff87387ce8e0c95 +size 6527667 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/NW/6PP9E6KBPGMD5Y2ZRSWFDL.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/NW/6PP9E6KBPGMD5Y2ZRSWFDL.uasset index 2605daa8..78affc59 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/NW/6PP9E6KBPGMD5Y2ZRSWFDL.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/NW/6PP9E6KBPGMD5Y2ZRSWFDL.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0737382cc778968b73728a04fe38b83494a32f863cb455523a3091b667a53dd -size 4429075 +oid sha256:fd1177887a18d29e51f6ccb2810177d946d495b469216ee55e10af8a2338acad +size 4402807 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/U3/IF8UBXCHS290DD2XA11JD5.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/U3/IF8UBXCHS290DD2XA11JD5.uasset index 8b3684bd..a8da2848 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/U3/IF8UBXCHS290DD2XA11JD5.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/8/U3/IF8UBXCHS290DD2XA11JD5.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:224fd1691f2f851186d9394dc9b265e45395dbe7f5eeae11f2465b3fad50b4e0 -size 798748 +oid sha256:f7d39c57abfeac20d5d058e5ae6488bbe82a3ed95992ba9ae2d6d977be329ab4 +size 793936 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/A/FP/FKRFVGEJM14C0FQ2PL4URD.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/A/FP/FKRFVGEJM14C0FQ2PL4URD.uasset index 9ac471b9..7e93c2dd 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/A/FP/FKRFVGEJM14C0FQ2PL4URD.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/A/FP/FKRFVGEJM14C0FQ2PL4URD.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dbc7633c63c23fde504c2514ce774d141b0a1b1a505616a157bf516e2c853cc9 -size 5715883 +oid sha256:3353ce7a05b460e2c933ead56bf9729db9b0219950fbafc6ecc5ba875c21ebdd +size 5669219 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/JX/B8GD26U4E09IJ6LKJCYJED.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/JX/B8GD26U4E09IJ6LKJCYJED.uasset index 199785c4..19b1477c 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/JX/B8GD26U4E09IJ6LKJCYJED.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/JX/B8GD26U4E09IJ6LKJCYJED.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75b0739e493b08765ae308d25a0e4f890d5e25f4f6a719c102e7a395654a0461 -size 437251 +oid sha256:05caaf2a7a1cb30c4b1d20802c3d2c383bad9cb6c3220dfffeeb358bf06de620 +size 433084 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/S2/W9Y1MY04170LA9NU56DIK9.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/S2/W9Y1MY04170LA9NU56DIK9.uasset index a3a25054..87c2d621 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/S2/W9Y1MY04170LA9NU56DIK9.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/B/S2/W9Y1MY04170LA9NU56DIK9.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2af9964465ac5904419b841deba7531c18814a55f4df1ae280bbae31ce34b7f6 -size 4179103 +oid sha256:4b20a23aa43cfeb8d61d250c9deb3458908888b4baa44acb1de3b25ecd5eafdf +size 4152883 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/JS/5YSW3URDY5J8WPQ33I5ZH2.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/JS/5YSW3URDY5J8WPQ33I5ZH2.uasset index e9d2f90b..1c66acb2 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/JS/5YSW3URDY5J8WPQ33I5ZH2.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/JS/5YSW3URDY5J8WPQ33I5ZH2.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:43c413b7a4f37288a1278438f930639746de73d748cef788f2ccc6b50b0d3882 -size 432548 +oid sha256:77da2248d4652121905a72e70c81efc499dab3dc814151f726cc292cbb9902f1 +size 430288 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/MJ/Q798ERNCOWH3QGCHW6VIM1.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/MJ/Q798ERNCOWH3QGCHW6VIM1.uasset index df36bf26..6567c971 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/MJ/Q798ERNCOWH3QGCHW6VIM1.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/MJ/Q798ERNCOWH3QGCHW6VIM1.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0bf685e2729aca58e95403af56d01f28914453c9c5372b57a9196c54b9c9e46e -size 2683831 +oid sha256:58d57ec9a13bc21ac4fba43dd24022a50ff1e1f00f15363968866afb12d6bc2a +size 2663528 diff --git a/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/W4/NIPFEFVGYJSC7WB142VIEH.uasset b/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/W4/NIPFEFVGYJSC7WB142VIEH.uasset index 3dc89a81..2cf4c26b 100644 --- a/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/W4/NIPFEFVGYJSC7WB142VIEH.uasset +++ b/Content/__ExternalActors__/Maps/Persistent_GameWorld/D/W4/NIPFEFVGYJSC7WB142VIEH.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:17ce3d3246dfffbc39f4631c5650114809b35cb2485a870a2af69bbd9b9a4e2a -size 1079995 +oid sha256:805dd82116d161be9511ace5bef586dbc249a26b7cfcc2dd441a8df11454bd2b +size 1073391 diff --git a/Source/ProjectEleri/Private/TimeOfDayManager.cpp b/Source/ProjectEleri/Private/TimeOfDayManager.cpp index 5d0c6eb1..b0b24e98 100644 --- a/Source/ProjectEleri/Private/TimeOfDayManager.cpp +++ b/Source/ProjectEleri/Private/TimeOfDayManager.cpp @@ -297,12 +297,28 @@ void ATimeOfDayManager::RotateSun(const float &_rotator) { if (!enableTimeOfDay) return; + if (!CurrentWeatherPreset || !CurrentWeatherPreset->SunRotationCurve) + return; if (sunLight->IsValidLowLevel()) { FVector currentRotInVectors = FVector(0.0f, CurrentWeatherPreset->SunRotationCurve->GetFloatValue(FloatMinutes), 110.0f); FRotator currentSunRotation = FRotator(FRotator::MakeFromEuler(currentRotInVectors)); - sunLight->SetWorldRotation(currentSunRotation); + + // The renderer only reuses its cached CSM shadow maps while the light matrix is bit-identical (the + // cached shadow initializer is compared with == in the shadow setup), so re-orienting the light every + // frame throws the whole cascade shadow map cache away every frame. Only move the light once the sun + // actually travelled far enough to be worth the cache rebuild. + const float PitchDelta = FMath::Abs(FMath::FindDeltaAngleDegrees(AppliedSunRotation.Pitch, currentSunRotation.Pitch)); + const float YawDelta = FMath::Abs(FMath::FindDeltaAngleDegrees(AppliedSunRotation.Yaw, currentSunRotation.Yaw)); + + if (bSunRotationDirty || SunRotationUpdateThreshold <= 0.0f || PitchDelta >= SunRotationUpdateThreshold || + YawDelta >= SunRotationUpdateThreshold) + { + sunLight->SetWorldRotation(currentSunRotation); + AppliedSunRotation = currentSunRotation; + bSunRotationDirty = false; + } } } diff --git a/Source/ProjectEleri/Public/TimeOfDayManager.h b/Source/ProjectEleri/Public/TimeOfDayManager.h index ae7fe192..4f27b963 100644 --- a/Source/ProjectEleri/Public/TimeOfDayManager.h +++ b/Source/ProjectEleri/Public/TimeOfDayManager.h @@ -205,12 +205,29 @@ public: UPROPERTY(EditAnywhere, Category = "Time of Day - Lightning Setting") float daySpeed = 10.0f; + /** Minimum movement of the sun in degrees before the directional light is actually re-oriented. + * The renderer only reuses its cached CSM shadow maps while the light matrix is completely unchanged + * (the cached shadow initializer is compared with == in the shadow setup), so writing the light + * transform every frame invalidates and releases the whole cascade shadow map cache every frame. + * The light is re-oriented roughly every (SunRotationUpdateThreshold / sun degrees per second) seconds, + * so the cache is reused for all the frames in between. 0 disables the throttle. */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Time of Day - Lightning Setting") + float SunRotationUpdateThreshold = 0.1f; + UPROPERTY(EditAnywhere, Category = "Time of Day - Lightning Setting") FLinearColor SubsurfaceColorDay; UPROPERTY(VisibleAnywhere, Category = "Time of Day - Info") float rotator; + /** Rotation that is currently applied to sunLight, used to throttle the per-frame SetWorldRotation. */ + UPROPERTY(VisibleAnywhere, Category = "Time of Day - Info") + FRotator AppliedSunRotation; + + /** True until the current sun rotation has been pushed into the light at least once. */ + UPROPERTY(VisibleAnywhere, Category = "Time of Day - Info") + bool bSunRotationDirty = true; + UPROPERTY(VisibleAnywhere, Category = "Time of Day - Info") float CurrentWeaterFadeAlpha;