I have a USceneCaptureComponent2D *SceneCapture
capturing the scene.
The result is darker than the BackBuffer.
I tried the following code to keep the PostProcessSettings the same as SceneView->FinalPostProcessSettings
, it does not make any difference.
// Called every frame
void AXXXXX::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
APlayerController *OurPlayerController = UGameplayStatics::GetPlayerController(this, 0);
OurPlayerController->SetViewTarget(OurCamera->GetAttachParentActor());
APawn* Pawn = OurPlayerController->GetPawn();
check(Pawn);
UCameraComponent* MainCamera = Cast<UCameraComponent>(Pawn->FindComponentByClass<UCameraComponent>());
check(MainCamera);
ULocalPlayer* LocalPlayer = OurPlayerController->GetLocalPlayer();
check(LocalPlayer);
check(LocalPlayer->ViewportClient);
SceneCapture->ShowFlags = LocalPlayer->ViewportClient->EngineShowFlags;
FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues(
LocalPlayer->ViewportClient->Viewport, GetWorld()->Scene, LocalPlayer->ViewportClient->EngineShowFlags)
.SetRealtimeUpdate(true));
FVector ViewLocation;
FRotator ViewRotation;
FSceneView* SceneView = LocalPlayer->CalcSceneView(&ViewFamily, ViewLocation, ViewRotation, LocalPlayer->ViewportClient->Viewport, nullptr, INDEX_NONE);
check(SceneView);
SceneCapture->PostProcessBlendWeight = 1.0f;
SceneCapture->PostProcessSettings = SceneView->FinalPostProcessSettings;
//SceneCapture->PostProcessSettings = MainCamera->PostProcessSettings;
//SceneCapture->PostProcessSettings.bOverride_AutoExposureMinBrightness = true;
//SceneCapture->PostProcessSettings.AutoExposureMinBrightness = 2.0f;
}
I tried SceneCapture->PostProcessSettings = MainCamera->PostProcessSettings;
too, it does not make difference neither.
But these two lines can make the result more brighter
SceneCapture->PostProcessSettings.bOverride_AutoExposureMinBrightness = true;
SceneCapture->PostProcessSettings.AutoExposureMinBrightness = 2.0f;
Question : How to ensure USceneCaptureComponent2D captures the same result as BackBuffer?
Thanks in advance