CARLA
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AOpenDriveGenerator Class Reference

#include <OpenDriveGenerator.h>

+ Inheritance diagram for AOpenDriveGenerator:

Classes

struct  FRoadSurfaceRaster
 The authoritative "what is road surface, where, at what height" tool the rest of generation consumes. More...
 

Public Member Functions

 AOpenDriveGenerator (const FObjectInitializer &ObjectInitializer)
 
void DumpRasterAt (float X, float Y) const
 Debug: log the raster's weld/height record in a 3x3 cell block around (X, Y) in UE cm.
 
void GenerateAll ()
 
void GenerateCrosswalkMesh ()
 Generates the crosswalk mesh based on the OpenDRIVE information.
 
void GenerateGroundPlane ()
 Generates a terrain-following heightfield beneath the generated road network so gaps in the road/sidewalk mesh (roundabout centers, area beyond the shoulders, etc.) don't show blue sky through the ground.
 
void GenerateLaneMarkings ()
 Generates the lane-marking meshes (white/yellow) based on the OpenDRIVE information.
 
void GenerateMedianFill ()
 Annotates the narrow unmapped strips between parallel carriageway roads so the terrain lofts flush across them.
 
void GeneratePoles ()
 Scatters street furniture (lamp poles, roadside vegetation, signage) along the generated road network.
 
void GenerateRoadMesh ()
 Generates the road and sidewalk mesh based on the OpenDRIVE information.
 
void GenerateSpawnPoints ()
 Generates spawn points along the road.
 
const FString & GetOpenDrive () const
 Get the OpenDRIVE information as string.
 
bool IsOpenDriveValid () const
 Checks if the OpenDrive has been loaded and it's valid.
 
bool IsStreetFurnitureGenerating () const
 True while the street-furniture PCG scatter is still spawning; it finishes over the next frames.
 
bool LoadOpenDrive (const FString &OpenDrive)
 Set the OpenDRIVE information as string and generates the queryable map structure.
 
void RunGenerationQA ()
 Systematic post-generation validation, run automatically shortly after GenerateAll (delayed so the async PCG scatter has spawned its content) and re-runnable on demand via the console command "carla.MapGenQA".
 

Protected Member Functions

virtual void BeginPlay () override
 
int32 GenerateFurnitureAnchors (const FName &Tag, float Spacing, float Offset, float RoadClearance, bool bMeasureFromCurb, bool bKeepOnSidewalk, float SOffset)
 Spawns one AProceduralFurnitureAnchor per transform returned by Map::GetTreesTransform for the given spacing/offset, tagged for the PCG graph to pick up, re-grounded onto pavement/terrain and filtered against driving lanes with the given clearance (cm) past the lane half-width.
 
float SampleGroundGridHeight (float X, float Y) const
 Bilinear interpolation of GroundGridHeights at a world XY position.
 

Protected Attributes

TArray< TObjectPtr< AActor > > ActorMeshList
 
TSoftObjectPtr< UMaterialInterface > CrosswalkMaterial
 Material applied to the zebra-bar crosswalk meshes.
 
float DecalZOffset = 1.5f
 Vertical offset (cm) applied to crosswalk and lane-marking meshes above the road surface, to avoid z-fighting with the road mesh section.
 
FBox FurnitureAnchorBounds = FBox(ForceInit)
 Accumulated bounding box of every furniture anchor spawned for the current generation, in world space; drives PCGBoundsComponent.
 
TArray< float > GroundGridHeights
 Evaluated ground heightfield (final terrain surface z per grid vertex, row-major, GroundGridNumY rows of GroundGridNumX), retained after GenerateGroundPlane so GenerateFurnitureAnchors can re-ground scattered objects onto the terrain they'll actually stand on.
 
int32 GroundGridNumX = 0
 
int32 GroundGridNumY = 0
 
FVector2D GroundGridOrigin = FVector2D::ZeroVector
 
float GroundGridStepX = 0.0f
 
float GroundGridStepY = 0.0f
 
float GroundHeightSampleCellSize = 250.0f
 XY cell size (cm) of RoadRaster.
 
TSoftObjectPtr< UMaterialInterface > GroundMaterial
 Material applied to the ground plane (see GenerateGroundPlane).
 
float GroundPlanePadding = 5000.0f
 How far (cm) the ground plane extends past the generated road/sidewalk bounding box on each side, so the fill doesn't end exactly at the outermost shoulder.
 
float GroundPlaneZOffset = 5.0f
 Vertical offset (cm) applied below the road surface height where the terrain runs under road geometry – large enough to avoid z-fighting, small enough that the road visibly rests on the ground (the generation QA requires terrain within 10cm of the road underside, see RunGenerationQA).
 
float GroundSkirtWidth = 1000.0f
 Width (cm) of the blend band past the road footprint over which the terrain transitions from exactly hugging the road underside to the free B-spline surface.
 
