r.RectLightAtlas.Debug.MipLevel
r.RectLightAtlas.Debug.MipLevel
#Overview
name: r.RectLightAtlas.Debug.MipLevel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set MIP level for visualizing atlas texture in debug mode.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RectLightAtlas.Debug.MipLevel is to set the MIP level for visualizing the rect light atlas texture in debug mode. This setting variable is part of the rendering system in Unreal Engine 5, specifically for debugging rect light atlas textures.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evident from the file path “Runtime/Renderer/Private/RectLightTextureManager.cpp”.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 0 and can be changed at runtime using console commands.
This variable interacts with another variable named CVarRectLighTextureDebugMipLevel. They share the same value and are essentially the same variable, with one being the console command name and the other being the C++ variable name.
Developers must be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed and modified from the render thread without causing race conditions.
Best practices when using this variable include:
- Use it only for debugging purposes, not in production code.
- Be aware of the valid range of MIP levels for your rect light atlas texture.
- Use in conjunction with other debugging tools to get a comprehensive view of the rect light atlas system.
Regarding the associated variable CVarRectLighTextureDebugMipLevel:
The purpose of CVarRectLighTextureDebugMipLevel is the same as r.RectLightAtlas.Debug.MipLevel - to set the MIP level for visualizing the rect light atlas texture in debug mode.
This variable is used in the RectLightAtlas namespace, specifically in the AddRectLightDebugInfoPass function. It’s used to set the AtlasMIPIndex parameter for debug visualization.
The value of this variable is obtained using the GetValueOnRenderThread() method, which ensures thread-safe access on the render thread.
Developers should be aware that the value from this variable is clamped between 0 and the maximum MIP level of the atlas texture (Parameters->AtlasMaxMipLevel-1). This ensures that only valid MIP levels are used for debugging.
Best practices for using this variable include:
- Use it in conjunction with other rect light atlas debugging features for comprehensive analysis.
- Remember that changes to this variable will only affect debug visualization and not the actual rendering of rect lights in the game.
- Be cautious when frequently changing this value, as it may impact performance during debugging sessions.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RectLightTextureManager.cpp:41
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRectLighTextureDebugMipLevel(
TEXT("r.RectLightAtlas.Debug.MipLevel"),
0,
TEXT("Set MIP level for visualizing atlas texture in debug mode."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighForceUpdate(
TEXT("r.RectLightAtlas.ForceUpdate"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarRectLighTextureDebugMipLevel
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RectLightTextureManager.cpp:40
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighTextureDebugMipLevel(
TEXT("r.RectLightAtlas.Debug.MipLevel"),
0,
TEXT("Set MIP level for visualizing atlas texture in debug mode."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighForceUpdate(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RectLightTextureManager.cpp:364
Scope (from outer to inner):
file
namespace RectLightAtlas
function static FRDGTextureRef AddRectLightDebugInfoPass
Source code excerpt:
Parameters->FreeBuffer = GraphBuilder.CreateSRV(FreeBuffer, PF_R16G16B16A16_UINT);
Parameters->ViewUniformBuffer = View.ViewUniformBuffer;
Parameters->AtlasMIPIndex = FMath::Clamp(CVarRectLighTextureDebugMipLevel.GetValueOnRenderThread(), 0u, Parameters->AtlasMaxMipLevel-1);
ShaderPrint::SetParameters(GraphBuilder, View.ShaderPrintData, Parameters->ShaderPrintParameters);
Parameters->OutputTexture = GraphBuilder.CreateUAV(OutputTexture);
TShaderMapRef<FRectLightAtlasDebugInfoCS> ComputeShader(ShaderMap);
const FIntVector DispatchCount = DispatchCount.DivideAndRoundUp(FIntVector(OutputResolution.X, OutputResolution.Y, 1), FIntVector(8, 8, 1));
FComputeShaderUtils::AddPass(GraphBuilder, RDG_EVENT_NAME("RectLightAtlas::DebugInfo"), ComputeShader, Parameters, DispatchCount);