15#include <util/ue-header-guard-begin.h>
16#include "Components/SceneCaptureComponent2D.h"
17#include "Engine/TextureRenderTarget2D.h"
18#include <util/ue-header-guard-end.h>
34 constexpr bool bEnableModifyingPostProcessEffects =
false;
37 TEXT(
"rt_lens_distance"),
38 bEnableModifyingPostProcessEffects);
46 if (Variation.Id == TEXT(
"samples_per_pixel"))
48 Variation.RecommendedValues = {TEXT(
"1")};
50 else if (Variation.Id == TEXT(
"enable_denoiser"))
52 Variation.RecommendedValues = {TEXT(
"false")};
59 const FObjectInitializer &ObjectInitializer)
60 : Super(ObjectInitializer)
80 PostProcessSettings.bOverride_PathTracingLensAOV =
true;
88 PostProcessSettings.bOverride_PathTracingSamplesPerPixel =
true;
89 PostProcessSettings.bOverride_PathTracingEnableDenoiser =
true;
104 Super::Set(Description);
118 RenderTarget->InitCustomFormat(
156 if (RenderTarget ==
nullptr)
163 [
this, CaptureContext](
164 const void *MappedPtr,
168 FIntPoint Extent) ->
bool
170 if (MappedPtr ==
nullptr || Format != PF_R32_FLOAT)
174 check(RowPitch >= (
size_t)Extent.X);
175 check(BufferHeight >= (
size_t)Extent.Y);
177 TArray<float> Distances;
178 Distances.Reserve(Extent.X * Extent.Y);
179 auto RowPtr =
reinterpret_cast<const float *
>(MappedPtr);
180 for (int32 Y = 0; Y != Extent.Y; ++Y)
182 for (int32 X = 0; X != Extent.X; ++X)
static constexpr float GUnrealUnitsToMeters
static constexpr int32 GPathTracingLensAOVDistance
void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override
void BeginPlay() override
void Set(const FActorDescription &ActorDescription) override
ASceneCaptureCamera_RayTracedLensDistance(const FObjectInitializer &ObjectInitializer)
void ApplyDistanceAOVConfig()
Re-asserts everything that makes this capture a geometry AOV rather than a colour render.
static FActorDefinition GetSensorDefinition()
FLensModelDescriptor LensModel
Resolved lens-model parameters, rebuilt in Set() from the camera_model / distortion_coeffs / lut / fx...
int32 SamplesPerPixel
Path-tracer quality knobs.
void TickCaptureAndReadback(UWorld *World, ELevelTick TickType, float DeltaSeconds, TFunctionRef< void(bool bNonBlocking, const FSensorCaptureContext &Context)> EnqueueReadback)
Runs this tick's capture and this tick's readback in the order the world's synchronization mode requi...
UTextureRenderTarget2D * GetCaptureRenderTarget()
TObjectPtr< USceneCaptureComponent2D_CARLA > CaptureComponent2D
Scene capture component.
void EnablePostProcessingEffects(bool Enable=true)
void SetFocalDistance(float Distance)
uint32 GetImageHeight() const
uint32 GetImageWidth() const
FRHIGPUReadbackPoolPtr GetReadbackPool() const
Per-sensor pool of recyclable RHI readback objects.
static void SendDataToClient(SensorType &&Sensor, TArrayView< ElementType > SensorData, const FSensorCaptureContext &CaptureContext)
bool AreClientsListening()
static FActorDefinition MakeRayTracedLensCameraDefinition(const FString &Id, bool bEnableModifyingPostProcessEffects=false)
bool ReadImageDataAsync(UTextureRenderTarget2D &RenderTarget, FRHIGPUReadbackPoolPtr Pool, ReadImageDataAsyncCallback &&Callback, bool bNonBlocking)
void ApplyLensModel(FPostProcessSettings &PostProcessSettings, const FLensModelDescriptor &Descriptor)
A definition of a Carla Actor with all the variation and attributes.
TArray< FActorVariation > Variations
Variations represent variables the user can modify to generate variations of the actor.
A description of a Carla Actor with all its variation.
Sensor frame metadata snapshotted at capture time, carried by value through async delivery instead of...