CARLA
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
FCarlaShowOnlyFilter Struct Reference

Show-only ("render layer") filter shared by every scene-capture camera. More...

#include <ShowOnlyFilter.h>

Public Types

using Label = carla::rpc::CityObjectLabel
 

Public Member Functions

void ApplyTo (USceneCaptureComponent2D &Capture) const
 Push the current list into Capture (or restore full-scene rendering when the filter is disabled).
 
int32 GetCachedActorCount () const
 
const TSet< Label > & GetShadowCatcherTags () const
 
const TSet< uint32 > & GetShowOnlyActorIds () const
 
const TSet< Label > & GetShowOnlyTags () const
 
bool IsEnabled () const
 
void MarkDirty ()
 Force a rescan on the next Refresh.
 
void Refresh (UWorld *World, const UCarlaEpisode *Episode)
 Rebuild the cached actor list if the world changed since the last call.
 
void SetShadowCatcherTags (const FString &CommaSeparated)
 
void SetShowOnlyActorIds (const FString &CommaSeparated)
 
void SetShowOnlyTags (const FString &CommaSeparated)
 

Static Public Member Functions

static bool ParseLabels (const FString &CommaSeparated, TSet< Label > &OutLabels, FString &OutUnknown)
 Parse a comma separated list of label names into OutLabels using the tagger's own name mapping.
 

Private Member Functions

void Rescan (UWorld *World, const UCarlaEpisode *Episode)
 

Private Attributes

TSet< uint32 > ActorIds
 
bool bDirty = true
 
TArray< TWeakObjectPtr< AActor > > CachedActors
 
int32 LastActorCount = -1
 
TSet< Label > ShadowCatcherTags
 
TSet< Label > ShowOnlyTags
 

Detailed Description

Show-only ("render layer") filter shared by every scene-capture camera.

Selected through three blueprint attributes:

show_only_tags comma separated CARLA semantic label names ("Car,Truck,Bus,Motorcycle,Bicycle,Pedestrians"). shadow_catcher_tags same format; actors carrying these labels are rendered too so they can receive the cast shadows of the show-only actors ("Roads,Sidewalks"). show_only_actor_ids comma separated CARLA actor ids, added to the list whatever their labels.

When show_only_tags or show_only_actor_ids is non-empty the capture components switch to PRM_UseShowOnlyList and their ShowOnlyActors list is the set of world actors carrying at least one of the labels (any primitive component, ATagger label tag or custom-depth stencil), plus the id list. Everything else is neither rendered nor casts shadows into the capture (the renderer filters shadow casters through the same list), so the empty pixels carry only the sky / atmosphere in colour captures, stencil 0 in the segmentation captures and the far plane in depth.

The actor scan runs only when the world's actor count changes (spawn or destroy) so newly spawned vehicles show up on the next capture; every other tick costs one integer compare plus copying the cached list into the capture components.

Definition at line 48 of file ShowOnlyFilter.h.

Member Typedef Documentation

◆ Label

Definition at line 50 of file ShowOnlyFilter.h.

Member Function Documentation

◆ ApplyTo()

void FCarlaShowOnlyFilter::ApplyTo ( USceneCaptureComponent2D &  Capture) const

Push the current list into Capture (or restore full-scene rendering when the filter is disabled).

Definition at line 173 of file ShowOnlyFilter.cpp.

References CachedActors, and IsEnabled().

Referenced by ASceneCaptureSensor_WideAngleLens::CaptureSceneExtended(), and ASceneCaptureSensor::EnqueueRenderSceneImmediate().

◆ GetCachedActorCount()

int32 FCarlaShowOnlyFilter::GetCachedActorCount ( ) const
inline

Definition at line 84 of file ShowOnlyFilter.h.

◆ GetShadowCatcherTags()

const TSet< Label > & FCarlaShowOnlyFilter::GetShadowCatcherTags ( ) const
inline

Definition at line 69 of file ShowOnlyFilter.h.

◆ GetShowOnlyActorIds()

