r.RayTracing.Geometry.SplineMeshes

r.RayTracing.Geometry.SplineMeshes

#Overview

name: r.RayTracing.Geometry.SplineMeshes

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RayTracing.Geometry.SplineMeshes is to control the inclusion of spline meshes in ray tracing effects within Unreal Engine 5. This setting variable is primarily used in the rendering system, specifically for ray tracing functionality.

The Unreal Engine subsystem that relies on this setting variable is the rendering system, particularly the ray tracing component. It is used in the SplineMeshSceneProxy module, which is part of the Engine’s runtime.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, which means spline meshes are enabled in ray tracing by default.

The associated variable CVarRayTracingSplineMeshes interacts directly with r.RayTracing.Geometry.SplineMeshes. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the inclusion of spline meshes in ray tracing effects. When set to 0, spline meshes will be excluded from ray tracing, which could impact the visual quality of scenes that heavily rely on spline meshes.

Best practices when using this variable include:

  1. Consider performance implications when enabling or disabling spline meshes in ray tracing.
  2. Test scenes with both settings (0 and 1) to ensure desired visual quality and performance.
  3. Be aware that changing this setting might require recompilation of certain shaders.

Regarding the associated variable CVarRayTracingSplineMeshes:

The purpose of CVarRayTracingSplineMeshes is identical to r.RayTracing.Geometry.SplineMeshes. It’s an internal representation of the console variable used within the C++ code.

This variable is used in the SplineMeshSceneProxy module of the Unreal Engine’s rendering system.

The value of CVarRayTracingSplineMeshes is set through the console variable system and can be accessed at runtime using GetValueOnRenderThread() method.

It directly interacts with r.RayTracing.Geometry.SplineMeshes, as they represent the same setting.

Developers should be aware that this variable is used to control the flow of execution in ray tracing-related functions. When it’s set to 0, certain ray tracing operations for spline meshes are skipped.

Best practices for using CVarRayTracingSplineMeshes include:

  1. Use GetValueOnRenderThread() when accessing the value in render thread operations.
  2. Consider the impact on performance and visual quality when changing this value.
  3. Ensure consistency between this variable and any related ray tracing settings in your project.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SplineMeshSceneProxy.cpp:14

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingSplineMeshes(
	TEXT("r.RayTracing.Geometry.SplineMeshes"),
	1,
	TEXT("Include splines meshes in ray tracing effects (default = 1 (spline meshes enabled in ray tracing))"));


bool FSplineMeshVertexFactory::ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters& Parameters)
{

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SplineMeshSceneProxy.cpp:13

Scope: file

Source code excerpt:

IMPLEMENT_TYPE_LAYOUT(FSplineMeshVertexFactoryShaderParameters);

static TAutoConsoleVariable<int32> CVarRayTracingSplineMeshes(
	TEXT("r.RayTracing.Geometry.SplineMeshes"),
	1,
	TEXT("Include splines meshes in ray tracing effects (default = 1 (spline meshes enabled in ray tracing))"));


bool FSplineMeshVertexFactory::ShouldCompilePermutation(const FVertexFactoryShaderPermutationParameters& Parameters)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SplineMeshSceneProxy.cpp:163

Scope (from outer to inner):

file
function     void FSplineMeshSceneProxy::GetDynamicRayTracingInstances

Source code excerpt:

void FSplineMeshSceneProxy::GetDynamicRayTracingInstances(struct FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances)
{
	if (CVarRayTracingSplineMeshes.GetValueOnRenderThread() == 0  || !bSupportRayTracing)
	{
		return;
	}

	checkf(!DynamicRayTracingGeometries.IsEmpty(), TEXT("DynamicRayTracingGeometries has not been initialized correctly"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SplineMeshSceneProxy.cpp:347

Scope (from outer to inner):

file
function     void FNaniteSplineMeshSceneProxy::GetDynamicRayTracingInstances

Source code excerpt:

void FNaniteSplineMeshSceneProxy::GetDynamicRayTracingInstances(struct FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances)
{
	if (CVarRayTracingSplineMeshes.GetValueOnRenderThread() == 0)
	{
		return;
	}

	return Nanite::FSceneProxy::GetDynamicRayTracingInstances(Context, OutRayTracingInstances);
}