CARLA
Loading...
Searching...
No Matches
SceneCaptureCamera_RayTracedLensInstance.h
Go to the documentation of this file.
1// Copyright (c) 2026 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#pragma once
8
11
12#include "SceneCaptureCamera_RayTracedLensInstance.generated.h"
13
14/// A path-traced instance/semantic sensor ("sensor.camera.rt_lens_instance"):
15/// the labelling twin of sensor.camera.rt_lens.
16///
17/// It renders through exactly the same lens as ASceneCaptureCamera_RayTracedLens
18/// -- same attributes, same Set(), same show_only_* filtering, evaluated per ray
19/// inside the path tracer -- but instead of radiance it outputs, for every
20/// pixel, the CARLA tag of the primary hit, in the byte layout
21/// sensor.camera.instance_segmentation already uses:
22///
23/// R = semantic label (ATagger's crp::CityObjectLabel)
24/// G = actor id, low byte
25/// B = actor id, high byte
26///
27/// so the same client-side decode works for both, and the semantic image is
28/// just the R channel of this one.
29///
30/// The tag comes from the same place as the raster path's: ATagger writes it
31/// into custom primitive data slot 4 (Carla/Game/Tagger.cpp), which the raster
32/// segmentation pass reads as CustomPrimitiveData[1].xy
33/// (Engine/Shaders/Private/SegmentationSensor.usf). The path tracer's
34/// closest-hit shader reads the very same GPUScene field and carries it to the
35/// ray generation shader in the material payload, which records it into a
36/// dedicated R32_UINT render-graph texture next to the albedo/normal/depth AOVs
37/// (FPostProcessSettings::PathTracingLensAOV == 2, PathTracer.LensTag). The
38/// capture resolves that texture through
39/// ESceneCaptureSource::SCS_PathTracingLensTag.
40///
41/// Why the raster pass cannot simply be reused: ShowFlags.PathTracing makes
42/// FDeferredShadingSceneRenderer treat the frame as a ray-traced overlay and
43/// skip the depth prepass, base pass and Nanite raster entirely, so
44/// AddSegmentationSensorPass would silently produce an empty or stale buffer
45/// rather than fail.
46///
47/// Nothing on this route applies exposure, tone mapping, denoising or
48/// filtering, and the primary ray is fired through the exact pixel centre, so
49/// the ids are exact 8-bit values, never blended between two actors.
50UCLASS()
52{
53 GENERATED_BODY()
54
55public:
56
57 static FActorDefinition GetSensorDefinition();
58
59 ASceneCaptureCamera_RayTracedLensInstance(const FObjectInitializer &ObjectInitializer);
60
61 void Set(const FActorDescription &ActorDescription) override;
62
63protected:
64
65 void BeginPlay() override;
66
67 void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override;
68
69private:
70
71 /// Re-asserts everything that makes this capture a tag AOV rather than a
72 /// colour render. Called from Set() and from every tick, because several code
73 /// paths replace the capture component's PostProcessSettings wholesale (see
74 /// the note in ASceneCaptureCamera_RayTracedLens::PostPhysTick).
75 void ApplyInstanceAOVConfig();
76};
A path-traced instance/semantic sensor ("sensor.camera.rt_lens_instance"): the labelling twin of sens...
A path-traced camera sensor ("sensor.camera.rt_lens") that renders through a configurable lens model ...
A definition of a Carla Actor with all the variation and attributes.
A description of a Carla Actor with all its variation.