float GroundUVTileSize = 500.0f
 World-space size (cm) of one UV tile on the ground plane, i.e.
 
float LampAnchorOffset = 1.0f
 Lateral offset (m) of lamp anchors past the curb line (the outer edge of the last roadway lane: parking/bike/border lanes included), clamped to the middle of the sidewalk lane that follows when there is one – the pole base stands on the pavement next to the curb.
 
float LampAnchorSpacing = 30.0f
 Spacing (m) between lamp anchors along each road.
 
FName LampAnchorTag = FName("PCG_StreetLampAnchor")
 Tag used to mark lamp-pole anchor points for the PCG graph to sample.
 
float LampRoadClearance = 50.0f
 Per-category clearance (cm) beyond the lane half-width that street furniture must keep from the nearest driving-lane centerline; anchors closer than this are discarded so scattered objects can't stand on or overhang the roadway where lanes widen, merge or overlap.
 
TSoftObjectPtr< UMaterialInterface > LaneMarkingWhiteMaterial
 Material applied to white lane-marking meshes.
 
TSoftObjectPtr< UMaterialInterface > LaneMarkingYellowMaterial
 Material applied to yellow lane-marking meshes (centre line).
 
float MedianFillMaxHeightDelta = 100.0f
 Max height split (cm) of the driving surface samples WITHIN a single raster cell near a gap cell for it to be filled – a gap under an overpass sees both decks and must not be bridged at the wrong height.
 
float MedianFillMaxWidth = 600.0f
 Widest gap (cm) between opposing driving surfaces that GenerateMedianFill closes with road surface; wider separations are genuine verges and stay terrain.
 
FString OpenDriveData
 
TObjectPtr< UBoxComponent > PCGBoundsComponent
 Provides the PCG component's generation bounds: PCG derives its grid bounds from the owner actor's component bounds, and this actor has no visible geometry of its own – without a bounded component the graph aborts at Generate() with "Component has invalid bounds, not registered nor updated" and never schedules a task.
 
TObjectPtr< UPCGComponent > PCGComponent
 Drives the runtime PCG scatter (see GeneratePoles).
 
float QAStackedRoadGap = 400.0f
 Min z spread (cm) within one sample cell that marks it as stacked roads (bridge over road) rather than a single surface.
 
float QASupportGapMax = 30.0f
 Max allowed gap (cm) between a road cell's lowest surface and the terrain below it before the cell counts as a floating road.
 
TSoftObjectPtr< UMaterialInterface > RoadMaterial
 Material applied to driving-lane mesh sections.
 
FBox RoadMeshBounds = FBox(ForceInit)
 World-space bounding box of every road/sidewalk vertex generated by GenerateRoadMesh, accumulated there and consumed by GenerateGroundPlane to size and position the fill quad – mirrors how FurnitureAnchorBounds drives PCGBoundsComponent below.
 
FRoadSurfaceRaster RoadRaster
 
TSoftObjectPtr< UMaterialInterface > SidewalkMaterial
 Material applied to sidewalk mesh sections.
 
float SignageAnchorOffset = 1.0f
 Lateral offset (m) of signage anchors past the curb line, clamped onto the sidewalk like the lamps (same row, phased half a lamp spacing along the road so the two never coincide).
 
float SignageAnchorSpacing = 150.0f
 Spacing (m) between signage anchors along each road.
 
FName SignageAnchorTag = FName("PCG_SignageAnchor")
 Tag used to mark decorative-signage anchor points.
 
float SignageRoadClearance = 50.0f
 
float SpawnersHeight = 300.f
 Determine the height where the spawners will be placed, relative to each RoutePlanner.
 
TSoftObjectPtr< UPCGGraphInterface > StreetFurnitureGraph
 PCG graph asset that samples the tagged anchors below (via a "Get Actor Data" node per category, ActorSelector = {ByTag, AllWorldActors, <tag>, bSelectMultiple=true}, Mode = GetSinglePoint) and spawns lamp, vegetation, and signage actors/meshes at each point.
 
int32 StreetFurnitureSeed = 42
 PCG seed of the furniture scatter; with it, every server and run places the same furniture and banners.
 
float VegetationAnchorOffset = 6.0f
 Lateral offset (m) of vegetation anchors – set past the lamp row so poles and trees don't overlap.
 
float VegetationAnchorSpacing = 15.0f
 Spacing (m) between vegetation anchors along each road.
 
FName VegetationAnchorTag = FName("PCG_VegetationAnchor")
 Tag used to mark roadside-vegetation anchor points.
 
float VegetationRoadClearance = 250.0f
 
TArray< TObjectPtr< AVehicleSpawnPoint > > VehicleSpawners
 

Detailed Description

Definition at line 55 of file OpenDriveGenerator.h.

Constructor & Destructor Documentation

