r.LumenScene.SurfaceCache.Feedback.TileSize
r.LumenScene.SurfaceCache.Feedback.TileSize
#Overview
name: r.LumenScene.SurfaceCache.Feedback.TileSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
One surface cache feedback element will be writen out per tile. Aligned to a power of two.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.SurfaceCache.Feedback.TileSize is to control the tile size for the Lumen Surface Cache feedback system in Unreal Engine 5’s rendering pipeline. This setting variable is specifically used for the Lumen global illumination system, which is part of the engine’s advanced rendering features.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is utilized in the LumenSurfaceCacheFeedback.cpp file, which is part of the Lumen scene rendering system.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 16 and can be changed at runtime using the console command system.
The associated variable GLumenSurfaceCacheFeedbackTileSize directly interacts with this console variable. They share the same value, with GLumenSurfaceCacheFeedbackTileSize being the actual variable used in the C++ code to determine the tile size.
Developers must be aware of several things when using this variable:
- The tile size affects the granularity of the surface cache feedback system.
- The value should be a power of two for optimal performance.
- The variable has both scalability and render thread safety flags, indicating it can affect performance and should be handled carefully in multi-threaded scenarios.
Best practices when using this variable include:
- Keep the value as a power of two for better performance and alignment.
- Balance between precision (smaller tiles) and performance (larger tiles) based on the specific needs of your project.
- Test different values to find the optimal setting for your specific scene and performance requirements.
Regarding the associated variable GLumenSurfaceCacheFeedbackTileSize:
- It’s the actual integer variable used in the code to determine the tile size.
- It’s clamped between 1 and 256 and rounded up to the nearest power of two when used (see the GetFeedbackBufferTileSize() function).
- It’s used to calculate the tile wrap mask, which is likely used for efficient indexing operations.
When working with GLumenSurfaceCacheFeedbackTileSize, developers should be aware that any changes to r.LumenScene.SurfaceCache.Feedback.TileSize will directly affect this variable, and vice versa. The GetFeedbackBufferTileSize() function ensures that the final value used is always a power of two between 1 and 256, which is an important constraint to keep in mind when adjusting these values.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSurfaceCacheFeedback.cpp:19
Scope: file
Source code excerpt:
int32 GLumenSurfaceCacheFeedbackTileSize = 16;
FAutoConsoleVariableRef CVarLumenSurfaceCacheFeedbackTileSize(
TEXT("r.LumenScene.SurfaceCache.Feedback.TileSize"),
GLumenSurfaceCacheFeedbackTileSize,
TEXT("One surface cache feedback element will be writen out per tile. Aligned to a power of two."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenSurfaceCacheFeedbackResLevelBias = -0.5f;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSurfaceCacheFeedbackTileSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSurfaceCacheFeedback.cpp:17
Scope: file
Source code excerpt:
);
int32 GLumenSurfaceCacheFeedbackTileSize = 16;
FAutoConsoleVariableRef CVarLumenSurfaceCacheFeedbackTileSize(
TEXT("r.LumenScene.SurfaceCache.Feedback.TileSize"),
GLumenSurfaceCacheFeedbackTileSize,
TEXT("One surface cache feedback element will be writen out per tile. Aligned to a power of two."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenSurfaceCacheFeedbackResLevelBias = -0.5f;
FAutoConsoleVariableRef CVarLumenSurfaceCacheFeedbackResLevelBias(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSurfaceCacheFeedback.cpp:55
Scope (from outer to inner):
file
function uint32 Lumen::GetFeedbackBufferTileSize
Source code excerpt:
uint32 Lumen::GetFeedbackBufferTileSize()
{
return FMath::RoundUpToPowerOfTwo(FMath::Clamp(GLumenSurfaceCacheFeedbackTileSize, 1, 256));
}
uint32 Lumen::GetFeedbackBufferTileWrapMask()
{
// Index & TileWrapMask = Index % TileSize
return GetFeedbackBufferTileSize() - 1;