refactor: update show flag settings in BPC_PlanarCapture for UE5.7 compatibility; enhance SS_PlanarCaptureManager with FTickableGameObject interface
This commit is contained in:
@@ -511,11 +511,29 @@ void UBPC_PlanarCapture::ApplyShowFlags()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Apply show flags based on active quality profile
|
// Apply show flags based on active quality profile
|
||||||
SceneCapture->ShowFlags.SetShadows(ActiveProfile.bEnableShadows);
|
// UE5.7: FEngineShowFlags members are set directly, not via setter methods
|
||||||
SceneCapture->ShowFlags.SetFog(ActiveProfile.bEnableFog);
|
if (!ActiveProfile.bEnableShadows)
|
||||||
SceneCapture->ShowFlags.SetBloom(ActiveProfile.bEnableBloom);
|
{
|
||||||
SceneCapture->ShowFlags.SetAmbientOcclusion(ActiveProfile.bEnableAO);
|
SceneCapture->ShowFlags.DynamicShadows = false;
|
||||||
SceneCapture->ShowFlags.SetMotionBlur(ActiveProfile.bEnableMotionBlur);
|
SceneCapture->ShowFlags.ContactShadows = false;
|
||||||
|
}
|
||||||
|
if (!ActiveProfile.bEnableFog)
|
||||||
|
{
|
||||||
|
SceneCapture->ShowFlags.Fog = 0;
|
||||||
|
}
|
||||||
|
if (!ActiveProfile.bEnableBloom)
|
||||||
|
{
|
||||||
|
SceneCapture->ShowFlags.Bloom = 0;
|
||||||
|
}
|
||||||
|
if (!ActiveProfile.bEnableAO)
|
||||||
|
{
|
||||||
|
SceneCapture->ShowFlags.AmbientOcclusion = 0;
|
||||||
|
SceneCapture->ShowFlags.ScreenSpaceAO = 0;
|
||||||
|
}
|
||||||
|
if (!ActiveProfile.bEnableMotionBlur)
|
||||||
|
{
|
||||||
|
SceneCapture->ShowFlags.MotionBlur = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Lumen is controlled via post-process settings on the capture component
|
// Lumen is controlled via post-process settings on the capture component
|
||||||
SceneCapture->PostProcessSettings.bOverride_DynamicGlobalIlluminationMethod = true;
|
SceneCapture->PostProcessSettings.bOverride_DynamicGlobalIlluminationMethod = true;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// UE5 Modular Game Framework — PlanarCaptureCameraUtils implementation
|
// UE5 Modular Game Framework — PlanarCaptureCameraUtils implementation
|
||||||
|
|
||||||
#include "Capture/PlanarCaptureCameraUtils.h"
|
#include "Capture/PlanarCaptureCameraUtils.h"
|
||||||
|
#include "Kismet/KismetMathLibrary.h"
|
||||||
|
|
||||||
FTransform UPlanarCaptureCameraUtils::ComputeMirroredTransform(
|
FTransform UPlanarCaptureCameraUtils::ComputeMirroredTransform(
|
||||||
const FTransform& ViewerCameraTransform,
|
const FTransform& ViewerCameraTransform,
|
||||||
@@ -24,7 +25,7 @@ FTransform UPlanarCaptureCameraUtils::ComputeMirroredTransform(
|
|||||||
const FVector ViewerUp = ViewerCameraTransform.GetUnitAxis(EAxis::Z);
|
const FVector ViewerUp = ViewerCameraTransform.GetUnitAxis(EAxis::Z);
|
||||||
const FVector ReflectedUp = ViewerUp - 2.0f * FVector::DotProduct(ViewerUp, MirrorNormal) * MirrorNormal;
|
const FVector ReflectedUp = ViewerUp - 2.0f * FVector::DotProduct(ViewerUp, MirrorNormal) * MirrorNormal;
|
||||||
|
|
||||||
FRotator ReflectedRotation = UKismetMathLibrary::MakeRotFromXZ(ReflectedForward, ReflectedUp);
|
const FRotator ReflectedRotation = FRotationMatrix::MakeFromXZ(ReflectedForward, ReflectedUp).Rotator();
|
||||||
|
|
||||||
return FTransform(ReflectedRotation, ReflectedPosition, ViewerCameraTransform.GetScale3D());
|
return FTransform(ReflectedRotation, ReflectedPosition, ViewerCameraTransform.GetScale3D());
|
||||||
}
|
}
|
||||||
@@ -73,8 +74,8 @@ FMatrix UPlanarCaptureCameraUtils::ComputeObliqueProjectionMatrix(
|
|||||||
ProjectionMatrix.M[3][3] = 0.0f;
|
ProjectionMatrix.M[3][3] = 0.0f;
|
||||||
|
|
||||||
// Transform clip plane into view space (inverse of surface transform)
|
// Transform clip plane into view space (inverse of surface transform)
|
||||||
const FTransform ViewTransform = SurfaceTransform.Inverse();
|
const FMatrix ViewMatrix = SurfaceTransform.ToMatrixNoScale().Inverse();
|
||||||
const FPlane ViewSpaceClipPlane = ClipPlane.TransformBy(ViewTransform);
|
const FPlane ViewSpaceClipPlane = ClipPlane.TransformBy(ViewMatrix);
|
||||||
|
|
||||||
// Compute oblique near-plane using the standard technique:
|
// Compute oblique near-plane using the standard technique:
|
||||||
// Calculate the clip-space corner that maximizes the dot product with the plane normal.
|
// Calculate the clip-space corner that maximizes the dot product with the plane normal.
|
||||||
@@ -90,7 +91,8 @@ FMatrix UPlanarCaptureCameraUtils::ComputeObliqueProjectionMatrix(
|
|||||||
Q.W = (1.0f + ProjectionMatrix.M[2][2]) / ProjectionMatrix.M[3][2];
|
Q.W = (1.0f + ProjectionMatrix.M[2][2]) / ProjectionMatrix.M[3][2];
|
||||||
|
|
||||||
// Scale the clip plane so its distance from the origin matches the Q vertex
|
// Scale the clip plane so its distance from the origin matches the Q vertex
|
||||||
const float Scale = 2.0f / FVector4::DotProduct(ClipPlaneVec, Q);
|
const float DotVal = ClipPlaneVec.X * Q.X + ClipPlaneVec.Y * Q.Y + ClipPlaneVec.Z * Q.Z + ClipPlaneVec.W * Q.W;
|
||||||
|
const float Scale = 2.0f / DotVal;
|
||||||
ClipPlaneVec *= Scale;
|
ClipPlaneVec *= Scale;
|
||||||
|
|
||||||
// Replace the third row of the projection matrix with the clip plane
|
// Replace the third row of the projection matrix with the clip plane
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "Subsystems/WorldSubsystem.h"
|
#include "Subsystems/WorldSubsystem.h"
|
||||||
|
#include "Tickable.h"
|
||||||
|
#include "Misc/Optional.h"
|
||||||
#include "Capture/PlanarCaptureCommon.h"
|
#include "Capture/PlanarCaptureCommon.h"
|
||||||
#include "SS_PlanarCaptureManager.generated.h"
|
#include "SS_PlanarCaptureManager.generated.h"
|
||||||
|
|
||||||
@@ -38,7 +40,7 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnGlobalQualityCapChanged, EPlanarC
|
|||||||
* On clients, it drives actual capture rendering.
|
* On clients, it drives actual capture rendering.
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class PG_FRAMEWORK_API USS_PlanarCaptureManager : public UWorldSubsystem
|
class PG_FRAMEWORK_API USS_PlanarCaptureManager : public UWorldSubsystem, public FTickableGameObject
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
@@ -51,8 +53,13 @@ public:
|
|||||||
|
|
||||||
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
|
||||||
virtual void Deinitialize() override;
|
virtual void Deinitialize() override;
|
||||||
|
|
||||||
|
// FTickableGameObject
|
||||||
virtual void Tick(float DeltaTime) override;
|
virtual void Tick(float DeltaTime) override;
|
||||||
virtual TStatId GetStatId() const override;
|
virtual TStatId GetStatId() const override;
|
||||||
|
virtual bool IsTickable() const override { return !IsTemplate(); }
|
||||||
|
virtual bool IsTickableInEditor() const override { return false; }
|
||||||
|
virtual UWorld* GetTickableGameObjectWorld() const override { return GetWorld(); }
|
||||||
|
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
// Surface Registry
|
// Surface Registry
|
||||||
|
|||||||
Reference in New Issue
Block a user