r.RayTracing.Geometry.Text

r.RayTracing.Geometry.Text

#Overview

name: r.RayTracing.Geometry.Text

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.Text is to control the inclusion of text meshes in ray tracing effects within Unreal Engine 5. This setting variable is part of the ray tracing system, specifically targeting the rendering of text geometries.

This setting variable is primarily used in the Engine module, specifically within the TextRenderComponent system. It is referenced in the TextRenderComponent.cpp file, which suggests it’s closely tied to the text rendering functionality of Unreal Engine.

The value of this variable is set using a console variable (CVarRayTracingTextMeshes) with a default value of 1, meaning text meshes are enabled in ray tracing by default.

The associated variable CVarRayTracingTextMeshes directly interacts with r.RayTracing.Geometry.Text. They share the same value and purpose.

Developers must be aware that this variable affects the performance and visual quality of ray-traced scenes that include text meshes. Enabling this feature (value set to 1) will include text meshes in ray tracing calculations, potentially improving visual quality but at the cost of increased computational load.

Best practices when using this variable include:

  1. Consider the performance impact of including text meshes in ray tracing, especially for scenes with a large amount of text.
  2. Use it in conjunction with other ray tracing settings to achieve the desired balance between visual quality and performance.
  3. Test scenes with this setting both enabled and disabled to determine the optimal configuration for your specific use case.

Regarding the associated variable CVarRayTracingTextMeshes:

The purpose of CVarRayTracingTextMeshes is to provide a programmable interface to control the r.RayTracing.Geometry.Text setting. It’s an auto console variable that allows runtime modification of the text mesh ray tracing behavior.

This variable is used in the Engine module, specifically within the TextRenderComponent system. It’s checked in the GetDynamicRayTracingInstances function of the FTextRenderSceneProxy class to determine whether to proceed with ray tracing for text meshes.

The value of CVarRayTracingTextMeshes is set at initialization with a default of 1, but it can be changed at runtime through console commands.

Developers should be aware that changes to CVarRayTracingTextMeshes will immediately affect the ray tracing behavior for text meshes. It’s particularly useful for performance tuning and debugging.

Best practices for using CVarRayTracingTextMeshes include:

  1. Use it for quick toggling of text mesh ray tracing during development and testing.
  2. Consider exposing it as a user-configurable setting in graphics options if text ray tracing has a significant performance impact in your game.
  3. Monitor its value when diagnosing ray tracing performance issues, especially in text-heavy scenes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/TextRenderComponent.cpp:25

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRayTracingTextMeshes(
	TEXT("r.RayTracing.Geometry.Text"),
	1,
	TEXT("Include text meshes in ray tracing effects (default = 1 (text meshes enabled in ray tracing))"));

#define LOCTEXT_NAMESPACE "TextRenderComponent"

ATextRenderActor::ATextRenderActor(const FObjectInitializer& ObjectInitializer)

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/TextRenderComponent.cpp:24

Scope: file

Source code excerpt:

#include "DataDrivenShaderPlatformInfo.h"

static TAutoConsoleVariable<int32> CVarRayTracingTextMeshes(
	TEXT("r.RayTracing.Geometry.Text"),
	1,
	TEXT("Include text meshes in ray tracing effects (default = 1 (text meshes enabled in ray tracing))"));

#define LOCTEXT_NAMESPACE "TextRenderComponent"

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/TextRenderComponent.cpp:890

Scope (from outer to inner):

file
function     void FTextRenderSceneProxy::GetDynamicRayTracingInstances

Source code excerpt:

void FTextRenderSceneProxy::GetDynamicRayTracingInstances(FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances)
{
	if (CVarRayTracingTextMeshes.GetValueOnRenderThread() == 0 || !bSupportRayTracing)
	{
		return;
	}
	// Vertex factory will not been initialized when the text string is empty or font is invalid.
	if (!VertexFactory.IsInitialized())
	{