r.RayTracing.Geometry.ProceduralMeshes
r.RayTracing.Geometry.ProceduralMeshes
#Overview
name: r.RayTracing.Geometry.ProceduralMeshes
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Include procedural meshes in ray tracing effects (default = 1 (procedural meshes enabled in ray tracing))
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RayTracing.Geometry.ProceduralMeshes is to control the inclusion of procedural meshes in ray tracing effects within Unreal Engine 5. This setting variable is specifically related to the ray tracing system and the procedural mesh component.
This setting variable is primarily used in the ProceduralMeshComponent plugin, which is part of the Unreal Engine’s runtime modules. Based on the callsites, it’s clear that this variable directly affects the ray tracing behavior for procedural meshes.
The value of this variable is set using a console variable (CVarRayTracingProceduralMesh). It’s initialized with a default value of 1, which means procedural meshes are enabled in ray tracing by default.
The associated variable CVarRayTracingProceduralMesh interacts directly with this setting. They share the same value and purpose, with CVarRayTracingProceduralMesh being the actual console variable implementation.
Developers must be aware that this variable can significantly impact performance and visual quality in ray-traced scenes that include procedural meshes. Disabling this feature (by setting it to 0) will exclude procedural meshes from ray tracing calculations, which could improve performance at the cost of visual accuracy.
Best practices when using this variable include:
- Keep it enabled (set to 1) for final quality renders or when procedural meshes are an essential part of the scene’s visual fidelity.
- Consider disabling it (set to 0) during development or for performance-critical scenarios where procedural meshes are less important.
- Test your scenes with both settings to understand the performance and visual impact in your specific use case.
Regarding the associated variable CVarRayTracingProceduralMesh:
The purpose of CVarRayTracingProceduralMesh is to provide a console-accessible way to control the r.RayTracing.Geometry.ProceduralMeshes setting.
This variable is used within the ProceduralMeshComponent plugin, specifically in the ray tracing logic for procedural mesh components.
The value of this variable is set through the console or configuration files, with a default value of 1 (enabled).
It directly controls the behavior of procedural mesh ray tracing by being checked in the GetDynamicRayTracingInstances function of the FProceduralMeshSceneProxy class.
Developers should be aware that changes to this variable will take effect on the render thread, as seen in the GetValueOnRenderThread() call.
Best practices for using CVarRayTracingProceduralMesh include:
- Use it for real-time toggling of procedural mesh ray tracing during development and testing.
- Consider exposing it as a user-configurable setting in graphics options for performance tuning.
- Monitor its impact on both visual quality and performance when adjusting its value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Runtime/ProceduralMeshComponent/Source/ProceduralMeshComponent/Private/ProceduralMeshComponent.cpp:30
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRayTracingProceduralMesh(
TEXT("r.RayTracing.Geometry.ProceduralMeshes"),
1,
TEXT("Include procedural meshes in ray tracing effects (default = 1 (procedural meshes enabled in ray tracing))"));
/** Resource array to pass */
class FProcMeshVertexResourceArray : public FResourceArrayInterface
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarRayTracingProceduralMesh
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Runtime/ProceduralMeshComponent/Source/ProceduralMeshComponent/Private/ProceduralMeshComponent.cpp:29
Scope: file
Source code excerpt:
DEFINE_LOG_CATEGORY_STATIC(LogProceduralComponent, Log, All);
static TAutoConsoleVariable<int32> CVarRayTracingProceduralMesh(
TEXT("r.RayTracing.Geometry.ProceduralMeshes"),
1,
TEXT("Include procedural meshes in ray tracing effects (default = 1 (procedural meshes enabled in ray tracing))"));
/** Resource array to pass */
class FProcMeshVertexResourceArray : public FResourceArrayInterface
#Loc: <Workspace>/Engine/Plugins/Runtime/ProceduralMeshComponent/Source/ProceduralMeshComponent/Private/ProceduralMeshComponent.cpp:452
Scope (from outer to inner):
file
class class FProceduralMeshSceneProxy final : public FPrimitiveSceneProxy
function virtual void GetDynamicRayTracingInstances
Source code excerpt:
virtual void GetDynamicRayTracingInstances(FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances) override final
{
if (!CVarRayTracingProceduralMesh.GetValueOnRenderThread())
{
return;
}
for (int32 SegmentIndex = 0; SegmentIndex < Sections.Num(); ++SegmentIndex)
{