ShowFlag.StreamingBounds
ShowFlag.StreamingBounds
#Overview
name: ShowFlag.StreamingBounds
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 10
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.StreamingBounds is to control the rendering of streaming bounding volumes for the currently selected texture in the Unreal Engine editor. This setting variable is primarily used for debugging and visualization purposes in the rendering system.
ShowFlag.StreamingBounds is utilized by various Unreal Engine subsystems and modules, including:
- The rendering system
- The level editor viewport
- The texture streaming system
- The Niagara particle system
- The Instanced Actors system
- The World Partition system
The value of this variable is typically set through the engine’s show flags system, which allows developers to toggle various debug visualization options in the editor.
The associated variable StreamingBounds interacts closely with ShowFlag.StreamingBounds. It represents the actual bounding box used for streaming calculations and is used in various parts of the engine to determine the extent of streaming-related operations.
Developers should be aware of the following when using this variable:
- It is primarily intended for editor and debug use, not for shipping builds.
- Enabling this flag may impact performance, especially in complex scenes with many streaming assets.
- The streaming bounds visualization can help identify issues with texture streaming and level of detail transitions.
Best practices when using this variable include:
- Use it during development and debugging phases to optimize streaming behavior.
- Combine it with other debug visualization tools to get a comprehensive view of the engine’s streaming system.
- Disable it in shipping builds to avoid unnecessary performance overhead.
- When adjusting streaming bounds, ensure they accurately represent the area where the asset should be loaded.
Regarding the associated variable StreamingBounds:
The purpose of StreamingBounds is to define the spatial extent within which an object or asset should be streamed in or considered for streaming. It is used across various engine systems to determine when assets should be loaded or unloaded based on their distance from the camera or other relevant factors.
StreamingBounds is utilized in several key areas:
- Texture streaming
- Instanced actor management
- Particle systems
- World partitioning
The value of StreamingBounds is typically calculated based on the bounds of the object or asset it represents, often with some additional scaling or offset applied.
Developers should be aware that:
- Accurate StreamingBounds are crucial for efficient memory management and performance.
- Overly large StreamingBounds can lead to unnecessary asset loading, while too small bounds might cause pop-in or missing assets.
- StreamingBounds are used in both editor and runtime contexts.
Best practices for using StreamingBounds include:
- Regularly review and adjust StreamingBounds for optimal performance.
- Use the ShowFlag.StreamingBounds visualization to verify the correctness of StreamingBounds.
- Consider the nature of the asset when setting StreamingBounds (e.g., larger bounds for frequently used or large assets).
- Be cautious when manually modifying StreamingBounds, as it can significantly impact streaming behavior and performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:213
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, LightMapDensity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightMapDensitySF", "Light Map Density"))
/** Render streaming bounding volumes for the currently selected texture */
SHOWFLAG_FIXED_IN_SHIPPING(0, StreamingBounds, SFG_Advanced, NSLOCTEXT("UnrealEd", "StreamingBoundsSF", "Streaming Bounds"))
/** Render joint limits */
SHOWFLAG_FIXED_IN_SHIPPING(0, Constraints, SFG_Advanced, NSLOCTEXT("UnrealEd", "ConstraintsSF", "Constraints"))
/** Render mass debug data */
SHOWFLAG_FIXED_IN_SHIPPING(0, MassProperties, SFG_Advanced, NSLOCTEXT("UnrealEd", "MassPropertiesSF", "Mass Properties"))
/** Draws camera frustums */
SHOWFLAG_FIXED_IN_SHIPPING(0, CameraFrustums, SFG_Advanced, NSLOCTEXT("UnrealEd", "CameraFrustumsSF", "Camera Frustums"))
#Associated Variable and Callsites
This variable is associated with another variable named StreamingBounds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraMeshRendererProperties.cpp:821
Scope (from outer to inner):
file
function void UNiagaraMeshRendererProperties::GetStreamingMeshInfo
Source code excerpt:
{
const FBoxSphereBounds MeshBounds = StaticMesh->GetBounds();
const FBoxSphereBounds StreamingBounds = FBoxSphereBounds(
OwnerBounds.Origin + MeshBounds.Origin,
MeshBounds.BoxExtent * MeshProperties.Scale,
MeshBounds.SphereRadius * MeshProperties.Scale.GetMax());
const float MeshTexelFactor = float(MeshBounds.SphereRadius * 2.0);
new (OutStreamingRenderAssets) FStreamingRenderAssetPrimitiveInfo(StaticMesh, StreamingBounds, MeshTexelFactor);
}
}
}
#if WITH_EDITORONLY_DATA
TArray<FNiagaraVariable> UNiagaraMeshRendererProperties::GetBoundAttributes() const
#Loc: <Workspace>/Engine/Plugins/Runtime/InstancedActors/Source/InstancedActors/Private/InstancedActorsManager.cpp:956
Scope (from outer to inner):
file
function void AInstancedActorsManager::AuditInstances
Source code excerpt:
#if WITH_EDITOR
// Draw streaming bounds
FBox StreamingBounds = GetStreamingBounds();
DrawDebugBox(World, StreamingBounds.GetCenter(), StreamingBounds.GetExtent(), FColor::Orange, /*bPersistentLines*/ DebugDrawDuration == -1.0f, DebugDrawDuration);
#endif // WITH_EDITOR
}
#endif // UE_ENABLE_DEBUG_DRAWING
const FVector ManagerLocation = GetActorLocation();
const FTransform& ManagerTransform = GetActorTransform();
#Loc: <Workspace>/Engine/Plugins/Runtime/InstancedActors/Source/InstancedActors/Private/InstancedActorsManager.cpp:1613
Scope (from outer to inner):
file
function bool AInstancedActorsManager::SetSMInstanceTransform
Source code excerpt:
// Don't allow people to move an IA outside of this IAMs streaming bounds.
const FBox StreamingBounds = GetStreamingBounds();
FTransform WorldTransform = bWorldSpace ? InstanceTransform : (InstanceTransform * GetActorTransform());
if (!StreamingBounds.IsInside(WorldTransform.GetLocation()))
{
#if ENABLE_DRAW_DEBUG
FColor BoundsColor(255, 20, 20, 125);
DrawDebugSolidBox(GetWorld(), StreamingBounds, BoundsColor, FTransform::Identity);
DrawDebugBox(GetWorld(), StreamingBounds.GetCenter(), StreamingBounds.GetExtent(), FColor::Red);
#endif
return false;
}
const FInstancedActorsInstanceHandle InstanceHandle = ActorInstanceHandleFromFSMInstanceId(InstanceId);
if (ensure(InstanceHandle.IsValid()))
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/GroupActor.cpp:253
Scope (from outer to inner):
file
function FBox AGroupActor::GetStreamingBounds
Source code excerpt:
FBox AGroupActor::GetStreamingBounds() const
{
FBox StreamingBounds = Super::GetStreamingBounds();
for (AActor* Actor : GroupActors)
{
if (Actor)
{
StreamingBounds += Actor->GetStreamingBounds();
}
}
for (AGroupActor* SubGroupActor : SubGroups)
{
if (SubGroupActor)
{
StreamingBounds += SubGroupActor->GetStreamingBounds();
}
}
return StreamingBounds;
}
#endif
void GetBoundingVectorsForGroup(AGroupActor* GroupActor, FViewport* Viewport, FVector& OutVectorMin, FVector& OutVectorMax)
{
// Draw a bounding box for grouped actors using the vector range we can gather from any child actors (including subgroups)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/LevelEditorViewport.cpp:4889
Scope (from outer to inner):
file
function void FLevelEditorViewportClient::Draw
Source code excerpt:
AGroupActor::DrawBracketsForGroups(PDI, Viewport);
if (EngineShowFlags.StreamingBounds)
{
DrawTextureStreamingBounds(View, PDI);
}
// A frustum should be drawn if the viewport is ortho and level streaming volume previs is enabled in some viewport
if ( IsOrtho() )
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Actor.cpp:1167
Scope (from outer to inner):
file
function FBox AActor::GetStreamingBounds
Source code excerpt:
FBox AActor::GetStreamingBounds() const
{
FBox StreamingBounds(ForceInit);
ForEachStreamingRelevantComponent(this, [&StreamingBounds](const UActorComponent* Component, const FBox& StreamingBound)
{
StreamingBounds += StreamingBound;
});
return StreamingBounds;
}
bool AActor::GetIsSpatiallyLoaded() const
{
return bIsSpatiallyLoaded && !HasComponentForceActorNonSpatiallyLoaded(this);
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:8012
Scope (from outer to inner):
file
function void UParticleLODLevel::GetStreamingMeshInfo
Source code excerpt:
{
const FBoxSphereBounds MeshBounds = Mesh->GetBounds();
const FBoxSphereBounds StreamingBounds = FBoxSphereBounds(
Bounds.Origin + MeshBounds.Origin,
MeshBounds.BoxExtent * MeshTypeData->LODSizeScale,
MeshBounds.SphereRadius * MeshTypeData->LODSizeScale);
const float MeshTexelFactor = MeshBounds.SphereRadius * 2.0f;
new (OutStreamingRenderAssets) FStreamingRenderAssetPrimitiveInfo(Mesh, StreamingBounds, MeshTexelFactor);
}
}
}
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/WorldPartitionActorDesc.cpp:90
Scope (from outer to inner):
file
function void FWorldPartitionActorDesc::Init
Source code excerpt:
ActorTransform = InActor->GetActorTransform();
const FBox StreamingBounds = !bIsDefaultActorDesc ? InActor->GetStreamingBounds() : FBox(ForceInit);
StreamingBounds.GetCenterAndExtents(BoundsLocation, BoundsExtent);
bIsBoundsValid = StreamingBounds.IsValid == 1;
RuntimeGrid = InActor->GetRuntimeGrid();
bIsSpatiallyLoaded = InActor->GetIsSpatiallyLoaded();
bActorIsEditorOnly = InActor->IsEditorOnly();
bActorIsRuntimeOnly = InActor->IsRuntimeOnly();
bActorIsHLODRelevant = InActor->IsHLODRelevant();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:213
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, LightMapDensity, SFG_Hidden, NSLOCTEXT("UnrealEd", "LightMapDensitySF", "Light Map Density"))
/** Render streaming bounding volumes for the currently selected texture */
SHOWFLAG_FIXED_IN_SHIPPING(0, StreamingBounds, SFG_Advanced, NSLOCTEXT("UnrealEd", "StreamingBoundsSF", "Streaming Bounds"))
/** Render joint limits */
SHOWFLAG_FIXED_IN_SHIPPING(0, Constraints, SFG_Advanced, NSLOCTEXT("UnrealEd", "ConstraintsSF", "Constraints"))
/** Render mass debug data */
SHOWFLAG_FIXED_IN_SHIPPING(0, MassProperties, SFG_Advanced, NSLOCTEXT("UnrealEd", "MassPropertiesSF", "Mass Properties"))
/** Draws camera frustums */
SHOWFLAG_FIXED_IN_SHIPPING(0, CameraFrustums, SFG_Advanced, NSLOCTEXT("UnrealEd", "CameraFrustumsSF", "Camera Frustums"))