◆ AOpenDriveGenerator()

AOpenDriveGenerator::AOpenDriveGenerator ( const FObjectInitializer &  ObjectInitializer)

Definition at line 548 of file OpenDriveGenerator.cpp.

References PCGBoundsComponent, and PCGComponent.

Member Function Documentation

◆ BeginPlay()

void AOpenDriveGenerator::BeginPlay ( )
overrideprotectedvirtual

Definition at line 2210 of file OpenDriveGenerator.cpp.

References GenerateAll(), UOpenDrive::GetXODR(), and LoadOpenDrive().

◆ DumpRasterAt()

void AOpenDriveGenerator::DumpRasterAt ( float  X,
float  Y 
) const

◆ GenerateAll()

void AOpenDriveGenerator::GenerateAll ( )

◆ GenerateCrosswalkMesh()

void AOpenDriveGenerator::GenerateCrosswalkMesh ( )

◆ GenerateFurnitureAnchors()

int32 AOpenDriveGenerator::GenerateFurnitureAnchors ( const FName &  Tag,
float  Spacing,
float  Offset,
float  RoadClearance,
bool  bMeasureFromCurb,
bool  bKeepOnSidewalk,
float  SOffset 
)
protected

Spawns one AProceduralFurnitureAnchor per transform returned by Map::GetTreesTransform for the given spacing/offset, tagged for the PCG graph to pick up, re-grounded onto pavement/terrain and filtered against driving lanes with the given clearance (cm) past the lane half-width.

bMeasureFromCurb/bKeepOnSidewalk select the curb-based placement (see LampAnchorOffset); SOffset (m) phases the row along each road. Returns the number of anchors spawned.

Definition at line 1788 of file OpenDriveGenerator.cpp.

References ActorMeshList, AOpenDriveGenerator::FRoadSurfaceRaster::CellAtWorld(), FurnitureAnchorBounds, UCarlaStatics::GetGameMode(), ACarlaGameModeBase::GetMap(), GroundGridNumX, GroundGridNumY, RoadRaster, and SampleGroundGridHeight().

Referenced by GeneratePoles().

◆ GenerateGroundPlane()

void AOpenDriveGenerator::GenerateGroundPlane ( )

Generates a terrain-following heightfield beneath the generated road network so gaps in the road/sidewalk mesh (roundabout centers, area beyond the shoulders, etc.) don't show blue sky through the ground.

The terrain surface is a multilevel B-spline approximation (Lee, Wolberg & Shin 1997) fit to the road height samples in GroundHeightSampleGrid: a coarse-to-fine hierarchy of uniform cubic B-spline lattices, each level fit to the residual left by the previous one, giving a C2-smooth surface that follows the road network's vertical curvature instead of a piecewise-linear patchwork that pokes through sag curves and drops away under crests. Near roads the surface is additionally clamped to GroundPlaneZOffset below the lowest nearby road sample so smoothing can never push terrain up through the road. Must run after GenerateRoadMesh(), which is what populates RoadMeshBounds and GroundHeightSampleGrid.

Definition at line 777 of file OpenDriveGenerator.cpp.

References ActorMeshList, AOpenDriveGenerator::FRoadSurfaceRaster::CellAtWorld(), AOpenDriveGenerator::FRoadSurfaceRaster::Cells, AOpenDriveGenerator::FRoadSurfaceRaster::CellSize, carla::rpc::OpendriveGenerationParameters::enable_mesh_visibility, UCarlaStatics::GetGameInstance(), UCarlaStatics::GetGameMode(), ACarlaGameModeBase::GetMap(), UCarlaGameInstance::GetOpendriveGenerationParameters(), GroundGridHeights, GroundGridNumX, GroundGridNumY, GroundGridOrigin, GroundGridStepX, GroundGridStepY, GroundHeightSampleCellSize, GroundMaterial, GroundPlanePadding, GroundPlaneZOffset, GroundSkirtWidth, GroundUVTileSize, AOpenDriveGenerator::FRoadSurfaceRaster::Height, IsOpenDriveValid(), AOpenDriveGenerator::FRoadSurfaceRaster::IsValid(), ACarlaProceduralMeshActor::MeshComponent, FProceduralCustomMesh::Normals, AOpenDriveGenerator::FRoadSurfaceRaster::OriginX, AOpenDriveGenerator::FRoadSurfaceRaster::OriginY, RoadMeshBounds, RoadRaster, FProceduralCustomMesh::Triangles, FProceduralCustomMesh::UV0, FProceduralCustomMesh::Vertices, and AOpenDriveGenerator::FRoadSurfaceRaster::Width.

Referenced by GenerateAll().

◆ GenerateLaneMarkings()

void AOpenDriveGenerator::GenerateLaneMarkings ( )

◆ GenerateMedianFill()

