r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes
r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes
#Overview
name: r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Number of probes along one dimension of the probe atlas cache texture. This controls the memory usage of the cache. Overflow currently results in incorrect rendering.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes is to control the number of probes along one dimension of the probe atlas cache texture in Unreal Engine’s Lumen lighting system. This setting is crucial for the rendering system, specifically for the Lumen Screen Probe Gather feature.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s referenced in the LumenScreenProbeGather.cpp file, which is part of the Renderer source code.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 128 and can be changed at runtime using the console command system.
The associated variable GRadianceCacheProbeAtlasResolutionInProbes directly interacts with this setting. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable controls the memory usage of the radiance cache. Increasing this value will increase the memory footprint of the cache texture. Additionally, overflow conditions (when more probes are needed than can fit in the atlas) can result in incorrect rendering.
Best practices when using this variable include:
- Carefully balancing memory usage and rendering quality.
- Monitoring for overflow conditions and adjusting the value if necessary.
- Considering the target hardware capabilities when setting this value.
Regarding the associated variable GRadianceCacheProbeAtlasResolutionInProbes:
The purpose of GRadianceCacheProbeAtlasResolutionInProbes is to store and provide access to the number of probes along one dimension of the probe atlas cache texture within the C++ code.
This variable is used in several functions within the LumenScreenProbeGatherRadianceCache namespace, including GetProbeAtlasTextureSize(), GetFinalRadianceAtlasTextureSize(), and GetMaxNumProbes(). These functions are crucial for calculating texture sizes and determining the maximum number of probes that can be stored.
The value of this variable is set by the console variable system, mirroring the value of r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes.
When using this variable, developers should be aware that it directly affects memory usage and rendering capabilities. Changes to this value will impact the size of textures and the number of probes that can be processed.
Best practices include using this variable consistently throughout the codebase when referencing the probe atlas resolution, and ensuring that any changes to its value are reflected in all relevant calculations and memory allocations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:479
Scope: file
Source code excerpt:
int32 GRadianceCacheProbeAtlasResolutionInProbes = 128;
FAutoConsoleVariableRef CVarRadianceCacheProbeAtlasResolutionInProbes(
TEXT("r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes"),
GRadianceCacheProbeAtlasResolutionInProbes,
TEXT("Number of probes along one dimension of the probe atlas cache texture. This controls the memory usage of the cache. Overflow currently results in incorrect rendering."),
ECVF_RenderThreadSafe
);
float GRadianceCacheReprojectionRadiusScale = 1.5f;
#Associated Variable and Callsites
This variable is associated with another variable named GRadianceCacheProbeAtlasResolutionInProbes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:477
Scope: file
Source code excerpt:
);
int32 GRadianceCacheProbeAtlasResolutionInProbes = 128;
FAutoConsoleVariableRef CVarRadianceCacheProbeAtlasResolutionInProbes(
TEXT("r.Lumen.ScreenProbeGather.RadianceCache.ProbeAtlasResolutionInProbes"),
GRadianceCacheProbeAtlasResolutionInProbes,
TEXT("Number of probes along one dimension of the probe atlas cache texture. This controls the memory usage of the cache. Overflow currently results in incorrect rendering."),
ECVF_RenderThreadSafe
);
float GRadianceCacheReprojectionRadiusScale = 1.5f;
FAutoConsoleVariableRef CVarRadianceCacheProbeReprojectionRadiusScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:531
Scope (from outer to inner):
file
namespace LumenScreenProbeGatherRadianceCache
function FIntPoint GetProbeAtlasTextureSize
Source code excerpt:
FIntPoint GetProbeAtlasTextureSize()
{
return FIntPoint(GRadianceCacheProbeAtlasResolutionInProbes * GetProbeResolution());
}
FIntPoint GetFinalRadianceAtlasTextureSize()
{
return FIntPoint(GRadianceCacheProbeAtlasResolutionInProbes * GetFinalProbeResolution(), GRadianceCacheProbeAtlasResolutionInProbes * GetFinalProbeResolution());
}
int32 GetMaxNumProbes()
{
return GRadianceCacheProbeAtlasResolutionInProbes * GRadianceCacheProbeAtlasResolutionInProbes;
}
LumenRadianceCache::FRadianceCacheInputs SetupRadianceCacheInputs(const FViewInfo& View)
{
LumenRadianceCache::FRadianceCacheInputs Parameters = LumenRadianceCache::GetDefaultRadianceCacheInputs();
Parameters.ReprojectionRadiusScale = GRadianceCacheReprojectionRadiusScale;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:551
Scope (from outer to inner):
file
namespace LumenScreenProbeGatherRadianceCache
function LumenRadianceCache::FRadianceCacheInputs SetupRadianceCacheInputs
Source code excerpt:
Parameters.ClipmapDistributionBase = GLumenRadianceCacheClipmapDistributionBase;
Parameters.RadianceProbeClipmapResolution = GetClipmapGridResolution();
Parameters.ProbeAtlasResolutionInProbes = FIntPoint(GRadianceCacheProbeAtlasResolutionInProbes, GRadianceCacheProbeAtlasResolutionInProbes);
Parameters.NumRadianceProbeClipmaps = GetNumClipmaps();
Parameters.RadianceProbeResolution = FMath::Max(GetProbeResolution(), LumenRadianceCache::MinRadianceProbeResolution);
Parameters.FinalProbeResolution = GetFinalProbeResolution();
Parameters.FinalRadianceAtlasMaxMip = GRadianceCacheNumMipmaps - 1;
const float LightingUpdateSpeed = FMath::Clamp(View.FinalPostProcessSettings.LumenFinalGatherLightingUpdateSpeed, .5f, 4.0f);
const float EditingBudgetScale = View.Family->bCurrentlyBeingEdited ? 10.0f : 1.0f;