r.Lumen.RadianceCache.SupersampleDistanceFromCamera
r.Lumen.RadianceCache.SupersampleDistanceFromCamera
#Overview
name: r.Lumen.RadianceCache.SupersampleDistanceFromCamera
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Only probes closer to the camera than this distance can be supersampled.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.RadianceCache.SupersampleDistanceFromCamera is to control the maximum distance from the camera at which radiance cache probes can be supersampled in Unreal Engine 5’s Lumen global illumination system.
This setting variable is primarily used in the Lumen subsystem, specifically within the Radiance Cache component of Lumen. It’s part of the rendering system, focusing on the global illumination calculations.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 2000.0f and can be modified at runtime using console commands or through game code.
The variable interacts closely with GLumenRadianceCacheSupersampleDistanceFromCamera, which is the C++ variable that directly holds the value set by the console variable. It’s also used in conjunction with GLumenRadianceCacheDownsampleDistanceFromCamera to define different quality levels for radiance cache probes at varying distances from the camera.
Developers must be aware that this variable affects the performance and quality trade-off of the Lumen global illumination system. Increasing the value will allow for higher quality lighting at greater distances from the camera, but at the cost of increased computational overhead.
Best practices when using this variable include:
- Adjusting it based on the scale and requirements of your specific scene.
- Balancing it with other Lumen settings for optimal performance and visual quality.
- Testing thoroughly across different types of environments in your game to ensure consistent quality.
Regarding the associated variable GLumenRadianceCacheSupersampleDistanceFromCamera:
This is the C++ variable that directly holds the value set by the r.Lumen.RadianceCache.SupersampleDistanceFromCamera console variable. It’s used internally by the Lumen system to determine which probes should be supersampled.
The purpose of this variable is to store and provide quick access to the supersampling distance value within the C++ code of the Lumen system.
It’s primarily used in the Lumen Radiance Cache subsystem of the Unreal Engine renderer.
The value of this variable is set by the console variable system when r.Lumen.RadianceCache.SupersampleDistanceFromCamera is modified.
It interacts directly with the console variable and is used in calculations to determine probe quality levels.
Developers should be aware that modifying this variable directly in C++ code is not recommended, as it may be overwritten by the console variable system.
Best practices include using the console variable for adjustments rather than modifying this C++ variable directly, and considering its impact on performance when adjusting related Lumen settings.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:92
Scope: file
Source code excerpt:
float GLumenRadianceCacheSupersampleDistanceFromCamera = 2000.0f;
FAutoConsoleVariableRef CVarLumenRadianceCacheSupersampleDistanceFromCamera(
TEXT("r.Lumen.RadianceCache.SupersampleDistanceFromCamera"),
GLumenRadianceCacheSupersampleDistanceFromCamera,
TEXT("Only probes closer to the camera than this distance can be supersampled."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadianceCacheDownsampleDistanceFromCamera = 4000.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenRadianceCacheSupersampleDistanceFromCamera
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:90
Scope: file
Source code excerpt:
);
float GLumenRadianceCacheSupersampleDistanceFromCamera = 2000.0f;
FAutoConsoleVariableRef CVarLumenRadianceCacheSupersampleDistanceFromCamera(
TEXT("r.Lumen.RadianceCache.SupersampleDistanceFromCamera"),
GLumenRadianceCacheSupersampleDistanceFromCamera,
TEXT("Only probes closer to the camera than this distance can be supersampled."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenRadianceCacheDownsampleDistanceFromCamera = 4000.0f;
FAutoConsoleVariableRef CVarLumenRadianceCacheDownsampleDistanceFromCamera(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1106
Scope (from outer to inner):
file
namespace LumenRadianceCache
function float GetSupersampleDistanceFromCamera
Source code excerpt:
float GetSupersampleDistanceFromCamera(const FUpdateInputs& Inputs)
{
return GLumenRadianceCacheSupersampleDistanceFromCamera;
}
class FRadianceCacheSetup
{
public:
TArray<FRadianceCacheClipmap> LastFrameClipmaps;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1880
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
PassParameters->ProbesToUpdateTraceCost = GraphBuilder.CreateSRV(ProbesToUpdateTraceCost[RadianceCacheIndex]);
PassParameters->SupersampleTileBRDFThreshold = GLumenRadianceCacheSupersampleTileBRDFThreshold;
PassParameters->SupersampleDistanceFromCameraSq = GLumenRadianceCacheSupersampleDistanceFromCamera * GLumenRadianceCacheSupersampleDistanceFromCamera;
PassParameters->DownsampleDistanceFromCameraSq = GLumenRadianceCacheDownsampleDistanceFromCamera * GLumenRadianceCacheDownsampleDistanceFromCamera;
PassParameters->ForcedUniformLevel = GLumenRadianceCacheForceUniformTraceTileLevel >= 0 ? FMath::Clamp<int32>(GLumenRadianceCacheForceUniformTraceTileLevel, 0, 2) : 1;
PassParameters->RWDebugBRDFProbabilityDensityFunction = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(DebugBRDFProbabilityDensityFunction));
PassParameters->DebugProbeBRDFOctahedronResolution = DebugProbeBRDFOctahedronResolution;