Changes to weather system, normalize weather

This commit is contained in:
2026-10-31 23:05:43 +01:00
parent b42a4b5dc8
commit 2034158c27
49 changed files with 120 additions and 85 deletions

View File

@@ -3,6 +3,7 @@
#pragma once
#include "CoreMinimal.h"
#include "Curves/CurveLinearColor.h"
#include "Engine/DataAsset.h"
#include "WeatherPresetDataAsset.generated.h"
@@ -55,6 +56,10 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Clouds")
FRuntimeFloatCurve CloudsBrightnessCurve;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Clouds")
FRuntimeCurveLinearColor CloudAmbientColorCurve;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Clouds")
FRuntimeCurveLinearColor CloudSunColorCurve;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Clouds")
float CloudDensity = 0.3f;

View File

@@ -12,7 +12,6 @@
#include "Engine/PostProcessVolume.h"
#include "Engine/StreamableManager.h"
#include "Engine/World.h"
#include "Kismet/GameplayStatics.h"
#include "Kismet/KismetMaterialLibrary.h"
#include "Materials/MaterialParameterCollection.h"
#include "ProjectEleri/Data/WeatherPresetDataAsset.h"
@@ -229,6 +228,20 @@ void ATimeOfDayManager::UpdateLightning()
QueuedWeatherPreset ?
FMath::Lerp(QueuedWeatherPreset->CloudCoverage,CurrentWeatherPreset->CloudCoverage,CurrentWeaterFadeAlpha) :
CurrentWeatherPreset->CloudCoverage);
const FLinearColor CloudAmbientColor = CurrentWeatherPreset->CloudAmbientColorCurve.GetLinearColorValue(FloatMinutes);
UKismetMaterialLibrary::SetVectorParameterValue(GetWorld(), GeneralMaterialParameterCollection,
FName("CloudAmbientColor"),
QueuedWeatherPreset ?
FMath::Lerp(QueuedWeatherPreset->CloudAmbientColorCurve.GetLinearColorValue(FloatMinutes),CloudAmbientColor, CurrentWeaterFadeAlpha)
: CloudAmbientColor);
const FLinearColor CloudSunColor = CurrentWeatherPreset->CloudSunColorCurve.GetLinearColorValue(FloatMinutes);
UKismetMaterialLibrary::SetVectorParameterValue(GetWorld(), GeneralMaterialParameterCollection,
FName("CloudSunColor"),
QueuedWeatherPreset ?
FMath::Lerp(QueuedWeatherPreset->CloudSunColorCurve.GetLinearColorValue(FloatMinutes),CloudSunColor, CurrentWeaterFadeAlpha)
: CloudSunColor);
}
// Update wetness
@@ -286,6 +299,8 @@ void ATimeOfDayManager::RotateSun(const float &_rotator)
AppliedSunRotation = currentSunRotation;
bSunRotationDirty = false;
}
UKismetMaterialLibrary::SetVectorParameterValue(GetWorld(), GeneralMaterialParameterCollection, FName("SunDirection"), FLinearColor(-sunLight->GetForwardVector()));
}
}

View File

@@ -203,9 +203,9 @@ public:
UMaterialParameterCollection *GeneralMaterialParameterCollection;
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
UMaterialParameterCollection *WindMaterialParameterCollection;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
AActor *skyDomeActor;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Time of Day - Lightning Setting")
AStaticMeshActor *skyDomeActor;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
APostProcessVolume *MainPP;
@@ -405,6 +405,9 @@ protected:
UPROPERTY()
TMap<UWeatherPresetDataAsset *, float> WeatherPresetDistributionMap;
UPROPERTY(EditDefaultsOnly)
UMaterialInstanceDynamic* CloudDynamicMaterial = nullptr;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
UInteractionWidgetComponent* WidgetComponent;