r.Lumen.Visualize.CardGenerationSurfels
r.Lumen.Visualize.CardGenerationSurfels
#Overview
name: r.Lumen.Visualize.CardGenerationSurfels
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Visualize.CardGenerationSurfels is to enable visualization of surfels used in Lumen card generation for debugging and development purposes. This setting variable is part of the Lumen global illumination system in Unreal Engine 5’s rendering subsystem.
Based on the callsites, this variable is primarily used within the Lumen visualization module, specifically in the file LumenVisualize.cpp. It’s part of the Renderer module of Unreal Engine 5.
The value of this variable is set through a console variable (CVar) system, which allows runtime modification. It’s initialized to 0 by default, meaning the visualization is turned off.
This variable interacts closely with another variable named GVisualizeLumenCardGenerationSurfels. They share the same value and are used interchangeably in the code.
Developers should be aware that enabling this visualization may impact performance, as it adds additional rendering overhead. It’s intended for debugging and development purposes, not for use in final, shipped games.
Best practices when using this variable include:
- Only enable it when needed for debugging or development.
- Be aware of the performance impact when enabled.
- Use it in conjunction with other Lumen visualization tools for a comprehensive understanding of the card generation process.
Regarding the associated variable GVisualizeLumenCardGenerationSurfels:
This is an internal integer variable that directly corresponds to the console variable r.Lumen.Visualize.CardGenerationSurfels. It’s used within the C++ code to check if surfel visualization should be performed.
The purpose of GVisualizeLumenCardGenerationSurfels is to provide a quick, efficient way for the C++ code to access the current state of the visualization setting without having to query the console variable system each time.
This variable is set automatically when r.Lumen.Visualize.CardGenerationSurfels is modified, ensuring they always have the same value.
Developers should not modify GVisualizeLumenCardGenerationSurfels directly, but instead use the r.Lumen.Visualize.CardGenerationSurfels console variable to control the visualization. This ensures proper synchronization between the two variables.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:139
Scope: file
Source code excerpt:
int32 GVisualizeLumenCardGenerationSurfels = 0;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardGenerationSurfels(
TEXT("r.Lumen.Visualize.CardGenerationSurfels"),
GVisualizeLumenCardGenerationSurfels,
TEXT(""),
ECVF_RenderThreadSafe
);
float GVisualizeLumenCardGenerationSurfelScale = 1.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GVisualizeLumenCardGenerationSurfels
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:137
Scope: file
Source code excerpt:
);
int32 GVisualizeLumenCardGenerationSurfels = 0;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardGenerationSurfels(
TEXT("r.Lumen.Visualize.CardGenerationSurfels"),
GVisualizeLumenCardGenerationSurfels,
TEXT(""),
ECVF_RenderThreadSafe
);
float GVisualizeLumenCardGenerationSurfelScale = 1.0f;
FAutoConsoleVariableRef CVarVisualizeLumenSceneCardGenerationSurfelScale(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:1237
Scope (from outer to inner):
file
function void VisualizeCardGeneration
Source code excerpt:
void VisualizeCardGeneration(FSceneRenderingBulkObjectAllocator& Allocator, const FViewInfo& View, const FLumenSceneData& LumenSceneData, FViewElementPDI& ViewPDI)
{
if (GVisualizeLumenCardGenerationSurfels == 0
&& GVisualizeLumenCardGenerationCluster == 0)
{
return;
}
// VisualizeCardGeneration runs before LumenSceneUpdate and LumenScene may contain deleted proxies
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:1268
Scope (from outer to inner):
file
function void VisualizeCardGeneration
Source code excerpt:
const FLumenCardBuildDebugData& DebugData = CardRepresentationData->MeshCardsBuildData.DebugData;
if (GVisualizeLumenCardGenerationSurfels)
{
DrawSurfels(Allocator, DebugData.Surfels, PrimitiveToWorld, FLumenCardBuildDebugData::ESurfelType::Valid, FLinearColor::Green, ViewPDI);
DrawSurfels(Allocator, DebugData.Surfels, PrimitiveToWorld, FLumenCardBuildDebugData::ESurfelType::Invalid, FLinearColor::Red, ViewPDI);
for (const FLumenCardBuildDebugData::FRay& Ray : DebugData.SurfelRays)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:1281
Scope (from outer to inner):
file
function void VisualizeCardGeneration
Source code excerpt:
}
if (GVisualizeLumenCardGenerationSurfels == 0
&& GVisualizeLumenCardGenerationCluster != 0
&& PrimitiveGroup.MeshCardsIndex >= 0)
{
const FLumenMeshCards& MeshCardsEntry = LumenSceneData.MeshCards[PrimitiveGroup.MeshCardsIndex];
for (uint32 CardIndex = MeshCardsEntry.FirstCardIndex; CardIndex < MeshCardsEntry.FirstCardIndex + MeshCardsEntry.NumCards; ++CardIndex)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:1339
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::LumenScenePDIVisualization
Source code excerpt:
|| GVisualizeLumenRayTracingGroups != 0
|| GVisualizeLumenCardGenerationCluster != 0
|| GVisualizeLumenCardGenerationSurfels != 0)
{
FViewElementPDI ViewPDI(&Views[0], nullptr, &Views[0].DynamicPrimitiveCollector);
VisualizeRayTracingGroups(Views[0], LumenSceneData, ViewPDI);
VisualizeCardPlacement(Allocator, Views[0], LumenSceneData, ViewPDI);
VisualizeCardGeneration(Allocator, Views[0], LumenSceneData, ViewPDI);
}