r.RayTracing.Geometry.GeometryCollection
r.RayTracing.Geometry.GeometryCollection
#Overview
name: r.RayTracing.Geometry.GeometryCollection
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Include geometry collection proxy meshes in ray tracing effects (default = 0 (Geometry collection meshes disabled in ray tracing))
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Geometry.GeometryCollection is to control the inclusion of geometry collection proxy meshes in ray tracing effects within Unreal Engine 5. This setting variable is specifically related to the rendering system, particularly the ray tracing subsystem.
This setting variable is primarily used in the Experimental GeometryCollectionEngine module of Unreal Engine 5. It directly affects the behavior of ray tracing for geometry collections, which are part of the Chaos physics system.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The associated variable GRayTracingGeometryCollectionProxyMeshes interacts directly with r.RayTracing.Geometry.GeometryCollection. They share the same value, with GRayTracingGeometryCollectionProxyMeshes being the actual integer variable used in the code logic.
Developers must be aware that this variable is disabled by default (set to 0). Enabling it will include geometry collection proxy meshes in ray tracing effects, which may impact performance and visual quality.
Best practices when using this variable include:
- Only enable it when specifically working with ray-traced geometry collections.
- Be mindful of the performance impact, especially in scenes with many geometry collections.
- Test thoroughly with both enabled and disabled states to ensure desired visual results and performance.
Regarding the associated variable GRayTracingGeometryCollectionProxyMeshes:
The purpose of GRayTracingGeometryCollectionProxyMeshes is to serve as the actual integer flag that controls whether geometry collection proxy meshes are included in ray tracing effects.
This variable is used directly in the GeometryCollectionSceneProxy class within the Experimental GeometryCollectionEngine module. It affects the GetDynamicRayTracingInstances function, which is part of the ray tracing pipeline.
The value of GRayTracingGeometryCollectionProxyMeshes is set through the r.RayTracing.Geometry.GeometryCollection console variable.
It interacts directly with the r.RayTracing.Geometry.GeometryCollection console variable, sharing the same value.
Developers should be aware that this variable is checked in performance-critical code paths related to ray tracing. Its value (0 or non-zero) determines whether the ray tracing code for geometry collections is executed.
Best practices for using this variable include:
- Avoid directly modifying GRayTracingGeometryCollectionProxyMeshes in code; instead, use the console variable system.
- When optimizing ray tracing performance, consider the impact of this setting on scenes with geometry collections.
- Use profiling tools to measure the performance impact when enabling or disabling this feature in your specific use case.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:70
Scope: file
Source code excerpt:
static int32 GRayTracingGeometryCollectionProxyMeshes = 0;
FAutoConsoleVariableRef CVarRayTracingGeometryCollectionProxyMeshes(
TEXT("r.RayTracing.Geometry.GeometryCollection"),
GRayTracingGeometryCollectionProxyMeshes,
TEXT("Include geometry collection proxy meshes in ray tracing effects (default = 0 (Geometry collection meshes disabled in ray tracing))"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named GRayTracingGeometryCollectionProxyMeshes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:68
Scope: file
Source code excerpt:
);
static int32 GRayTracingGeometryCollectionProxyMeshes = 0;
FAutoConsoleVariableRef CVarRayTracingGeometryCollectionProxyMeshes(
TEXT("r.RayTracing.Geometry.GeometryCollection"),
GRayTracingGeometryCollectionProxyMeshes,
TEXT("Include geometry collection proxy meshes in ray tracing effects (default = 0 (Geometry collection meshes disabled in ray tracing))"),
ECVF_RenderThreadSafe
);
#if !defined(CHAOS_GEOMETRY_COLLECTION_SET_DYNAMIC_DATA_ISPC_ENABLED_DEFAULT)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionSceneProxy.cpp:787
Scope (from outer to inner):
file
function void FGeometryCollectionSceneProxy::GetDynamicRayTracingInstances
Source code excerpt:
void FGeometryCollectionSceneProxy::GetDynamicRayTracingInstances(FRayTracingMaterialGatheringContext& Context, TArray<struct FRayTracingInstance>& OutRayTracingInstances)
{
if (GRayTracingGeometryCollectionProxyMeshes == 0 || MeshDescription.NumVertices == 0)
{
return;
}
QUICK_SCOPE_CYCLE_COUNTER(STAT_GeometryCollectionSceneProxy_GetDynamicRayTracingInstances);