27 static void ConfigureShowFlags(FEngineShowFlags &ShowFlags,
bool bPostProcessing =
true);
32 check(Settings !=
nullptr);
33 return Settings->GetQualityLevel();
43 : Super(ObjectInitializer)
45 PrimaryActorTick.bCanEverTick =
true;
46 PrimaryActorTick.TickGroup = TG_PrePhysics;
62 CaptureComponent2D->PrimitiveRenderMode = ESceneCapturePrimitiveRenderMode::PRM_RenderScenePrimitives;
74 Super::Set(Description);
333 CaptureComponent2D->PostProcessSettings.AutoExposureCalibrationConstant_DEPRECATED = Constant;
339 return CaptureComponent2D->PostProcessSettings.AutoExposureCalibrationConstant_DEPRECATED;
441 CaptureComponent2D->PostProcessSettings.ChromaticAberrationStartOffset = ChromAberrOffset;
463 TEXT(
"SceneStencil"),
473 TEXT(
"CustomStencil"),
476 template <EGBufferTextureID ID,
typename T>
479 GBufferStream.bIsUsed = GBufferStream.Stream.AreClientsListening();
480 if (GBufferStream.bIsUsed)
481 GBuffer.MarkAsRequested(ID);
488 auto GBufferPtr = MakeUnique<FGBufferRequest>();
489 auto& GBuffer = *GBufferPtr;
491 CheckGBufferStream<EGBufferTextureID::SceneColor>(
CameraGBuffers.SceneColor, GBuffer);
492 CheckGBufferStream<EGBufferTextureID::SceneDepth>(
CameraGBuffers.SceneDepth, GBuffer);
493 CheckGBufferStream<EGBufferTextureID::SceneStencil>(
CameraGBuffers.SceneStencil, GBuffer);
494 CheckGBufferStream<EGBufferTextureID::GBufferA>(
CameraGBuffers.GBufferA, GBuffer);
495 CheckGBufferStream<EGBufferTextureID::GBufferB>(
CameraGBuffers.GBufferB, GBuffer);
496 CheckGBufferStream<EGBufferTextureID::GBufferC>(
CameraGBuffers.GBufferC, GBuffer);
497 CheckGBufferStream<EGBufferTextureID::GBufferD>(
CameraGBuffers.GBufferD, GBuffer);
498 CheckGBufferStream<EGBufferTextureID::GBufferE>(
CameraGBuffers.GBufferE, GBuffer);
499 CheckGBufferStream<EGBufferTextureID::GBufferF>(
CameraGBuffers.GBufferF, GBuffer);
500 CheckGBufferStream<EGBufferTextureID::Velocity>(
CameraGBuffers.Velocity, GBuffer);
501 CheckGBufferStream<EGBufferTextureID::SSAO>(
CameraGBuffers.SSAO, GBuffer);
502 CheckGBufferStream<EGBufferTextureID::CustomDepth>(
CameraGBuffers.CustomDepth, GBuffer);
503 CheckGBufferStream<EGBufferTextureID::CustomStencil>(
CameraGBuffers.CustomStencil, GBuffer);
505 if (GBufferPtr->DesiredTexturesMask == 0)
512 if (
Prior != GBufferPtr->DesiredTexturesMask)
513 UE_LOG(LogCarla, Verbose, TEXT(
"GBuffer selection changed (%llu)."), GBufferPtr->DesiredTexturesMask);
515 Prior = GBufferPtr->DesiredTexturesMask;
518 #define CARLA_GBUFFER_DISABLE_TAA // Temporarily disable TAA to avoid jitter. 520 #ifdef CARLA_GBUFFER_DISABLE_TAA 529 #ifdef CARLA_GBUFFER_DISABLE_TAA 533 #undef CARLA_GBUFFER_DISABLE_TAA 536 AsyncTask(ENamedThreads::AnyHiPriThreadNormalTask, [
this, GBuffer = MoveTemp(GBufferPtr)]()
mutable 555 bInForceLinearGamma);
576 UKismetSystemLibrary::ExecuteConsoleCommand(
578 FString(
"g.TimeoutForBlockOnRenderFence 300000"));
592 Super::PrePhysTick(DeltaSeconds);
604 Super::PostPhysTick(World, TickType, DeltaTime);
609 Super::EndPlay(EndPlayReason);
610 FlushRenderingCommands();
622 auto &PostProcessSettings = CaptureComponent2D.PostProcessSettings;
625 PostProcessSettings.bOverride_AutoExposureMethod =
true;
626 PostProcessSettings.AutoExposureMethod = EAutoExposureMethod::AEM_Histogram;
627 PostProcessSettings.bOverride_AutoExposureBias =
true;
628 PostProcessSettings.bOverride_AutoExposureMinBrightness =
true;
629 PostProcessSettings.bOverride_AutoExposureMaxBrightness =
true;
630 PostProcessSettings.bOverride_AutoExposureSpeedUp =
true;
631 PostProcessSettings.bOverride_AutoExposureSpeedDown =
true;
632 PostProcessSettings.bOverride_AutoExposureCalibrationConstant_DEPRECATED =
true;
633 PostProcessSettings.bOverride_HistogramLogMin =
true;
634 PostProcessSettings.HistogramLogMin = 1.0f;
635 PostProcessSettings.bOverride_HistogramLogMax =
true;
636 PostProcessSettings.HistogramLogMax = 12.0f;
639 PostProcessSettings.bOverride_CameraShutterSpeed =
true;
640 PostProcessSettings.bOverride_CameraISO =
true;
641 PostProcessSettings.bOverride_DepthOfFieldFstop =
true;
642 PostProcessSettings.bOverride_DepthOfFieldMinFstop =
true;
643 PostProcessSettings.bOverride_DepthOfFieldBladeCount =
true;
646 PostProcessSettings.bOverride_FilmSlope =
true;
647 PostProcessSettings.bOverride_FilmToe =
true;
648 PostProcessSettings.bOverride_FilmShoulder =
true;
649 PostProcessSettings.bOverride_FilmWhiteClip =
true;
650 PostProcessSettings.bOverride_FilmBlackClip =
true;
653 PostProcessSettings.bOverride_MotionBlurAmount =
true;
654 PostProcessSettings.MotionBlurAmount = 0.45f;
655 PostProcessSettings.bOverride_MotionBlurMax =
true;
656 PostProcessSettings.MotionBlurMax = 0.35f;
657 PostProcessSettings.bOverride_MotionBlurPerObjectSize =
true;
658 PostProcessSettings.MotionBlurPerObjectSize = 0.1f;
661 PostProcessSettings.bOverride_WhiteTemp =
true;
662 PostProcessSettings.bOverride_WhiteTint =
true;
663 PostProcessSettings.bOverride_ColorContrast =
true;
667 PostProcessSettings.ColorContrast = FVector4(1.2f, 1.2f, 1.2f, 1.0f);
671 PostProcessSettings.bOverride_SceneFringeIntensity =
true;
672 PostProcessSettings.bOverride_ChromaticAberrationStartOffset =
true;
675 PostProcessSettings.bOverride_AmbientOcclusionIntensity =
true;
676 PostProcessSettings.AmbientOcclusionIntensity = 0.5f;
677 PostProcessSettings.bOverride_AmbientOcclusionRadius =
true;
678 PostProcessSettings.AmbientOcclusionRadius = 100.0f;
679 PostProcessSettings.bOverride_AmbientOcclusionStaticFraction =
true;
680 PostProcessSettings.AmbientOcclusionStaticFraction = 1.0f;
681 PostProcessSettings.bOverride_AmbientOcclusionFadeDistance =
true;
682 PostProcessSettings.AmbientOcclusionFadeDistance = 50000.0f;
683 PostProcessSettings.bOverride_AmbientOcclusionPower =
true;
684 PostProcessSettings.AmbientOcclusionPower = 2.0f;
685 PostProcessSettings.bOverride_AmbientOcclusionBias =
true;
686 PostProcessSettings.AmbientOcclusionBias = 3.0f;
687 PostProcessSettings.bOverride_AmbientOcclusionQuality =
true;
688 PostProcessSettings.AmbientOcclusionQuality = 100.0f;
691 PostProcessSettings.bOverride_BloomMethod =
true;
692 PostProcessSettings.BloomMethod = EBloomMethod::BM_SOG;
693 PostProcessSettings.bOverride_BloomIntensity =
true;
694 PostProcessSettings.BloomIntensity = 0.675f;
695 PostProcessSettings.bOverride_BloomThreshold =
true;
696 PostProcessSettings.BloomThreshold = -1.0f;
699 PostProcessSettings.bOverride_LensFlareIntensity =
true;
700 PostProcessSettings.LensFlareIntensity = 0.1;
709 ShowFlags.EnableAdvancedFeatures();
710 ShowFlags.SetMotionBlur(
true);
714 ShowFlags.SetAmbientOcclusion(
false);
715 ShowFlags.SetAntiAliasing(
false);
716 ShowFlags.SetVolumetricFog(
false);
720 ShowFlags.SetBloom(
false);
729 ShowFlags.SetCameraImperfections(
false);
730 ShowFlags.SetCameraInterpolation(
false);
735 ShowFlags.SetColorGrading(
false);
742 ShowFlags.SetDepthOfField(
false);
743 ShowFlags.SetDiffuse(
false);
744 ShowFlags.SetDirectionalLights(
false);
745 ShowFlags.SetDirectLighting(
false);
749 ShowFlags.SetDynamicShadows(
false);
751 ShowFlags.SetEyeAdaptation(
false);
752 ShowFlags.SetFog(
false);
756 ShowFlags.SetGlobalIllumination(
false);
757 ShowFlags.SetGrain(
false);
761 ShowFlags.SetHLODColoration(
false);
762 ShowFlags.SetHMDDistortion(
false);
769 ShowFlags.SetLensFlares(
false);
770 ShowFlags.SetLevelColoration(
false);
771 ShowFlags.SetLightComplexity(
false);
772 ShowFlags.SetLightFunctions(
false);
773 ShowFlags.SetLightInfluences(
false);
774 ShowFlags.SetLighting(
false);
775 ShowFlags.SetLightMapDensity(
false);
776 ShowFlags.SetLightRadius(
false);
777 ShowFlags.SetLightShafts(
false);
779 ShowFlags.SetLODColoration(
false);
785 ShowFlags.SetMotionBlur(
false);
787 ShowFlags.SetOnScreenDebug(
false);
791 ShowFlags.SetParticles(
false);
793 ShowFlags.SetPointLights(
false);
800 ShowFlags.SetPropertyColoration(
false);
804 ShowFlags.SetRefraction(
false);
806 ShowFlags.SetSceneColorFringe(
false);
808 ShowFlags.SetScreenSpaceAO(
false);
809 ShowFlags.SetScreenSpaceReflections(
false);
818 ShowFlags.SetSkyLighting(
false);
822 ShowFlags.SetSpotLights(
false);
824 ShowFlags.SetStationaryLightOverlap(
false);
827 ShowFlags.SetSubsurfaceScattering(
false);
833 ShowFlags.SetTonemapper(
false);
841 ShowFlags.SetVisualizeBuffer(
false);
842 ShowFlags.SetVisualizeDistanceFieldAO(
false);
843 ShowFlags.SetVisualizeDOF(
false);
844 ShowFlags.SetVisualizeHDR(
false);
845 ShowFlags.SetVisualizeLightCulling(
false);
846 ShowFlags.SetVisualizeLPV(
false);
847 ShowFlags.SetVisualizeMeshDistanceFields(
false);
848 ShowFlags.SetVisualizeMotionBlur(
false);
849 ShowFlags.SetVisualizeOutOfBoundsPixels(
false);
850 ShowFlags.SetVisualizeSenses(
false);
851 ShowFlags.SetVisualizeShadingModels(
false);
852 ShowFlags.SetVisualizeSSR(
false);
853 ShowFlags.SetVisualizeSSS(
false);
EAutoExposureMethod GetExposureMethod() const
void SetFilmToe(float Toe)
void SetFilmWhiteClip(float WhiteClip)
uint32 ImageWidth
Image width in pixels.
void SetMotionBlurIntensity(float Intensity)
void SetExposureMethod(EAutoExposureMethod Method)
static auto SCENE_CAPTURE_COUNTER
void SetLensFlareIntensity(float Intensity)
USceneCaptureComponent2D_CARLA * CaptureComponent2D
Scene capture component.
float GetExposureCompensation() const
static void ConfigureShowFlags(FEngineShowFlags &ShowFlags, bool bPostProcessing=true)
void SetChromAberrIntensity(float Intensity)
void SetWhiteTint(float Tint)
void SetFOVAngle(float FOVAngle)
void SetChromAberrOffset(float ChromAberrOffset)
virtual const AActor * GetViewOwner() const override
AWeather * GetWeather() const
float GetDepthOfFieldMinFstop() const
float GetFilmWhiteClip() const
float GetFOVAngle() const
float GetFilmSlope() const
float GetExposureMinBrightness() const
void EnqueueRenderSceneImmediate()
Immediate enqueues render commands of the scene at the current time.
float GetMotionBlurMaxDistortion() const
float GetFilmShoulder() const
float GetWhiteTemp() const
void SetFilmSlope(float Slope)
float GetExposureSpeedDown() const
const UCarlaEpisode & GetEpisode() const
void SetFocalDistance(float Distance)
void CaptureSceneExtended()
void SetBladeCount(int Count)
static bool IsValid(const ACarlaWheeledVehicle *Vehicle)
bool bEnable16BitFormat
Whether to change render target format to PF_A16B16G16R16, offering 16bit / channel.
static UCarlaSettings * GetCarlaSettings(const UObject *WorldContextObject)
static void SetCameraDefaultOverrides(USceneCaptureComponent2D &CaptureComponent2D)
ASceneCaptureSensor(const FObjectInitializer &ObjectInitializer)
float GetExposureCalibrationConstant() const
USceneCaptureComponent2D * GetCaptureComponent2D()
static T Get(carla::rpc::Response< T > &response)
virtual void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime) override
float GetFilmBlackClip() const
float GetAperture() const
float GetMotionBlurMinObjectScreenSize() const
void SetDepthBlurRadius(float Radius)
static void SetCamera(const FActorDescription &Description, ASceneCaptureSensor *Camera)
float GetDepthBlurAmount() const
float GetDepthBlurRadius() const
int GetBladeCount() const
float GetLensFlareIntensity() const
virtual void SetUpSceneCaptureComponent(USceneCaptureComponent2D &SceneCapture)
A description of a Carla Actor with all its variation.
float GetChromAberrIntensity() const
void SetExposureMinBrightness(float Brightness)
void SetMotionBlurMaxDistortion(float MaxDistortion)
uint32 ImageHeight
Image height in pixels.
static auto GetQualitySettings(UWorld *World)
virtual void PrePhysTick(float DeltaSeconds) override
void SetFilmShoulder(float Shoulder)
float GetWhiteTint() const
virtual void SendGBufferTextures(FGBufferRequest &GBuffer)
void SetBloomIntensity(float Intensity)
float GetExposureSpeedUp() const
float GetChromAberrOffset() const
virtual void BeginPlay() override
void SetExposureSpeedDown(float Speed)
void SetWhiteTemp(float Temp)
static void CheckGBufferStream(T &GBufferStream, FGBufferRequest &GBuffer)
float GetExposureMaxBrightness() const
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
void SetImageSize(uint32 Width, uint32 Height)
void SetExposureMaxBrightness(float Brightness)
float GetShutterSpeed() const
void NotifyWeather(ASensor *Sensor=nullptr)
Notifing the weather to the blueprint's event.
constexpr const TCHAR * GBufferNames[]
bool bEnablePostProcessingEffects
Whether to render the post-processing effects present in the scene.
float GetBloomIntensity() const
void SetExposureCompensation(float Compensation)
void SetExposureSpeedUp(float Speed)
void SendGBufferTexturesInternal(T &Self, FGBufferRequest &GBufferData)
void SetDepthBlurAmount(float Amount)
float GetMotionBlurIntensity() const
void SetFilmBlackClip(float BlackClip)
struct ASceneCaptureSensor::@0 CameraGBuffers
void SetAperture(float Aperture)
void SetDepthOfFieldMinFstop(float MinFstop)
void SetShutterSpeed(float Speed)
UTextureRenderTarget2D * CaptureRenderTarget
Render target necessary for scene capture.
void SetExposureCalibrationConstant(float Constant)
float GetFocalDistance() const
void SetMotionBlurMinObjectScreenSize(float ScreenSize)
void Set(const FActorDescription &ActorDescription) override