r.LumenScene.SurfaceCache.MeshTargetScreenSize
r.LumenScene.SurfaceCache.MeshTargetScreenSize
#Overview
name: r.LumenScene.SurfaceCache.MeshTargetScreenSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls which LOD level will be used to capture static meshes into surface cache.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.SurfaceCache.MeshTargetScreenSize is to control the Level of Detail (LOD) used when capturing static meshes into the surface cache for Lumen, Unreal Engine 5’s global illumination system.
This setting variable is primarily used by the Lumen rendering subsystem within Unreal Engine 5. It’s specifically related to the surface cache component of Lumen, which is responsible for storing and managing scene geometry information for efficient global illumination calculations.
The value of this variable is set through the Unreal Engine console system. It’s defined as a TAutoConsoleVariable with a default value of 0.15f. This means it can be adjusted at runtime through console commands or configuration files.
The associated variable GLumenSceneSurfaceCacheMeshTargetScreenSize directly interacts with r.LumenScene.SurfaceCache.MeshTargetScreenSize. They share the same value and purpose.
Developers should be aware that changing this variable will affect the visual quality and performance of Lumen’s global illumination. A lower value will result in higher quality captures but may impact performance, while a higher value will improve performance at the cost of some visual fidelity.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your project, balancing between visual quality and performance.
- Testing different values to find the optimal setting for your scene.
- Being aware that changes to this variable will trigger a reset of the surface cache (via the Lumen::DebugResetSurfaceCache() function).
Regarding the associated variable GLumenSceneSurfaceCacheMeshTargetScreenSize:
This is the actual C++ variable that stores and provides access to the console variable’s value. It’s used within the rendering code to determine which LOD level to use when capturing static meshes.
In the provided code snippet, we can see it being used to set the TargetScreenSize for mesh LOD selection. This value is then used in a loop that iterates through different mesh LODs to determine which one to render based on the target screen size.
Developers working directly with the C++ code should use GLumenSceneSurfaceCacheMeshTargetScreenSize.GetValueOnRenderThread() to access the current value of this setting in render thread code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneCardCapture.cpp:15
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> GLumenSceneSurfaceCacheMeshTargetScreenSize(
TEXT("r.LumenScene.SurfaceCache.MeshTargetScreenSize"),
0.15f,
TEXT("Controls which LOD level will be used to capture static meshes into surface cache."),
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
{
Lumen::DebugResetSurfaceCache();
}),
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSceneSurfaceCacheMeshTargetScreenSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneCardCapture.cpp:14
Scope: file
Source code excerpt:
#include "RenderUtils.h"
static TAutoConsoleVariable<float> GLumenSceneSurfaceCacheMeshTargetScreenSize(
TEXT("r.LumenScene.SurfaceCache.MeshTargetScreenSize"),
0.15f,
TEXT("Controls which LOD level will be used to capture static meshes into surface cache."),
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable)
{
Lumen::DebugResetSurfaceCache();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneCardCapture.cpp:891
Scope (from outer to inner):
file
function void LumenScene::AddCardCaptureDraws
Source code excerpt:
else
{
const float TargetScreenSize = GLumenSceneSurfaceCacheMeshTargetScreenSize.GetValueOnRenderThread();
int32 PrevLODToRender = INT_MAX;
int32 NextLODToRender = -1;
for (int32 MeshIndex = 0; MeshIndex < PrimitiveSceneInfo->StaticMeshRelevances.Num(); ++MeshIndex)
{
const FStaticMeshBatchRelevance& Mesh = PrimitiveSceneInfo->StaticMeshRelevances[MeshIndex];