void AOpenDriveGenerator::GenerateMedianFill ( )

Annotates the narrow unmapped strips between parallel carriageway roads so the terrain lofts flush across them.

Real-world OpenDRIVE exports (NuRec DeepMap) model each direction of a dual carriageway as a separate road and leave the median/gore strip between them unmapped – the sunken terrain showed through as a pit below road level and read as broken road surface (and paving the strip with asphalt quads instead left floating plates wherever the gap widened and the free terrain fell away underneath). Finds gap cells via a morphological closing of the genuinely-covered driving footprint (within MedianFillMaxWidth, rejecting overpass gaps) and writes a lofted road-surface height per cell (FCell::GapSurfaceZ); GenerateGroundPlane raises the grass flush to it. Must run after GenerateRoadMesh and before GenerateGroundPlane.

Definition at line 1227 of file OpenDriveGenerator.cpp.

References AOpenDriveGenerator::FRoadSurfaceRaster::Cells, AOpenDriveGenerator::FRoadSurfaceRaster::CellSize, AOpenDriveGenerator::FRoadSurfaceRaster::Height, AOpenDriveGenerator::FRoadSurfaceRaster::IsValid(), MedianFillMaxHeightDelta, MedianFillMaxWidth, RoadRaster, and AOpenDriveGenerator::FRoadSurfaceRaster::Width.

Referenced by GenerateAll().

◆ GeneratePoles()

void AOpenDriveGenerator::GeneratePoles ( )

Scatters street furniture (lamp poles, roadside vegetation, signage) along the generated road network.

Emits tagged AProceduralFurnitureAnchor markers via Map::GetTreesTransform (reused as-is: it already walks each non-junction road's outermost driving lane at regular s-intervals and offsets outward past the sidewalk – exactly what furniture placement needs, no new LibCarla code required), then triggers the runtime PCG graph (see PCGComponent/StreetFurnitureGraph) that samples them by tag and spawns the actual content.

Definition at line 1896 of file OpenDriveGenerator.cpp.

References CVarOpenDriveStreetFurniture(), FurnitureAnchorBounds, GenerateFurnitureAnchors(), IsOpenDriveValid(), LampAnchorOffset, LampAnchorSpacing, LampAnchorTag, LampRoadClearance, PCGBoundsComponent, PCGComponent, SignageAnchorOffset, SignageAnchorSpacing, SignageAnchorTag, SignageRoadClearance, StreetFurnitureGraph, StreetFurnitureSeed, VegetationAnchorOffset, VegetationAnchorSpacing, VegetationAnchorTag, and VegetationRoadClearance.

Referenced by GenerateAll().

◆ GenerateRoadMesh()

void AOpenDriveGenerator::GenerateRoadMesh ( )

◆ GenerateSpawnPoints()

void AOpenDriveGenerator::GenerateSpawnPoints ( )

Generates spawn points along the road.

Definition at line 1964 of file OpenDriveGenerator.cpp.

References UCarlaStatics::GetGameMode(), ACarlaGameModeBase::GetMap(), IsOpenDriveValid(), SpawnersHeight, and VehicleSpawners.

Referenced by GenerateAll().

◆ GetOpenDrive()

const FString & AOpenDriveGenerator::GetOpenDrive ( ) const

Get the OpenDRIVE information as string.

Definition at line 582 of file OpenDriveGenerator.cpp.

References OpenDriveData.

◆ IsOpenDriveValid()

bool AOpenDriveGenerator::IsOpenDriveValid ( ) const

Checks if the OpenDrive has been loaded and it's valid.

Definition at line 587 of file OpenDriveGenerator.cpp.

References UCarlaStatics::GetGameMode(), and ACarlaGameModeBase::GetMap().

Referenced by GenerateCrosswalkMesh(), GenerateGroundPlane(), GenerateLaneMarkings(), GeneratePoles(), GenerateRoadMesh(), and GenerateSpawnPoints().

◆ IsStreetFurnitureGenerating()

bool AOpenDriveGenerator::IsStreetFurnitureGenerating ( ) const

True while the street-furniture PCG scatter is still spawning; it finishes over the next frames.

Definition at line 1959 of file OpenDriveGenerator.cpp.

References PCGComponent.

◆ LoadOpenDrive()

bool AOpenDriveGenerator::LoadOpenDrive ( const FString &  OpenDrive)

Set the OpenDRIVE information as string and generates the queryable map structure.

Definition at line 568 of file OpenDriveGenerator.cpp.

References OpenDriveData.

Referenced by BeginPlay().

◆ RunGenerationQA()

void AOpenDriveGenerator::RunGenerationQA ( )

Systematic post-generation validation, run automatically shortly after GenerateAll (delayed so the async PCG scatter has spawned its content) and re-runnable on demand via the console command "carla.MapGenQA".

Checks, exhaustively rather than by spot samples: A) road support – every road/sidewalk sample cell must have terrain 0..QASupportGapMax below its lowest surface (floating road if the gap is larger, terrain invasion if negative); stacked-road cells (MaxZ - MinZ > QAStackedRoadGap) only check the lower deck, the upper one is a legitimate bridge. B) object placement – the bounding-box footprint of every static primitive not generated by this actor (street furniture from the PCG scatter, incl. per-instance foliage ISMs) must stay clear of every driving lane's corridor. Logs a summary and writes the full violation list with world locations to Saved/mapgen_qa.json for external tooling.