const TSet< uint32 > & FCarlaShowOnlyFilter::GetShowOnlyActorIds ( ) const
inline

Definition at line 70 of file ShowOnlyFilter.h.

◆ GetShowOnlyTags()

const TSet< Label > & FCarlaShowOnlyFilter::GetShowOnlyTags ( ) const
inline

Definition at line 68 of file ShowOnlyFilter.h.

◆ IsEnabled()

bool FCarlaShowOnlyFilter::IsEnabled ( ) const
inline

◆ MarkDirty()

void FCarlaShowOnlyFilter::MarkDirty ( )
inline

Force a rescan on the next Refresh.

Definition at line 82 of file ShowOnlyFilter.h.

◆ ParseLabels()

bool FCarlaShowOnlyFilter::ParseLabels ( const FString &  CommaSeparated,
TSet< Label > &  OutLabels,
FString &  OutUnknown 
)
static

Parse a comma separated list of label names into OutLabels using the tagger's own name mapping.

Returns false and fills OutUnknown with the tokens that map to no label (they are skipped).

Definition at line 20 of file ShowOnlyFilter.cpp.

References ATagger::GetTagFromString().

Referenced by SetShadowCatcherTags(), and SetShowOnlyTags().

◆ Refresh()

void FCarlaShowOnlyFilter::Refresh ( UWorld *  World,
const UCarlaEpisode *  Episode 
)

Rebuild the cached actor list if the world changed since the last call.

Cheap when nothing changed. Episode may be null (ids are then ignored).

Definition at line 102 of file ShowOnlyFilter.cpp.

References bDirty, IsEnabled(), LastActorCount, and Rescan().

Referenced by ASceneCaptureSensor_WideAngleLens::CaptureSceneExtended(), and ASceneCaptureSensor::EnqueueRenderSceneImmediate().

◆ Rescan()

void FCarlaShowOnlyFilter::Rescan ( UWorld *  World,
const UCarlaEpisode *  Episode 
)
private

◆ SetShadowCatcherTags()

void FCarlaShowOnlyFilter::SetShadowCatcherTags ( const FString &  CommaSeparated)

◆ SetShowOnlyActorIds()

void FCarlaShowOnlyFilter::SetShowOnlyActorIds ( const FString &  CommaSeparated)

Definition at line 77 of file ShowOnlyFilter.cpp.

References ActorIds, and bDirty.

◆ SetShowOnlyTags()

void FCarlaShowOnlyFilter::SetShowOnlyTags ( const FString &  CommaSeparated)

Definition at line 61 of file ShowOnlyFilter.cpp.

References bDirty, ParseLabels(), ShowOnlyFilter_WarnUnknown(), and ShowOnlyTags.

Member Data Documentation

◆ ActorIds

TSet<uint32> FCarlaShowOnlyFilter::ActorIds
private

Definition at line 92 of file ShowOnlyFilter.h.

Referenced by Rescan(), and SetShowOnlyActorIds().

◆ bDirty

bool FCarlaShowOnlyFilter::bDirty = true
private

◆ CachedActors

TArray<TWeakObjectPtr<AActor> > FCarlaShowOnlyFilter::CachedActors
private

Definition at line 94 of file ShowOnlyFilter.h.

Referenced by ApplyTo(), and Rescan().

◆ LastActorCount

int32 FCarlaShowOnlyFilter::LastActorCount = -1
private

Definition at line 95 of file ShowOnlyFilter.h.

Referenced by Refresh().

◆ ShadowCatcherTags

TSet<Label> FCarlaShowOnlyFilter::ShadowCatcherTags
private

Definition at line 91 of file ShowOnlyFilter.h.

Referenced by Rescan(), and SetShadowCatcherTags().

◆ ShowOnlyTags

TSet<Label> FCarlaShowOnlyFilter::ShowOnlyTags
private

Definition at line 90 of file ShowOnlyFilter.h.

Referenced by Rescan(), and SetShowOnlyTags().


The documentation for this struct was generated from the following files: