r.RayTracing.Geometry.Landscape

r.RayTracing.Geometry.Landscape

#Overview

name: r.RayTracing.Geometry.Landscape

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.Landscape is to control the inclusion of landscapes in ray tracing effects within Unreal Engine 5. This setting variable is specifically for the rendering system, particularly the ray tracing subsystem.

The Unreal Engine subsystem that relies on this setting variable is the Landscape rendering module, as evidenced by its usage in the LandscapeRender.cpp file. This variable is crucial for determining whether landscape geometry should be included in ray tracing calculations.

The value of this variable is set as a console variable with a default value of 1, meaning landscape is enabled in ray tracing by default. It can be changed at runtime through the console or configuration files.

This variable interacts with the associated variable CVarRayTracingLandscape, which shares the same value and purpose. They are essentially two ways to access the same setting.

Developers must be aware that this variable directly impacts the performance and visual quality of ray-traced scenes that include landscape elements. Enabling this feature (value set to 1) will include landscapes in ray tracing effects, potentially increasing visual fidelity but also increasing computational cost.

Best practices when using this variable include:

  1. Consider the performance implications of enabling landscape in ray tracing, especially for large or complex landscapes.
  2. Test scenes with this setting both enabled and disabled to find the right balance between visual quality and performance.
  3. Be aware that changing this setting at runtime may have immediate effects on the rendering pipeline.

Regarding the associated variable CVarRayTracingLandscape:

The purpose of CVarRayTracingLandscape is identical to r.RayTracing.Geometry.Landscape. It’s an alternative way to access and modify the same setting.

This variable is used within the Landscape rendering module, specifically in the ray tracing-related functions.

The value is set in the same manner as r.RayTracing.Geometry.Landscape, with a default of 1.

CVarRayTracingLandscape interacts directly with r.RayTracing.Geometry.Landscape, as they represent the same setting.

Developers should be aware that modifying either CVarRayTracingLandscape or r.RayTracing.Geometry.Landscape will have the same effect on the engine’s behavior.

Best practices for CVarRayTracingLandscape are the same as those for r.RayTracing.Geometry.Landscape. Developers should choose one consistent way to reference this setting in their code to avoid confusion.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:238

Scope: file

Source code excerpt:

#if RHI_RAYTRACING
static TAutoConsoleVariable<int32> CVarRayTracingLandscape(
	TEXT("r.RayTracing.Geometry.Landscape"),
	1,
	TEXT("Include landscapes in ray tracing effects (default = 1 (landscape enabled in ray tracing))"));

int32 GLandscapeRayTracingGeometryLODsThatUpdateEveryFrame = 0;
static FAutoConsoleVariableRef CVarLandscapeRayTracingGeometryLODsThatUpdateEveryFrame(
	TEXT("r.RayTracing.Geometry.Landscape.LODsUpdateEveryFrame"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:237

Scope: file

Source code excerpt:


#if RHI_RAYTRACING
static TAutoConsoleVariable<int32> CVarRayTracingLandscape(
	TEXT("r.RayTracing.Geometry.Landscape"),
	1,
	TEXT("Include landscapes in ray tracing effects (default = 1 (landscape enabled in ray tracing))"));

int32 GLandscapeRayTracingGeometryLODsThatUpdateEveryFrame = 0;
static FAutoConsoleVariableRef CVarLandscapeRayTracingGeometryLODsThatUpdateEveryFrame(

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:2989

Scope (from outer to inner):

file
function     void FLandscapeComponentSceneProxy::GetDynamicRayTracingInstances

Source code excerpt:

void FLandscapeComponentSceneProxy::GetDynamicRayTracingInstances(FRayTracingMaterialGatheringContext& Context, TArray<FRayTracingInstance>& OutRayTracingInstances)
{
	if (!bRegistered || !CVarRayTracingLandscape.GetValueOnRenderThread())
	{
		return;
	}

	const FSceneView& SceneView = *Context.ReferenceView;
	const FLandscapeRenderSystem& RenderSystem = *LandscapeRenderSystems.FindChecked(LandscapeKey);