Definition at line 2000 of file OpenDriveGenerator.cpp.

References AOpenDriveGenerator::FRoadSurfaceRaster::FCell::bDrive, AOpenDriveGenerator::FRoadSurfaceRaster::CellAtWorld(), AOpenDriveGenerator::FRoadSurfaceRaster::Cells, AOpenDriveGenerator::FRoadSurfaceRaster::CellSize, GroundGridNumX, GroundGridNumY, AOpenDriveGenerator::FRoadSurfaceRaster::Height, AOpenDriveGenerator::FRoadSurfaceRaster::IsValid(), IsValid(), AOpenDriveGenerator::FRoadSurfaceRaster::OriginX, AOpenDriveGenerator::FRoadSurfaceRaster::OriginY, QAStackedRoadGap, QASupportGapMax, RoadRaster, SampleGroundGridHeight(), and AOpenDriveGenerator::FRoadSurfaceRaster::Width.

Referenced by GenerateAll().

◆ SampleGroundGridHeight()

float AOpenDriveGenerator::SampleGroundGridHeight ( float  X,
float  Y 
) const
protected

Bilinear interpolation of GroundGridHeights at a world XY position.

Only valid once GenerateGroundPlane has run (GroundGridNumX > 0).

Definition at line 1769 of file OpenDriveGenerator.cpp.

References GroundGridHeights, GroundGridNumX, GroundGridNumY, GroundGridOrigin, GroundGridStepX, and GroundGridStepY.

Referenced by GenerateFurnitureAnchors(), and RunGenerationQA().

Member Data Documentation

◆ ActorMeshList

TArray<TObjectPtr<AActor> > AOpenDriveGenerator::ActorMeshList
protected

◆ CrosswalkMaterial

TSoftObjectPtr<UMaterialInterface> AOpenDriveGenerator::CrosswalkMaterial
protected
Initial value:
= TSoftObjectPtr<UMaterialInterface>(
FSoftObjectPath(TEXT("/Game/Carla/Static/GenericMaterials/Roads/MI_Road_Asphalt_B_LaneMarkingWhite.MI_Road_Asphalt_B_LaneMarkingWhite")))

Material applied to the zebra-bar crosswalk meshes.

