r.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale

r.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale

#Overview

name: r.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale

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.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale is to control the scale of the radius used for parallax correction when interpolating from the Radiance Cache in Lumen reflections. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for the reflection component.

This setting variable is primarily used in the Lumen Reflections subsystem, which is part of the Renderer module in Unreal Engine 5. It’s utilized in the rendering pipeline to enhance the quality and accuracy of reflections.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 10.0f and can be modified at runtime.

The associated variable GLumenReflectionRadianceCacheReprojectionRadiusScale directly interacts with this console variable. They share the same value, with GLumenReflectionRadianceCacheReprojectionRadiusScale being the actual variable used in the rendering code.

Developers should be aware that this variable affects the performance-quality tradeoff in Lumen reflections. A higher value will increase the radius of the sphere around each Radiance Cache probe, potentially improving the quality of parallax correction but at the cost of performance.

Best practices when using this variable include:

  1. Adjust it carefully, as it can have a significant impact on both visual quality and performance.
  2. Test different values to find the optimal balance for your specific scene.
  3. Be mindful of its interaction with other Lumen settings.
  4. Use it in conjunction with profiling tools to ensure it’s not causing performance issues.

Regarding the associated variable GLumenReflectionRadianceCacheReprojectionRadiusScale:

The purpose of GLumenReflectionRadianceCacheReprojectionRadiusScale is to store and provide the actual value used in the rendering code for the reprojection radius scale.

This variable is used directly in the Lumen Reflections rendering code, specifically in the FDeferredShadingSceneRenderer::RenderLumenReflections function.

Its value is set by the r.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale console variable.

The code clamps the value of GLumenReflectionRadianceCacheReprojectionRadiusScale between 1.0f and 100000.0f before use, ensuring it stays within a reasonable range.

Developers should be aware that modifying GLumenReflectionRadianceCacheReprojectionRadiusScale directly is not recommended. Instead, they should use the console variable to change its value.

Best practices include using the console variable for adjustments and avoiding direct manipulation of GLumenReflectionRadianceCacheReprojectionRadiusScale in custom code unless absolutely necessary.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:60

Scope: file

Source code excerpt:

float GLumenReflectionRadianceCacheReprojectionRadiusScale = 10.0f;
FAutoConsoleVariableRef CVarLumenReflectionRadianceCacheReprojectionRadiusScale(
	TEXT("r.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale"),
	GLumenReflectionRadianceCacheReprojectionRadiusScale,
	TEXT("Scales the radius of the sphere around each Radiance Cache probe that is intersected for parallax correction when interpolating from the Radiance Cache."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

TAutoConsoleVariable<float> CVarLumenReflectionMaxRoughnessToTrace(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:58

Scope: file

Source code excerpt:

);

float GLumenReflectionRadianceCacheReprojectionRadiusScale = 10.0f;
FAutoConsoleVariableRef CVarLumenReflectionRadianceCacheReprojectionRadiusScale(
	TEXT("r.Lumen.Reflections.RadianceCache.ReprojectionRadiusScale"),
	GLumenReflectionRadianceCacheReprojectionRadiusScale,
	TEXT("Scales the radius of the sphere around each Radiance Cache probe that is intersected for parallax correction when interpolating from the Radiance Cache."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

TAutoConsoleVariable<float> CVarLumenReflectionMaxRoughnessToTrace(
	TEXT("r.Lumen.Reflections.MaxRoughnessToTrace"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflections.cpp:1046

Scope (from outer to inner):

file
function     FRDGTextureRef FDeferredShadingSceneRenderer::RenderLumenReflections

Source code excerpt:


	LumenRadianceCache::FRadianceCacheInterpolationParameters RadianceCacheParameters = ScreenProbeRadianceCacheParameters;
	RadianceCacheParameters.RadianceCacheInputs.ReprojectionRadiusScale = FMath::Clamp<float>(GLumenReflectionRadianceCacheReprojectionRadiusScale, 1.0f, 100000.0f);

	LLM_SCOPE_BYTAG(Lumen);
	RDG_EVENT_SCOPE(GraphBuilder, "LumenReflections");
	RDG_GPU_STAT_SCOPE(GraphBuilder, LumenReflections);

	FLumenReflectionTracingParameters ReflectionTracingParameters;