r.RayTracing.Geometry.Cable.WPO.CullingRadius

r.RayTracing.Geometry.Cable.WPO.CullingRadius

#Overview

name: r.RayTracing.Geometry.Cable.WPO.CullingRadius

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RayTracing.Geometry.Cable.WPO.CullingRadius is to control the culling radius for World Position Offset (WPO) evaluation of cable meshes in ray tracing effects. It sets a distance threshold beyond which WPO calculations for cable meshes are not performed, potentially improving performance in ray tracing scenarios.

This setting variable is primarily used in the Cable Component plugin, which is part of Unreal Engine’s runtime modules. It specifically affects the ray tracing behavior of cable meshes, which are typically used for rendering flexible, rope-like objects in the game world.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 12000.0 (representing 120 meters in world units) in the CableComponent.cpp file.

The associated variable CVarRayTracingCableMeshesWPOCullingRadius directly interacts with r.RayTracing.Geometry.Cable.WPO.CullingRadius. They share the same value and purpose.

Developers should be aware that this variable affects performance and visual fidelity in ray-traced scenes containing cable meshes. Setting a smaller radius can improve performance but may result in visual artifacts for distant cables, while a larger radius ensures more accurate rendering at the cost of performance.

Best practices when using this variable include:

  1. Adjusting the value based on the scale and requirements of your specific game world.
  2. Testing different values to find the optimal balance between performance and visual quality.
  3. Considering the typical viewing distances in your game when setting this value.

Regarding the associated variable CVarRayTracingCableMeshesWPOCullingRadius:

The purpose of CVarRayTracingCableMeshesWPOCullingRadius is identical to r.RayTracing.Geometry.Cable.WPO.CullingRadius. It’s the actual console variable that stores and provides access to the culling radius value.

This variable is used within the Cable Component plugin, specifically in the ray tracing code for cable meshes.

The value is set at initialization in the CableComponent.cpp file, but can be modified at runtime through console commands.

It directly interacts with the GetDynamicRayTracingInstances function, where it’s used to determine whether WPO should be evaluated for a given cable mesh based on its distance from the view center.

Developers should be aware that this variable is accessed on the render thread, which means changes to it will affect rendering in real-time.

Best practices include using this variable in conjunction with profiling tools to find the optimal culling radius for your specific use case, and potentially exposing it as a configurable setting for end-users to fine-tune based on their hardware capabilities.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Private/CableComponent.cpp:36

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarRayTracingCableMeshesWPOCullingRadius(
	TEXT("r.RayTracing.Geometry.Cable.WPO.CullingRadius"),
	12000.0f, // 120 m
	TEXT("Do not evaluate world position offset for cable meshes outside of this radius in ray tracing effects (default = 12000 (120m))"));

#include UE_INLINE_GENERATED_CPP_BY_NAME(CableComponent)

DECLARE_CYCLE_STAT(TEXT("Cable Sim"), STAT_Cable_SimTime, STATGROUP_CableComponent);

#Associated Variable and Callsites

This variable is associated with another variable named CVarRayTracingCableMeshesWPOCullingRadius. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Private/CableComponent.cpp:35

Scope: file

Source code excerpt:

	TEXT("Enable culling for WPO evaluation for cable meshes in ray tracing (default = 1 (Culling enabled))"));

static TAutoConsoleVariable<float> CVarRayTracingCableMeshesWPOCullingRadius(
	TEXT("r.RayTracing.Geometry.Cable.WPO.CullingRadius"),
	12000.0f, // 120 m
	TEXT("Do not evaluate world position offset for cable meshes outside of this radius in ray tracing effects (default = 12000 (120m))"));

#include UE_INLINE_GENERATED_CPP_BY_NAME(CableComponent)

#Loc: <Workspace>/Engine/Plugins/Runtime/CableComponent/Source/CableComponent/Private/CableComponent.cpp:478

Scope (from outer to inner):

file
function     virtual void GetDynamicRayTracingInstances

Source code excerpt:

			const FVector ViewCenter = Context.ReferenceView->ViewMatrices.GetViewOrigin();
			const FVector MeshCenter = GetBounds().Origin;
			const float CullingRadius = CVarRayTracingCableMeshesWPOCullingRadius.GetValueOnRenderThread();
			const float BoundingRadius = GetBounds().SphereRadius;

			if (FVector(ViewCenter - MeshCenter).Size() > (CullingRadius + BoundingRadius))
			{
				bEvaluateWPO = false;
			}