Settings tweaks for better performance

This commit is contained in:
2026-09-15 11:11:50 +02:00
parent aad09dbaa5
commit ed466f6376
25 changed files with 81 additions and 45 deletions

View File

@@ -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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -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));
// 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;
}
}
}

View File

@@ -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;