r.LumenScene.Heightfield.MaxTracingSteps

r.LumenScene.Heightfield.MaxTracingSteps

#Overview

name: r.LumenScene.Heightfield.MaxTracingSteps

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.LumenScene.Heightfield.MaxTracingSteps is to control the maximum number of steps for heightfield (Landscape) software ray tracing in the Lumen global illumination system of Unreal Engine 5.

This setting variable is primarily used by the Lumen rendering subsystem, specifically for the heightfield (landscape) ray tracing component. It’s part of the Renderer module in Unreal Engine 5.

The value of this variable is set through the console variable system. It’s initialized with a default value of 32, but can be changed at runtime using console commands or through configuration files.

The associated variable CVarLumenSceneHeightfieldMaxTracingSteps directly interacts with r.LumenScene.Heightfield.MaxTracingSteps. This C++ variable is used to access and modify the console variable’s value within the engine’s code.

Developers should be aware that this variable affects the performance and quality trade-off in Lumen’s heightfield ray tracing. A higher value may produce more accurate results but at the cost of increased computational load.

Best practices when using this variable include:

  1. Adjusting it based on the complexity of your landscape and desired visual quality.
  2. Balancing it with other Lumen settings for optimal performance.
  3. Testing different values to find the sweet spot for your specific scene.

Regarding the associated variable CVarLumenSceneHeightfieldMaxTracingSteps:

Its purpose is to provide a programmatic interface to the r.LumenScene.Heightfield.MaxTracingSteps console variable within the C++ code.

It’s used in the Lumen subsystem of the Renderer module, specifically in the LumenHeightfields component.

The value is set when the console variable is created, but it can be accessed and potentially modified at runtime through the GetValueOnRenderThread() method.

It interacts directly with the r.LumenScene.Heightfield.MaxTracingSteps console variable, essentially serving as its C++ representation.

Developers should be aware that this variable is used in the GetHeightfieldMaxTracingSteps() function, which clamps the value between 1 and 256. This ensures that the setting stays within a reasonable range.

Best practices for using this variable include:

  1. Accessing it through the provided getter function (GetHeightfieldMaxTracingSteps()) rather than directly.
  2. Being mindful of the performance implications when modifying its value.
  3. Considering its impact on the overall Lumen system when making changes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenHeightfields.cpp:12

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenSceneHeightfieldMaxTracingSteps(
	TEXT("r.LumenScene.Heightfield.MaxTracingSteps"),
	32,
	TEXT("Sets the maximum steps for heightfield (Landscape) software ray tracing (default = 32)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarLumenSceneHeightfieldReceiverBias(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenHeightfields.cpp:11

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenSceneHeightfieldMaxTracingSteps(
	TEXT("r.LumenScene.Heightfield.MaxTracingSteps"),
	32,
	TEXT("Sets the maximum steps for heightfield (Landscape) software ray tracing (default = 32)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenHeightfields.cpp:41

Scope (from outer to inner):

file
function     int32 Lumen::GetHeightfieldMaxTracingSteps

Source code excerpt:

int32 Lumen::GetHeightfieldMaxTracingSteps()
{
	return FMath::Clamp(CVarLumenSceneHeightfieldMaxTracingSteps.GetValueOnRenderThread(), 1, 256);
}

float Lumen::GetHeightfieldReceiverBias()
{
	return FMath::Clamp(CVarLumenSceneHeightfieldReceiverBias.GetValueOnRenderThread(), 0.001, 100.0);
}