r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold
r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold
#Overview
name: r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Threshold that classifies instances as small (default = 50cm))
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold is to set a threshold for classifying instanced static meshes as small in the context of ray tracing geometry. This setting is used in the ray tracing system of Unreal Engine 5, specifically for optimizing the rendering of instanced static meshes.
This setting variable is primarily used in the Engine module, particularly in the InstancedStaticMesh component. It’s part of the ray tracing optimization system for handling instanced static meshes in Unreal Engine’s rendering pipeline.
The value of this variable is set as a console variable with a default value of 50.0f, which represents 50 centimeters. It can be modified at runtime through the console or configuration files.
This variable interacts closely with another variable named CVarRayTracingInstancesLowScaleCullRadius. Together, these variables are used to determine which instances should be culled (excluded) from ray tracing calculations based on their size and distance from the viewer.
Developers should be aware that this variable affects performance and visual quality in ray tracing. Setting it too high might exclude too many objects from ray tracing, while setting it too low might include unnecessary small objects, potentially impacting performance.
Best practices when using this variable include:
- Balancing between performance and visual quality.
- Testing different values to find the optimal threshold for your specific scene.
- Considering the scale of your game world when setting this value.
- Using it in conjunction with CVarRayTracingInstancesLowScaleCullRadius for effective culling.
Regarding the associated variable CVarRayTracingInstancesLowScaleThreshold:
The purpose of CVarRayTracingInstancesLowScaleThreshold is identical to r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold. It’s an internal representation of the same setting.
This variable is used in the same Engine module and InstancedStaticMesh component.
The value is set in the same way as r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold, as they represent the same setting.
It interacts with CVarRayTracingInstancesLowScaleCullRadius in the same manner as described earlier.
Developers should treat this variable identically to r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold, as they are essentially the same setting.
The best practices for using this variable are the same as those mentioned for r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/InstancedStaticMesh.cpp:131
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarRayTracingInstancesLowScaleThreshold(
TEXT("r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold"),
50.0f, // Instances with a radius smaller than this threshold get culled after CVarRayTracingInstancesLowScaleCullRadius
TEXT("Threshold that classifies instances as small (default = 50cm))"));
static TAutoConsoleVariable<float> CVarRayTracingInstancesLowScaleCullRadius(
TEXT("r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleCullRadius"),
1000.0f,
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingInstancesLowScaleThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/InstancedStaticMesh.cpp:130
Scope: file
Source code excerpt:
TEXT("Ignore instances outside of this radius in ray tracing effects (default = 10000 (100m))"));
static TAutoConsoleVariable<float> CVarRayTracingInstancesLowScaleThreshold(
TEXT("r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleRadiusThreshold"),
50.0f, // Instances with a radius smaller than this threshold get culled after CVarRayTracingInstancesLowScaleCullRadius
TEXT("Threshold that classifies instances as small (default = 50cm))"));
static TAutoConsoleVariable<float> CVarRayTracingInstancesLowScaleCullRadius(
TEXT("r.RayTracing.Geometry.InstancedStaticMeshes.LowScaleCullRadius"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/InstancedStaticMesh.cpp:1742
Scope (from outer to inner):
file
function void FInstancedStaticMeshSceneProxy::GetDynamicRayTracingInstances
Source code excerpt:
//
const float BVHCullRadius = CVarRayTracingInstancesCullClusterRadius.GetValueOnRenderThread();
const float BVHLowScaleThreshold = CVarRayTracingInstancesLowScaleThreshold.GetValueOnRenderThread();
const float BVHLowScaleRadius = CVarRayTracingInstancesLowScaleCullRadius.GetValueOnRenderThread();
const bool ApplyGeneralCulling = BVHCullRadius > 0.0f;
const bool ApplyLowScaleCulling = BVHLowScaleThreshold > 0.0f && BVHLowScaleRadius > 0.0f;
for (uint32 InstanceIndex = 0; InstanceIndex < InstanceCount; InstanceIndex++)
{