CARLA
 
载入中...
搜索中...
未找到
SceneCaptureSensor.cpp
浏览该文件的文档.
1// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#include "Carla.h"
11
12#include <mutex>
13#include <atomic>
14#include <thread>
15
16static auto SCENE_CAPTURE_COUNTER = 0u;
17
18// =============================================================================
19// -- Local static methods -----------------------------------------------------
20// =============================================================================
21
22// Local namespace to avoid name collisions on unit builds.
24
25 static void SetCameraDefaultOverrides(USceneCaptureComponent2D &CaptureComponent2D);
26
27 static void ConfigureShowFlags(FEngineShowFlags &ShowFlags, bool bPostProcessing = true);
28
29 static auto GetQualitySettings(UWorld *World)
30 {
31 auto Settings = UCarlaStatics::GetCarlaSettings(World);
32 check(Settings != nullptr);
33 return Settings->GetQualityLevel();
34 }
35
36} // namespace SceneCaptureSensor_local_ns
37
38// =============================================================================
39// -- ASceneCaptureSensor ------------------------------------------------------
40// =============================================================================
41
42ASceneCaptureSensor::ASceneCaptureSensor(const FObjectInitializer &ObjectInitializer)
43 : Super(ObjectInitializer)
44{
45 PrimaryActorTick.bCanEverTick = true;
46 PrimaryActorTick.TickGroup = TG_PrePhysics;
47
48 CaptureRenderTarget = CreateDefaultSubobject<UTextureRenderTarget2D>(
49 FName(*FString::Printf(TEXT("CaptureRenderTarget_d%d"), SCENE_CAPTURE_COUNTER)));
50 CaptureRenderTarget->CompressionSettings = TextureCompressionSettings::TC_Default;
51 CaptureRenderTarget->SRGB = false;
52 CaptureRenderTarget->bAutoGenerateMips = false;
53 CaptureRenderTarget->bGPUSharedFlag = true;
54 CaptureRenderTarget->AddressX = TextureAddress::TA_Clamp;
55 CaptureRenderTarget->AddressY = TextureAddress::TA_Clamp;
56
57 CaptureComponent2D = CreateDefaultSubobject<USceneCaptureComponent2D_CARLA>(
58 FName(*FString::Printf(TEXT("USceneCaptureComponent2D_CARLA_%d"), SCENE_CAPTURE_COUNTER)));
59 check(CaptureComponent2D != nullptr);
61 CaptureComponent2D->SetupAttachment(RootComponent);
62 CaptureComponent2D->PrimitiveRenderMode = ESceneCapturePrimitiveRenderMode::PRM_RenderScenePrimitives;
63 CaptureComponent2D->bCaptureOnMovement = false;
64 CaptureComponent2D->bCaptureEveryFrame = false;
65 CaptureComponent2D->bAlwaysPersistRenderingState = true;
66
68
70}
71
73{
74 Super::Set(Description);
76}
77
78void ASceneCaptureSensor::SetImageSize(uint32 InWidth, uint32 InHeight)
79{
80 ImageWidth = InWidth;
81 ImageHeight = InHeight;
82}
83
84void ASceneCaptureSensor::SetFOVAngle(const float FOVAngle)
85{
86 check(CaptureComponent2D != nullptr);
87 CaptureComponent2D->FOVAngle = FOVAngle;
88}
89
91{
92 check(CaptureComponent2D != nullptr);
93 return CaptureComponent2D->FOVAngle;
94}
95
96void ASceneCaptureSensor::SetExposureMethod(EAutoExposureMethod Method)
97{
98 check(CaptureComponent2D != nullptr);
99 CaptureComponent2D->PostProcessSettings.AutoExposureMethod = Method;
100}
101
102EAutoExposureMethod ASceneCaptureSensor::GetExposureMethod() const
103{
104 check(CaptureComponent2D != nullptr);
105 return CaptureComponent2D->PostProcessSettings.AutoExposureMethod;
106}
107
109{
110 check(CaptureComponent2D != nullptr);
111#if PLATFORM_LINUX
112 // Looks like Windows and Linux have different outputs with the
113 // same exposure compensation, this fixes it.
114 CaptureComponent2D->PostProcessSettings.AutoExposureBias = Compensation + 0.75f;
115#else
116 CaptureComponent2D->PostProcessSettings.AutoExposureBias = Compensation;
117#endif
118}
119
121{
122 check(CaptureComponent2D != nullptr);
123 return CaptureComponent2D->PostProcessSettings.AutoExposureBias;
124}
125
127{
128 check(CaptureComponent2D != nullptr);
129 CaptureComponent2D->PostProcessSettings.CameraShutterSpeed = Speed;
130}
131
133{
134 check(CaptureComponent2D != nullptr);
135 return CaptureComponent2D->PostProcessSettings.CameraShutterSpeed;
136}
137
139{
140 check(CaptureComponent2D != nullptr);
141 CaptureComponent2D->PostProcessSettings.CameraISO = ISO;
142}
143
145{
146 check(CaptureComponent2D != nullptr);
147 return CaptureComponent2D->PostProcessSettings.CameraISO;
148}
149
151{
152 check(CaptureComponent2D != nullptr);
153 CaptureComponent2D->PostProcessSettings.DepthOfFieldFstop = Aperture;
154}
155
157{
158 check(CaptureComponent2D != nullptr);
159 return CaptureComponent2D->PostProcessSettings.DepthOfFieldFstop;
160}
161
163{
164 check(CaptureComponent2D != nullptr);
165 CaptureComponent2D->PostProcessSettings.DepthOfFieldFocalDistance = Distance;
166}
167
169{
170 check(CaptureComponent2D != nullptr);
171 return CaptureComponent2D->PostProcessSettings.DepthOfFieldFocalDistance;
172}
173
175{
176 check(CaptureComponent2D != nullptr);
177 CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurAmount = Amount;
178}
179
181{
182 check(CaptureComponent2D != nullptr);
183 return CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurAmount;
184}
185
187{
188 check(CaptureComponent2D != nullptr);
189 CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurRadius = Radius;
190}
191
193{
194 check(CaptureComponent2D != nullptr);
195 return CaptureComponent2D->PostProcessSettings.DepthOfFieldDepthBlurRadius;
196}
197
199{
200 check(CaptureComponent2D != nullptr);
201 CaptureComponent2D->PostProcessSettings.DepthOfFieldMinFstop = MinFstop;
202}
203
205{
206 check(CaptureComponent2D != nullptr);
207 return CaptureComponent2D->PostProcessSettings.DepthOfFieldMinFstop;
208}
209
211{
212 check(CaptureComponent2D != nullptr);
213 CaptureComponent2D->PostProcessSettings.DepthOfFieldBladeCount = Count;
214}
215
217{
218 check(CaptureComponent2D != nullptr);
219 return CaptureComponent2D->PostProcessSettings.DepthOfFieldBladeCount;
220}
221
223{
224 check(CaptureComponent2D != nullptr);
225 CaptureComponent2D->PostProcessSettings.FilmSlope = Slope;
226}
227
229{
230 check(CaptureComponent2D != nullptr);
231 return CaptureComponent2D->PostProcessSettings.FilmSlope;
232}
233
235{
236 check(CaptureComponent2D != nullptr);
237 CaptureComponent2D->PostProcessSettings.FilmToe = Toe; // FilmToeAmount?
238}
239
241{
242 check(CaptureComponent2D != nullptr);
243 return CaptureComponent2D->PostProcessSettings.FilmToe;
244}
245
247{
248 check(CaptureComponent2D != nullptr);
249 CaptureComponent2D->PostProcessSettings.FilmShoulder = Shoulder;
250}
251
253{
254 check(CaptureComponent2D != nullptr);
255 return CaptureComponent2D->PostProcessSettings.FilmShoulder;
256}
257
259{
260 check(CaptureComponent2D != nullptr);
261 CaptureComponent2D->PostProcessSettings.FilmBlackClip = BlackClip;
262}
263
265{
266 check(CaptureComponent2D != nullptr);
267 return CaptureComponent2D->PostProcessSettings.FilmBlackClip;
268}
269
271{
272 check(CaptureComponent2D != nullptr);
273 CaptureComponent2D->PostProcessSettings.FilmWhiteClip = WhiteClip;
274}
275
277{
278 check(CaptureComponent2D != nullptr);
279 return CaptureComponent2D->PostProcessSettings.FilmWhiteClip;
280}
281
283{
284 check(CaptureComponent2D != nullptr);
285 CaptureComponent2D->PostProcessSettings.AutoExposureMinBrightness = Brightness;
286}
287
289{
290 check(CaptureComponent2D != nullptr);
291 return CaptureComponent2D->PostProcessSettings.AutoExposureMinBrightness;
292}
293
295{
296 check(CaptureComponent2D != nullptr);
297 CaptureComponent2D->PostProcessSettings.AutoExposureMaxBrightness = Brightness;
298}
299
301{
302 check(CaptureComponent2D != nullptr);
303 return CaptureComponent2D->PostProcessSettings.AutoExposureMaxBrightness;
304}
305
307{
308 check(CaptureComponent2D != nullptr);
309 CaptureComponent2D->PostProcessSettings.AutoExposureSpeedDown = Speed;
310}
311
313{
314 check(CaptureComponent2D != nullptr);
315 return CaptureComponent2D->PostProcessSettings.AutoExposureSpeedDown;
316}
317
319{
320 check(CaptureComponent2D != nullptr);
321 CaptureComponent2D->PostProcessSettings.AutoExposureSpeedUp = Speed;
322}
323
325{
326 check(CaptureComponent2D != nullptr);
327 return CaptureComponent2D->PostProcessSettings.AutoExposureSpeedUp;
328}
329
331{
332 check(CaptureComponent2D != nullptr);
333 CaptureComponent2D->PostProcessSettings.AutoExposureCalibrationConstant_DEPRECATED = Constant;
334}
335
337{
338 check(CaptureComponent2D != nullptr);
339 return CaptureComponent2D->PostProcessSettings.AutoExposureCalibrationConstant_DEPRECATED;
340}
341
343{
344 check(CaptureComponent2D != nullptr);
345 CaptureComponent2D->PostProcessSettings.MotionBlurAmount = Intensity;
346}
347
349{
350 check(CaptureComponent2D != nullptr);
351 return CaptureComponent2D->PostProcessSettings.MotionBlurAmount;
352}
353
355{
356 check(CaptureComponent2D != nullptr);
357 CaptureComponent2D->PostProcessSettings.MotionBlurMax = MaxDistortion;
358}
359
361{
362 check(CaptureComponent2D != nullptr);
363 return CaptureComponent2D->PostProcessSettings.MotionBlurMax;
364}
365
367{
368 check(CaptureComponent2D != nullptr);
369 CaptureComponent2D->PostProcessSettings.MotionBlurPerObjectSize = ScreenSize;
370}
371
373{
374 check(CaptureComponent2D != nullptr);
375 return CaptureComponent2D->PostProcessSettings.MotionBlurPerObjectSize;
376}
377
379{
380 check(CaptureComponent2D != nullptr);
381 CaptureComponent2D->PostProcessSettings.LensFlareIntensity = Intensity;
382}
383
385{
386 check(CaptureComponent2D != nullptr);
387 return CaptureComponent2D->PostProcessSettings.LensFlareIntensity;
388}
389
391{
392 check(CaptureComponent2D != nullptr);
393 CaptureComponent2D->PostProcessSettings.BloomIntensity = Intensity;
394}
395
397{
398 check(CaptureComponent2D != nullptr);
399 return CaptureComponent2D->PostProcessSettings.BloomIntensity;
400}
401
403{
404 check(CaptureComponent2D != nullptr);
405 CaptureComponent2D->PostProcessSettings.WhiteTemp = Temp;
406}
407
409{
410 check(CaptureComponent2D != nullptr);
411 return CaptureComponent2D->PostProcessSettings.WhiteTemp;
412}
413
415{
416 check(CaptureComponent2D != nullptr);
417 CaptureComponent2D->PostProcessSettings.WhiteTint = Tint;
418}
419
421{
422 check(CaptureComponent2D != nullptr);
423 return CaptureComponent2D->PostProcessSettings.WhiteTint;
424}
425
427{
428 check(CaptureComponent2D != nullptr);
429 CaptureComponent2D->PostProcessSettings.SceneFringeIntensity = Intensity;
430}
431
433{
434 check(CaptureComponent2D != nullptr);
435 return CaptureComponent2D->PostProcessSettings.SceneFringeIntensity;
436}
437
439{
440 check(CaptureComponent2D != nullptr);
441 CaptureComponent2D->PostProcessSettings.ChromaticAberrationStartOffset = ChromAberrOffset;
442}
443
445{
446 check(CaptureComponent2D != nullptr);
447 return CaptureComponent2D->PostProcessSettings.ChromaticAberrationStartOffset;
448}
449
451 TRACE_CPUPROFILER_EVENT_SCOPE(ASceneCaptureSensor::EnqueueRenderSceneImmediate);
452 // Creates an snapshot of the scene, requieres bCaptureEveryFrame = false.
453 GetCaptureComponent2D()->CaptureScene();
454
455 // // Equivalent to "CaptureComponent2D->CaptureScene" + (optional) GBuffer extraction.
456 // CaptureSceneExtended();
457}
458
459constexpr const TCHAR* GBufferNames[] =
460{
461 TEXT("SceneColor"),
462 TEXT("SceneDepth"),
463 TEXT("SceneStencil"),
464 TEXT("GBufferA"),
465 TEXT("GBufferB"),
466 TEXT("GBufferC"),
467 TEXT("GBufferD"),
468 TEXT("GBufferE"),
469 TEXT("GBufferF"),
470 TEXT("Velocity"),
471 TEXT("SSAO"),
472 TEXT("CustomDepth"),
473 TEXT("CustomStencil"),
474};
475
476template <EGBufferTextureID ID, typename T>
477static void CheckGBufferStream(T& GBufferStream, FGBufferRequest& GBuffer)
478{
479 GBufferStream.bIsUsed = GBufferStream.Stream.AreClientsListening();
480 if (GBufferStream.bIsUsed)
481 GBuffer.MarkAsRequested(ID);
482}
483
484static uint64 Prior = 0;
485
487{
488 auto GBufferPtr = MakeUnique<FGBufferRequest>();
489 auto& GBuffer = *GBufferPtr;
490
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);
504
505 if (GBufferPtr->DesiredTexturesMask == 0)
506 {
507 // Creates an snapshot of the scene, requieres bCaptureEveryFrame = false.
508 CaptureComponent2D->CaptureScene();
509 return;
510 }
511
512 if (Prior != GBufferPtr->DesiredTexturesMask)
513 UE_LOG(LogCarla, Verbose, TEXT("GBuffer selection changed (%llu)."), GBufferPtr->DesiredTexturesMask);
514
515 Prior = GBufferPtr->DesiredTexturesMask;
516 GBufferPtr->OwningActor = CaptureComponent2D->GetViewOwner();
517
518#define CARLA_GBUFFER_DISABLE_TAA // Temporarily disable TAA to avoid jitter.
519
520#ifdef CARLA_GBUFFER_DISABLE_TAA
521 bool bTAA = CaptureComponent2D->ShowFlags.TemporalAA;
522 if (bTAA) {
523 CaptureComponent2D->ShowFlags.TemporalAA = false;
524 }
525#endif
526
527 CaptureComponent2D->CaptureSceneWithGBuffer(GBuffer);
528
529#ifdef CARLA_GBUFFER_DISABLE_TAA
530 if (bTAA) {
531 CaptureComponent2D->ShowFlags.TemporalAA = true;
532 }
533#undef CARLA_GBUFFER_DISABLE_TAA
534#endif
535
536 AsyncTask(ENamedThreads::AnyHiPriThreadNormalTask, [this, GBuffer = MoveTemp(GBufferPtr)]() mutable
537 {
538 SendGBufferTextures(*GBuffer);
539 });
540}
541
542void ASceneCaptureSensor::SendGBufferTextures(FGBufferRequest& GBuffer)
543{
544 SendGBufferTexturesInternal(*this, GBuffer);
545}
546
548{
549 using namespace SceneCaptureSensor_local_ns;
550
551 // Determine the gamma of the player.
552 const bool bInForceLinearGamma = !bEnablePostProcessingEffects;
553
554 CaptureRenderTarget->InitCustomFormat(ImageWidth, ImageHeight, bEnable16BitFormat ? PF_FloatRGBA : PF_B8G8R8A8,
555 bInForceLinearGamma);
556
558 {
559 CaptureRenderTarget->TargetGamma = TargetGamma;
560 }
561
562 check(IsValid(CaptureComponent2D) && !CaptureComponent2D->IsPendingKill());
563
564 CaptureComponent2D->Deactivate();
566
567 // Call derived classes to set up their things.
569
570 CaptureComponent2D->CaptureSource = ESceneCaptureSource::SCS_FinalColorLDR;
571
572 CaptureComponent2D->UpdateContent();
573 CaptureComponent2D->Activate();
574
575 // Make sure that there is enough time in the render queue.
576 UKismetSystemLibrary::ExecuteConsoleCommand(
577 GetWorld(),
578 FString("g.TimeoutForBlockOnRenderFence 300000"));
579
582
583 // This ensures the camera is always spawning the raindrops in case the
584 // weather was previously set to have rain.
586
587 Super::BeginPlay();
588}
589
590void ASceneCaptureSensor::PrePhysTick(float DeltaSeconds)
591{
592 Super::PrePhysTick(DeltaSeconds);
593
594 // Add the view information every tick. It's only used for one tick and then
595 // removed by the streamer.
596 IStreamingManager::Get().AddViewInformation(
597 CaptureComponent2D->GetComponentLocation(),
599 ImageWidth / FMath::Tan(CaptureComponent2D->FOVAngle));
600}
601
602void ASceneCaptureSensor::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime)
603{
604 Super::PostPhysTick(World, TickType, DeltaTime);
605}
606
607void ASceneCaptureSensor::EndPlay(const EEndPlayReason::Type EndPlayReason)
608{
609 Super::EndPlay(EndPlayReason);
610 FlushRenderingCommands();
612}
613
614// =============================================================================
615// -- Local static functions implementations -----------------------------------
616// =============================================================================
617
619
621 {
622 auto &PostProcessSettings = CaptureComponent2D.PostProcessSettings;
623
624 // Exposure
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;
637
638 // Camera
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;
644
645 // Film (Tonemapper)
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;
651
652 // Motion blur
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;
659
660 // Color Grading
661 PostProcessSettings.bOverride_WhiteTemp = true;
662 PostProcessSettings.bOverride_WhiteTint = true;
663 PostProcessSettings.bOverride_ColorContrast = true;
664#if PLATFORM_LINUX
665 // Looks like Windows and Linux have different outputs with the
666 // same exposure compensation, this fixes it.
667 PostProcessSettings.ColorContrast = FVector4(1.2f, 1.2f, 1.2f, 1.0f);
668#endif
669
670 // Chromatic Aberration
671 PostProcessSettings.bOverride_SceneFringeIntensity = true;
672 PostProcessSettings.bOverride_ChromaticAberrationStartOffset = true;
673
674 // Ambient Occlusion
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;
689
690 // Bloom
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;
697
698 // Lens
699 PostProcessSettings.bOverride_LensFlareIntensity = true;
700 PostProcessSettings.LensFlareIntensity = 0.1;
701 }
702
703 // Remove the show flags that might interfere with post-processing effects
704 // like depth and semantic segmentation.
705 static void ConfigureShowFlags(FEngineShowFlags &ShowFlags, bool bPostProcessing)
706 {
707 if (bPostProcessing)
708 {
709 ShowFlags.EnableAdvancedFeatures();
710 ShowFlags.SetMotionBlur(true);
711 return;
712 }
713
714 ShowFlags.SetAmbientOcclusion(false);
715 ShowFlags.SetAntiAliasing(false);
716 ShowFlags.SetVolumetricFog(false);
717 // ShowFlags.SetAtmosphericFog(false);
718 // ShowFlags.SetAudioRadius(false);
719 // ShowFlags.SetBillboardSprites(false);
720 ShowFlags.SetBloom(false);
721 // ShowFlags.SetBounds(false);
722 // ShowFlags.SetBrushes(false);
723 // ShowFlags.SetBSP(false);
724 // ShowFlags.SetBSPSplit(false);
725 // ShowFlags.SetBSPTriangles(false);
726 // ShowFlags.SetBuilderBrush(false);
727 // ShowFlags.SetCameraAspectRatioBars(false);
728 // ShowFlags.SetCameraFrustums(false);
729 ShowFlags.SetCameraImperfections(false);
730 ShowFlags.SetCameraInterpolation(false);
731 // ShowFlags.SetCameraSafeFrames(false);
732 // ShowFlags.SetCollision(false);
733 // ShowFlags.SetCollisionPawn(false);
734 // ShowFlags.SetCollisionVisibility(false);
735 ShowFlags.SetColorGrading(false);
736 // ShowFlags.SetCompositeEditorPrimitives(false);
737 // ShowFlags.SetConstraints(false);
738 // ShowFlags.SetCover(false);
739 // ShowFlags.SetDebugAI(false);
740 // ShowFlags.SetDecals(false);
741 // ShowFlags.SetDeferredLighting(false);
742 ShowFlags.SetDepthOfField(false);
743 ShowFlags.SetDiffuse(false);
744 ShowFlags.SetDirectionalLights(false);
745 ShowFlags.SetDirectLighting(false);
746 // ShowFlags.SetDistanceCulledPrimitives(false);
747 // ShowFlags.SetDistanceFieldAO(false);
748 // ShowFlags.SetDistanceFieldGI(false);
749 ShowFlags.SetDynamicShadows(false);
750 // ShowFlags.SetEditor(false);
751 ShowFlags.SetEyeAdaptation(false);
752 ShowFlags.SetFog(false);
753 // ShowFlags.SetGame(false);
754 // ShowFlags.SetGameplayDebug(false);
755 // ShowFlags.SetGBufferHints(false);
756 ShowFlags.SetGlobalIllumination(false);
757 ShowFlags.SetGrain(false);
758 // ShowFlags.SetGrid(false);
759 // ShowFlags.SetHighResScreenshotMask(false);
760 // ShowFlags.SetHitProxies(false);
761 ShowFlags.SetHLODColoration(false);
762 ShowFlags.SetHMDDistortion(false);
763 // ShowFlags.SetIndirectLightingCache(false);
764 // ShowFlags.SetInstancedFoliage(false);
765 // ShowFlags.SetInstancedGrass(false);
766 // ShowFlags.SetInstancedStaticMeshes(false);
767 // ShowFlags.SetLandscape(false);
768 // ShowFlags.SetLargeVertices(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);
778 // ShowFlags.SetLOD(false);
779 ShowFlags.SetLODColoration(false);
780 // ShowFlags.SetMaterials(false);
781 // ShowFlags.SetMaterialTextureScaleAccuracy(false);
782 // ShowFlags.SetMeshEdges(false);
783 // ShowFlags.SetMeshUVDensityAccuracy(false);
784 // ShowFlags.SetModeWidgets(false);
785 ShowFlags.SetMotionBlur(false);
786 // ShowFlags.SetNavigation(false);
787 ShowFlags.SetOnScreenDebug(false);
788 // ShowFlags.SetOutputMaterialTextureScales(false);
789 // ShowFlags.SetOverrideDiffuseAndSpecular(false);
790 // ShowFlags.SetPaper2DSprites(false);
791 ShowFlags.SetParticles(false);
792 // ShowFlags.SetPivot(false);
793 ShowFlags.SetPointLights(false);
794 // ShowFlags.SetPostProcessing(false);
795 // ShowFlags.SetPostProcessMaterial(false);
796 // ShowFlags.SetPrecomputedVisibility(false);
797 // ShowFlags.SetPrecomputedVisibilityCells(false);
798 // ShowFlags.SetPreviewShadowsIndicator(false);
799 // ShowFlags.SetPrimitiveDistanceAccuracy(false);
800 ShowFlags.SetPropertyColoration(false);
801 // ShowFlags.SetQuadOverdraw(false);
802 // ShowFlags.SetReflectionEnvironment(false);
803 // ShowFlags.SetReflectionOverride(false);
804 ShowFlags.SetRefraction(false);
805 // ShowFlags.SetRendering(false);
806 ShowFlags.SetSceneColorFringe(false);
807 // ShowFlags.SetScreenPercentage(false);
808 ShowFlags.SetScreenSpaceAO(false);
809 ShowFlags.SetScreenSpaceReflections(false);
810 // ShowFlags.SetSelection(false);
811 // ShowFlags.SetSelectionOutline(false);
812 // ShowFlags.SetSeparateTranslucency(false);
813 // ShowFlags.SetShaderComplexity(false);
814 // ShowFlags.SetShaderComplexityWithQuadOverdraw(false);
815 // ShowFlags.SetShadowFrustums(false);
816 // ShowFlags.SetSkeletalMeshes(false);
817 // ShowFlags.SetSkinCache(false);
818 ShowFlags.SetSkyLighting(false);
819 // ShowFlags.SetSnap(false);
820 // ShowFlags.SetSpecular(false);
821 // ShowFlags.SetSplines(false);
822 ShowFlags.SetSpotLights(false);
823 // ShowFlags.SetStaticMeshes(false);
824 ShowFlags.SetStationaryLightOverlap(false);
825 // ShowFlags.SetStereoRendering(false);
826 // ShowFlags.SetStreamingBounds(false);
827 ShowFlags.SetSubsurfaceScattering(false);
828 // ShowFlags.SetTemporalAA(false);
829 // ShowFlags.SetTessellation(false);
830 // ShowFlags.SetTestImage(false);
831 // ShowFlags.SetTextRender(false);
832 // ShowFlags.SetTexturedLightProfiles(false);
833 ShowFlags.SetTonemapper(false);
834 // ShowFlags.SetTranslucency(false);
835 // ShowFlags.SetVectorFields(false);
836 // ShowFlags.SetVertexColors(false);
837 // ShowFlags.SetVignette(false);
838 // ShowFlags.SetVisLog(false);
839 // ShowFlags.SetVisualizeAdaptiveDOF(false);
840 // ShowFlags.SetVisualizeBloom(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);
854 // ShowFlags.SetVolumeLightingSamples(false);
855 // ShowFlags.SetVolumes(false);
856 // ShowFlags.SetWidgetComponents(false);
857 // ShowFlags.SetWireframe(false);
858 }
859
860} // namespace SceneCaptureSensor_local_ns
static auto SCENE_CAPTURE_COUNTER
constexpr const TCHAR * GBufferNames[]
static uint64 Prior
static void CheckGBufferStream(T &GBufferStream, FGBufferRequest &GBuffer)
static bool IsValid(const ACarlaWheeledVehicle *Vehicle)
void SetExposureMethod(EAutoExposureMethod Method)
void SetFOVAngle(float FOVAngle)
virtual void PrePhysTick(float DeltaSeconds) override
float GetMotionBlurMaxDistortion() const
void SetShutterSpeed(float Speed)
void SetImageSize(uint32 Width, uint32 Height)
void SetChromAberrIntensity(float Intensity)
float GetDepthOfFieldMinFstop() const
void SetMotionBlurMinObjectScreenSize(float ScreenSize)
void Set(const FActorDescription &ActorDescription) override
float GetChromAberrOffset() const
void SetFilmShoulder(float Shoulder)
void SetExposureCompensation(float Compensation)
void SetMotionBlurMaxDistortion(float MaxDistortion)
void SetDepthBlurAmount(float Amount)
void SetExposureMaxBrightness(float Brightness)
struct ASceneCaptureSensor::@0 CameraGBuffers
float GetLensFlareIntensity() const
void SetWhiteTemp(float Temp)
void SetFilmBlackClip(float BlackClip)
virtual void SendGBufferTextures(FGBufferRequest &GBuffer)
float GetMotionBlurMinObjectScreenSize() const
void SetExposureCalibrationConstant(float Constant)
void SetAperture(float Aperture)
uint32 ImageWidth
Image width in pixels.
void SetDepthBlurRadius(float Radius)
void SetFocalDistance(float Distance)
void SetChromAberrOffset(float ChromAberrOffset)
USceneCaptureComponent2D * GetCaptureComponent2D()
float GetExposureMaxBrightness() const
void SetLensFlareIntensity(float Intensity)
void SetBladeCount(int Count)
UTextureRenderTarget2D * CaptureRenderTarget
Render target necessary for scene capture.
float GetChromAberrIntensity() const
void EnqueueRenderSceneImmediate()
Immediate enqueues render commands of the scene at the current time.
void SetFilmWhiteClip(float WhiteClip)
void SetBloomIntensity(float Intensity)
void SetMotionBlurIntensity(float Intensity)
virtual void SetUpSceneCaptureComponent(USceneCaptureComponent2D &SceneCapture)
uint32 ImageHeight
Image height in pixels.
float GetExposureSpeedDown() const
void SetDepthOfFieldMinFstop(float MinFstop)
bool bEnable16BitFormat
Whether to change render target format to PF_A16B16G16R16, offering 16bit / channel
bool bEnablePostProcessingEffects
Whether to render the post-processing effects present in the scene.
float GetExposureCalibrationConstant() const
virtual void BeginPlay() override
float GetExposureCompensation() const
void SetWhiteTint(float Tint)
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
ASceneCaptureSensor(const FObjectInitializer &ObjectInitializer)
EAutoExposureMethod GetExposureMethod() const
float GetExposureMinBrightness() const
void SetExposureSpeedDown(float Speed)
USceneCaptureComponent2D_CARLA * CaptureComponent2D
Scene capture component.
void SetFilmSlope(float Slope)
void SetExposureSpeedUp(float Speed)
float GetMotionBlurIntensity() const
void SetExposureMinBrightness(float Brightness)
virtual void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaTime) override
void SendGBufferTexturesInternal(T &Self, FGBufferRequest &GBufferData)
void NotifyWeather(ASensor *Sensor=nullptr)
Notifing the weather to the blueprint's event
Definition Weather.cpp:76
static void SetCamera(const FActorDescription &Description, ASceneCaptureSensor *Camera)
AWeather * GetWeather() const
static UCarlaSettings * GetCarlaSettings(const UObject *WorldContextObject)
virtual const AActor * GetViewOwner() const override
static void SetCameraDefaultOverrides(USceneCaptureComponent2D &CaptureComponent2D)
static void ConfigureShowFlags(FEngineShowFlags &ShowFlags, bool bPostProcessing=true)
static auto GetQualitySettings(UWorld *World)
A description of a Carla Actor with all its variation.