34 int32 CascadeIndex = 0;
37 float NearPlane = 0.0f;
38 float FarPlane = 0.0f;
44 float OrthoWidth = 0.0f;
47 FMatrix ViewProjectionMatrix = FMatrix::Identity;
50 FVector LightCameraPosition = FVector::ZeroVector;
53 FVector LightCameraForward = FVector(0.0f, 0.0f, -1.0f);
59 TObjectPtr<UTextureRenderTarget2D> DepthRT =
nullptr;
62 TObjectPtr<UTextureRenderTarget2D> VSMRT =
nullptr;
65 TObjectPtr<USceneCaptureComponent2D> CaptureComponent =
nullptr;
68 bool bNeedsCapture =
true;
71 uint32 LastCaptureFrame = 0;
124 void Initialize(UWorld* World, int32 NumCascades, int32 Resolution,
float MaxDistance);
145 const FVector& CameraPosition,
146 const FVector& CameraForward,
147 const FVector& LightDirection,
161 const TArray<FIVSmokeCascadeData>&
GetCascades()
const {
return Cascades; }
164 TArray<float> GetSplitDistances()
const;
167 FTextureRHIRef GetVSMTexture(int32 CascadeIndex)
const;
170 FTextureRHIRef GetDepthTexture(int32 CascadeIndex)
const;
173 bool HasValidShadowData()
const;
181 FVector GetLightCameraPosition(int32 CascadeIndex)
const;
197 void CalculateCascadeSplits(
float NearPlane,
float FarPlane,
float LogLinearBlend);
209 FVector ApplyTexelSnapping(
210 const FVector& LightViewOrigin,
213 const FVector& LightRight,
214 const FVector& LightUp
222 void UpdateCascadePriorities(uint32 FrameNumber);
231 void UpdateCascadeCapture(
233 const FVector& CameraPosition,
234 const FVector& LightDirection
259 void ConfigureCaptureComponent(USceneCaptureComponent2D* CaptureComponent);
265 TArray<FIVSmokeCascadeData> Cascades;
268 TWeakObjectPtr<AActor> CaptureOwner;
271 int32 CurrentResolution = 512;
274 float MaxShadowDistance = 100000.0f;
277 float LogLinearBlend = 0.7f;
280 float NearPlaneDistance = 10.0f;
283 bool bIsInitialized =
false;
286 bool bEnablePriorityUpdate =
true;
289 int32 NearCascadeUpdateInterval = 1;
292 int32 FarCascadeUpdateInterval = 4;
295 FVector MainCameraPosition = FVector::ZeroVector;