r.Lumen.Reflections.SurfaceCacheFeedback

r.Lumen.Reflections.SurfaceCacheFeedback

#Overview

name: r.Lumen.Reflections.SurfaceCacheFeedback

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.SurfaceCacheFeedback is to control whether reflection rays can write into the virtual surface cache feedback buffer in the Lumen rendering system of Unreal Engine 5.

This setting variable is primarily used in the Lumen reflections subsystem, which is part of the larger Lumen global illumination system in Unreal Engine 5’s rendering module.

The value of this variable is set through a console variable (CVarLumenReflectionsSurfaceCacheFeedback) in the Unreal Engine’s configuration system. It’s defined with a default value of 1, meaning the feature is enabled by default.

This variable interacts directly with its associated variable CVarLumenReflectionsSurfaceCacheFeedback, which is used to query the current state of the setting in the code.

Developers should be aware that this variable affects the performance and quality of reflections in the Lumen system. Enabling this feature (value != 0) allows reflection rays to contribute to the virtual surface cache, potentially improving the accuracy of reflections but at a performance cost.

Best practices when using this variable include:

  1. Consider disabling it (set to 0) on lower-end hardware to improve performance.
  2. Test the visual impact and performance implications in your specific scene before changing the default value.
  3. Use it in conjunction with other Lumen reflection settings for optimal results.

Regarding the associated variable CVarLumenReflectionsSurfaceCacheFeedback:

The purpose of CVarLumenReflectionsSurfaceCacheFeedback is to provide a programmatic way to access and modify the r.Lumen.Reflections.SurfaceCacheFeedback setting within the C++ code of Unreal Engine.

This variable is used in the Lumen reflections subsystem of the rendering module.

The value of this variable is set when the engine initializes its console variables, and it can be modified at runtime through console commands.

It interacts directly with the r.Lumen.Reflections.SurfaceCacheFeedback setting, effectively controlling the same feature.

Developers should be aware that this variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating that it can be safely changed for scalability purposes and is safe to modify from the render thread.

Best practices when using this variable include:

  1. Use GetValueOnRenderThread() to safely access its value from render thread code.
  2. Consider exposing this setting in your game’s graphics options if reflection quality is a key visual feature.
  3. Be cautious when changing this value dynamically, as it may impact performance and visual consistency.

#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:260

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenReflectionsSurfaceCacheFeedback(
	TEXT("r.Lumen.Reflections.SurfaceCacheFeedback"),
	1,
	TEXT("Whether to allow writing into virtual surface cache feedback buffer from reflection rays."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenReflectionsHiResSurface(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenReflectionsSurfaceCacheFeedback(
	TEXT("r.Lumen.Reflections.SurfaceCacheFeedback"),
	1,
	TEXT("Whether to allow writing into virtual surface cache feedback buffer from reflection rays."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     bool LumenReflections::UseSurfaceCacheFeedback

Source code excerpt:

bool LumenReflections::UseSurfaceCacheFeedback()
{
	return CVarLumenReflectionsSurfaceCacheFeedback.GetValueOnRenderThread() != 0;
}

bool LumenReflections::UseAsyncCompute(const FViewFamilyInfo& ViewFamily)
{
	return Lumen::UseAsyncCompute(ViewFamily) && CVarLumenReflectionsAsyncCompute.GetValueOnRenderThread() != 0;
}