r.LumenScene.SurfaceCache.Feedback
r.LumenScene.SurfaceCache.Feedback
#Overview
name: r.LumenScene.SurfaceCache.Feedback
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use surface cache feedback to selectively map higher quality surface cache pages.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.SurfaceCache.Feedback is to control whether surface cache feedback is used to selectively map higher quality surface cache pages in Lumen, Unreal Engine 5’s global illumination and reflections system.
This setting variable is primarily used by the rendering system, specifically the Lumen subsystem within Unreal Engine 5. It’s part of the surface caching mechanism in Lumen, which is crucial for performance and quality in global illumination and reflections.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.
The associated variable GLumenSurfaceCacheFeedback directly interacts with r.LumenScene.SurfaceCache.Feedback. They share the same value, and GLumenSurfaceCacheFeedback is used in the C++ code to check if the feedback system should be active.
Developers must be aware that this variable affects the performance and quality trade-off in Lumen. When enabled (set to 1), it allows for more selective high-quality surface cache mapping, which can improve visual quality but may have performance implications.
Best practices when using this variable include:
- Enabling it (set to 1) when higher quality global illumination and reflections are needed and performance allows.
- Disabling it (set to 0) if performance is a concern or if the quality improvement is not noticeable in your specific use case.
- Testing different settings to find the right balance between quality and performance for your project.
Regarding GLumenSurfaceCacheFeedback: The purpose of GLumenSurfaceCacheFeedback is to serve as the runtime representation of the r.LumenScene.SurfaceCache.Feedback setting. It’s used in the C++ code to quickly check if the surface cache feedback system should be active.
This variable is used in the Lumen rendering pipeline, specifically in the surface cache feedback system. It’s checked in various parts of the rendering process to determine if feedback-based optimizations should be applied.
The value of GLumenSurfaceCacheFeedback is set by the console variable system, mirroring the value of r.LumenScene.SurfaceCache.Feedback.
Developers should be aware that changes to r.LumenScene.SurfaceCache.Feedback will directly affect GLumenSurfaceCacheFeedback, and vice versa. The variable is used in rendering-critical paths, so changing it at runtime may have immediate effects on performance and quality.
Best practices for GLumenSurfaceCacheFeedback are the same as for r.LumenScene.SurfaceCache.Feedback, as they are essentially two representations of the same setting.
#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:11
Scope: file
Source code excerpt:
int32 GLumenSurfaceCacheFeedback = 1;
FAutoConsoleVariableRef CVarLumenSurfaceCacheFeedback(
TEXT("r.LumenScene.SurfaceCache.Feedback"),
GLumenSurfaceCacheFeedback,
TEXT("Whether to use surface cache feedback to selectively map higher quality surface cache pages."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenSurfaceCacheFeedbackTileSize = 16;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSurfaceCacheFeedback
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneRendering.cpp:1462
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::BeginUpdateLumenSceneTasks
Source code excerpt:
FLumenSceneData::FFeedbackData SurfaceCacheFeedbackData;
{
extern int32 GLumenSurfaceCacheFeedback;
if (GLumenSurfaceCacheFeedback != 0)
{
FrameTemporaries.SurfaceCacheFeedbackBuffer = LumenSceneData.SurfaceCacheFeedback.GetLatestReadbackBuffer();
if (FrameTemporaries.SurfaceCacheFeedbackBuffer)
{
QUICK_SCOPE_CYCLE_COUNTER(LockSurfaceCacheFeedbackBuffer);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSurfaceCacheFeedback.cpp:9
Scope: file
Source code excerpt:
#include "ScenePrivate.h"
int32 GLumenSurfaceCacheFeedback = 1;
FAutoConsoleVariableRef CVarLumenSurfaceCacheFeedback(
TEXT("r.LumenScene.SurfaceCache.Feedback"),
GLumenSurfaceCacheFeedback,
TEXT("Whether to use surface cache feedback to selectively map higher quality surface cache pages."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenSurfaceCacheFeedbackTileSize = 16;
FAutoConsoleVariableRef CVarLumenSurfaceCacheFeedbackTileSize(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSurfaceCacheFeedback.cpp:499
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::BeginGatheringLumenSurfaceCacheFeedback
Source code excerpt:
const bool bLumenActive = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen || ViewPipelineState.ReflectionsMethod == EReflectionsMethod::Lumen;
if (bLumenActive && GLumenSurfaceCacheFeedback != 0)
{
FLumenSceneData& LumenSceneData = *Scene->GetLumenSceneData(View);
const bool bVisualizeUsesFeedback = LumenVisualize::UseSurfaceCacheFeedback(ViewFamily.EngineShowFlags);
const bool bReflectionsUseFeedback = ViewPipelineState.ReflectionsMethod == EReflectionsMethod::Lumen && LumenReflections::UseSurfaceCacheFeedback();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSurfaceCacheFeedback.cpp:531
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::FinishGatheringLumenSurfaceCacheFeedback
Source code excerpt:
const bool bLumenActive = ViewPipelineState.DiffuseIndirectMethod == EDiffuseIndirectMethod::Lumen || ViewPipelineState.ReflectionsMethod == EReflectionsMethod::Lumen;
if (bLumenActive && GLumenSurfaceCacheFeedback != 0)
{
FLumenSceneData& LumenSceneData = *Scene->GetLumenSceneData(View);
if (FrameTemporaries.SurfaceCacheFeedbackResources.BufferUAV)
{
LumenSceneData.SurfaceCacheFeedback.SubmitFeedbackBuffer(Views[0], GraphBuilder, FrameTemporaries.SurfaceCacheFeedbackResources);