The bars are real geometry (GenerateCrosswalkMesh), so this is just the same clean white paint the lane markings use – no dedicated crosswalk texture needed. (MI_Crosswalk_SpeedBump was tried first as a whole-slab texture: its diffuse is the speed bump's red field, which read as a flat pink slab.)

Definition at line 244 of file OpenDriveGenerator.h.

Referenced by GenerateCrosswalkMesh().

◆ DecalZOffset

float AOpenDriveGenerator::DecalZOffset = 1.5f
protected

Vertical offset (cm) applied to crosswalk and lane-marking meshes above the road surface, to avoid z-fighting with the road mesh section.

Definition at line 264 of file OpenDriveGenerator.h.

Referenced by GenerateCrosswalkMesh(), and GenerateLaneMarkings().

◆ FurnitureAnchorBounds

FBox AOpenDriveGenerator::FurnitureAnchorBounds = FBox(ForceInit)
protected

Accumulated bounding box of every furniture anchor spawned for the current generation, in world space; drives PCGBoundsComponent.

Definition at line 368 of file OpenDriveGenerator.h.

Referenced by GenerateFurnitureAnchors(), and GeneratePoles().

◆ GroundGridHeights

TArray<float> AOpenDriveGenerator::GroundGridHeights
protected

Evaluated ground heightfield (final terrain surface z per grid vertex, row-major, GroundGridNumY rows of GroundGridNumX), retained after GenerateGroundPlane so GenerateFurnitureAnchors can re-ground scattered objects onto the terrain they'll actually stand on.

Definition at line 322 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and SampleGroundGridHeight().

◆ GroundGridNumX

int32 AOpenDriveGenerator::GroundGridNumX = 0
protected

◆ GroundGridNumY

int32 AOpenDriveGenerator::GroundGridNumY = 0
protected

◆ GroundGridOrigin

FVector2D AOpenDriveGenerator::GroundGridOrigin = FVector2D::ZeroVector
protected

Definition at line 325 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and SampleGroundGridHeight().

◆ GroundGridStepX

float AOpenDriveGenerator::GroundGridStepX = 0.0f
protected

Definition at line 326 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and SampleGroundGridHeight().

◆ GroundGridStepY

float AOpenDriveGenerator::GroundGridStepY = 0.0f
protected

Definition at line 327 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and SampleGroundGridHeight().

◆ GroundHeightSampleCellSize

float AOpenDriveGenerator::GroundHeightSampleCellSize = 250.0f
protected

XY cell size (cm) of RoadRaster.

2.5m resolves both the vertical curvature of ramps/crests and lane-scale footprint detail.

Definition at line 298 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and GenerateRoadMesh().

◆ GroundMaterial

TSoftObjectPtr<UMaterialInterface> AOpenDriveGenerator::GroundMaterial
protected
Initial value:
= TSoftObjectPtr<UMaterialInterface>(
FSoftObjectPath(TEXT("/Game/Carla/Static/GenericMaterials/Ground/MI_LargeLandscape_Grass.MI_LargeLandscape_Grass")))

Material applied to the ground plane (see GenerateGroundPlane).

Picked from Content/Carla/Static/GenericMaterials/Ground – a plain M_GeneralMaster instance (not a landscape auto-material, which expects per-vertex layer weightmaps this flat quad doesn't have) authored for large tiled areas. Alternates in the same folder: MI_Grass_Cutted_Yard (more manicured), MI_Dirt, MI_LargeLandscape_Rural/_Highway/_Mountain (biome variants) – swap per-map if grass doesn't fit.

Definition at line 235 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane().

◆ GroundPlanePadding

float AOpenDriveGenerator::GroundPlanePadding = 5000.0f
protected

How far (cm) the ground plane extends past the generated road/sidewalk bounding box on each side, so the fill doesn't end exactly at the outermost shoulder.

Definition at line 337 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and GenerateRoadMesh().

◆ GroundPlaneZOffset

float AOpenDriveGenerator::GroundPlaneZOffset = 5.0f
protected

Vertical offset (cm) applied below the road surface height where the terrain runs under road geometry – large enough to avoid z-fighting, small enough that the road visibly rests on the ground (the generation QA requires terrain within 10cm of the road underside, see RunGenerationQA).

Definition at line 272 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane().

◆ GroundSkirtWidth

float AOpenDriveGenerator::GroundSkirtWidth = 1000.0f
protected

Width (cm) of the blend band past the road footprint over which the terrain transitions from exactly hugging the road underside to the free B-spline surface.

Within the band the surface is also clamped below the nearest road sample, so the transition can never rise through a road.

Definition at line 293 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and GenerateRoadMesh().

◆ GroundUVTileSize

float AOpenDriveGenerator::GroundUVTileSize = 500.0f
protected

World-space size (cm) of one UV tile on the ground plane, i.e.

how large the material's texture repeats on the ground – the plane spans the whole map, so a single 0-1 UV tile would stretch the texture to the point of being unrecognizable.

Definition at line 344 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane().

◆ LampAnchorOffset

float AOpenDriveGenerator::LampAnchorOffset = 1.0f
protected

Lateral offset (m) of lamp anchors past the curb line (the outer edge of the last roadway lane: parking/bike/border lanes included), clamped to the middle of the sidewalk lane that follows when there is one – the pole base stands on the pavement next to the curb.

The old 4 m from the driving lane put poles mid-parking-lane on streets with kerbside parking and 2 m into the buildings on streets with a bare 1.5 m sidewalk.

Definition at line 399 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ LampAnchorSpacing

float AOpenDriveGenerator::LampAnchorSpacing = 30.0f
protected

Spacing (m) between lamp anchors along each road.

Definition at line 389 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ LampAnchorTag

FName AOpenDriveGenerator::LampAnchorTag = FName("PCG_StreetLampAnchor")
protected

Tag used to mark lamp-pole anchor points for the PCG graph to sample.

Definition at line 385 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ LampRoadClearance

float AOpenDriveGenerator::LampRoadClearance = 50.0f
protected

Per-category clearance (cm) beyond the lane half-width that street furniture must keep from the nearest driving-lane centerline; anchors closer than this are discarded so scattered objects can't stand on or overhang the roadway where lanes widen, merge or overlap.

Sized to the spawned content's lateral half-extent (the clearance is measured across the road, so a shelter's 8 m length along the curb doesn't count – its ~1 m depth does). It must stay below the category's anchor offset: the old 450 cm signage clearance against a 4 m offset discarded 100 % of the signage anchors on every map.

Definition at line 310 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ LaneMarkingWhiteMaterial

TSoftObjectPtr<UMaterialInterface> AOpenDriveGenerator::LaneMarkingWhiteMaterial
protected
Initial value:
= TSoftObjectPtr<UMaterialInterface>(
FSoftObjectPath(TEXT("/Game/Carla/Static/GenericMaterials/Roads/MI_Road_Asphalt_B_LaneMarkingWhite.MI_Road_Asphalt_B_LaneMarkingWhite")))

Material applied to white lane-marking meshes.

The Rural_A marking variants carry a heavy paint-damage mask keyed to the road atlas UV layout; on the generated markings' along-road UVs the mask samples as dense black blotches across the line, so use the clean Asphalt_B variants instead.

Definition at line 253 of file OpenDriveGenerator.h.

Referenced by GenerateLaneMarkings().

◆ LaneMarkingYellowMaterial

TSoftObjectPtr<UMaterialInterface> AOpenDriveGenerator::LaneMarkingYellowMaterial
protected
Initial value:
= TSoftObjectPtr<UMaterialInterface>(
FSoftObjectPath(TEXT("/Game/Carla/Static/GenericMaterials/Roads/MI_Road_Asphalt_B_LaneMarkingYellow.MI_Road_Asphalt_B_LaneMarkingYellow")))

Material applied to yellow lane-marking meshes (centre line).

Definition at line 258 of file OpenDriveGenerator.h.

Referenced by GenerateLaneMarkings().

◆ MedianFillMaxHeightDelta

float AOpenDriveGenerator::MedianFillMaxHeightDelta = 100.0f
protected

Max height split (cm) of the driving surface samples WITHIN a single raster cell near a gap cell for it to be filled – a gap under an overpass sees both decks and must not be bridged at the wrong height.

Definition at line 285 of file OpenDriveGenerator.h.

Referenced by GenerateMedianFill().

◆ MedianFillMaxWidth

float AOpenDriveGenerator::MedianFillMaxWidth = 600.0f
protected

Widest gap (cm) between opposing driving surfaces that GenerateMedianFill closes with road surface; wider separations are genuine verges and stay terrain.

Definition at line 278 of file OpenDriveGenerator.h.

Referenced by GenerateMedianFill().

◆ OpenDriveData

FString AOpenDriveGenerator::OpenDriveData
protected

Definition at line 145 of file OpenDriveGenerator.h.

Referenced by GetOpenDrive(), and LoadOpenDrive().

◆ PCGBoundsComponent

TObjectPtr<UBoxComponent> AOpenDriveGenerator::PCGBoundsComponent
protected

Provides the PCG component's generation bounds: PCG derives its grid bounds from the owner actor's component bounds, and this actor has no visible geometry of its own – without a bounded component the graph aborts at Generate() with "Component has invalid bounds, not registered nor updated" and never schedules a task.

Sized to the generated road network (anchor bounding box, padded) right before the scatter runs.

Definition at line 364 of file OpenDriveGenerator.h.

Referenced by AOpenDriveGenerator(), and GeneratePoles().

◆ PCGComponent

TObjectPtr<UPCGComponent> AOpenDriveGenerator::PCGComponent
protected

Drives the runtime PCG scatter (see GeneratePoles).

Non-partitioned by default (bIsComponentPartitioned = false on UPCGComponent), so this works on legacy non-World-Partition levels like OpenDriveMap.umap – no PCGWorldActor is required. Generation is triggered explicitly by calling PCGComponent->Generate() once GeneratePoles() has spawned all the anchor markers; the graph asset's own GenerationTrigger should be left at "Generate On Demand" (not "Generate On Load" or "Generate At Runtime", which assume a World-Partition streaming source).

Definition at line 355 of file OpenDriveGenerator.h.

Referenced by AOpenDriveGenerator(), GeneratePoles(), and IsStreetFurnitureGenerating().

◆ QAStackedRoadGap

float AOpenDriveGenerator::QAStackedRoadGap = 400.0f
protected

Min z spread (cm) within one sample cell that marks it as stacked roads (bridge over road) rather than a single surface.

Definition at line 479 of file OpenDriveGenerator.h.

Referenced by RunGenerationQA().

◆ QASupportGapMax

float AOpenDriveGenerator::QASupportGapMax = 30.0f
protected

Max allowed gap (cm) between a road cell's lowest surface and the terrain below it before the cell counts as a floating road.

Must stay above the ground plane's near-pavement clearance (GroundPlaneZOffset) plus the fill-quad clamp's reach (fill sits ~2cm under the lowest neighbouring lane, terrain 10cm under the fill, so a graded cell's own surface can be ~grade x 2.5m + 12cm above the terrain).

Definition at line 474 of file OpenDriveGenerator.h.

Referenced by RunGenerationQA().

◆ RoadMaterial

TSoftObjectPtr<UMaterialInterface> AOpenDriveGenerator::RoadMaterial
protected
Initial value:
= TSoftObjectPtr<UMaterialInterface>(
FSoftObjectPath(TEXT("/Game/Carla/Static/GenericMaterials/Roads/MI_RoadAsphalt_Town15.MI_RoadAsphalt_Town15")))

Material applied to driving-lane mesh sections.

Definition at line 219 of file OpenDriveGenerator.h.

Referenced by GenerateRoadMesh().

◆ RoadMeshBounds

FBox AOpenDriveGenerator::RoadMeshBounds = FBox(ForceInit)
protected

World-space bounding box of every road/sidewalk vertex generated by GenerateRoadMesh, accumulated there and consumed by GenerateGroundPlane to size and position the fill quad – mirrors how FurnitureAnchorBounds drives PCGBoundsComponent below.

Definition at line 154 of file OpenDriveGenerator.h.

Referenced by GenerateGroundPlane(), and GenerateRoadMesh().

◆ RoadRaster

FRoadSurfaceRaster AOpenDriveGenerator::RoadRaster
protected

◆ SidewalkMaterial

TSoftObjectPtr<UMaterialInterface> AOpenDriveGenerator::SidewalkMaterial
protected
Initial value:
= TSoftObjectPtr<UMaterialInterface>(
FSoftObjectPath(TEXT("/Game/Carla/Static/GenericMaterials/Sidewalk/MI_Sidewalk_Apartment.MI_Sidewalk_Apartment")))

Material applied to sidewalk mesh sections.

Definition at line 224 of file OpenDriveGenerator.h.

Referenced by GenerateRoadMesh().

◆ SignageAnchorOffset

float AOpenDriveGenerator::SignageAnchorOffset = 1.0f
protected

Lateral offset (m) of signage anchors past the curb line, clamped onto the sidewalk like the lamps (same row, phased half a lamp spacing along the road so the two never coincide).

Definition at line 433 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ SignageAnchorSpacing

float AOpenDriveGenerator::SignageAnchorSpacing = 150.0f
protected

Spacing (m) between signage anchors along each road.

Sparse: this row spawns full bus-stop shelters, and a shelter every 60m read as a repeating wall of street furniture.

Definition at line 427 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ SignageAnchorTag

FName AOpenDriveGenerator::SignageAnchorTag = FName("PCG_SignageAnchor")
protected

Tag used to mark decorative-signage anchor points.

Traffic-control signs (stop/yield/speed limit) already come from OpenDRIVE <signal> data via the existing traffic-light/-sign pipeline; this is only for ambient roadside signage PCG can scatter for visual density.

Definition at line 421 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ SignageRoadClearance

float AOpenDriveGenerator::SignageRoadClearance = 50.0f
protected

Definition at line 316 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ SpawnersHeight

float AOpenDriveGenerator::SpawnersHeight = 300.f
protected

Determine the height where the spawners will be placed, relative to each RoutePlanner.

Definition at line 139 of file OpenDriveGenerator.h.

Referenced by GenerateSpawnPoints().

◆ StreetFurnitureGraph

TSoftObjectPtr<UPCGGraphInterface> AOpenDriveGenerator::StreetFurnitureGraph
protected

PCG graph asset that samples the tagged anchors below (via a "Get Actor Data" node per category, ActorSelector = {ByTag, AllWorldActors, <tag>, bSelectMultiple=true}, Mode = GetSinglePoint) and spawns lamp, vegetation, and signage actors/meshes at each point.

Left unset by default – author this graph in-editor (see design doc) and assign it on the placed AOpenDriveGenerator instance in OpenDriveMap.umap.

Definition at line 377 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ StreetFurnitureSeed

int32 AOpenDriveGenerator::StreetFurnitureSeed = 42
protected

PCG seed of the furniture scatter; with it, every server and run places the same furniture and banners.

Definition at line 381 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ VegetationAnchorOffset

float AOpenDriveGenerator::VegetationAnchorOffset = 6.0f
protected

Lateral offset (m) of vegetation anchors – set past the lamp row so poles and trees don't overlap.

Definition at line 414 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ VegetationAnchorSpacing

float AOpenDriveGenerator::VegetationAnchorSpacing = 15.0f
protected

Spacing (m) between vegetation anchors along each road.

Denser than lamps by default; the PCG graph can layer jitter/density-filter nodes on top of these seed points for a less regular look.

Definition at line 409 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ VegetationAnchorTag

FName AOpenDriveGenerator::VegetationAnchorTag = FName("PCG_VegetationAnchor")
protected

Tag used to mark roadside-vegetation anchor points.

Definition at line 403 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ VegetationRoadClearance

float AOpenDriveGenerator::VegetationRoadClearance = 250.0f
protected

Definition at line 313 of file OpenDriveGenerator.h.

Referenced by GeneratePoles().

◆ VehicleSpawners

TArray<TObjectPtr<AVehicleSpawnPoint> > AOpenDriveGenerator::VehicleSpawners
protected

Definition at line 142 of file OpenDriveGenerator.h.

Referenced by GenerateSpawnPoints().


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