r.RectLightAtlas.FilterQuality
r.RectLightAtlas.FilterQuality
#Overview
name: r.RectLightAtlas.FilterQuality
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Define the filtering quality used for filtering texture (0:Box filter, 1:Gaussian filter).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RectLightAtlas.FilterQuality is to define the filtering quality used for filtering textures in the rectangular light atlas system. This setting variable is specifically for the rendering system, particularly for the management of rectangular light textures.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the RectLightTextureManager component. It’s part of the rectangular light atlas system, which is responsible for managing and optimizing the textures used for rectangular lights in the scene.
The value of this variable is set through a console variable (CVar) named CVarRectLighFilterQuality. It’s initialized with a default value of 1, which corresponds to a Gaussian filter. The variable allows for two possible values: 0 for a Box filter, and 1 for a Gaussian filter.
The associated variable CVarRectLighFilterQuality directly interacts with r.RectLightAtlas.FilterQuality. They share the same value and purpose.
Developers must be aware that this variable affects the quality of texture filtering for rectangular lights. A higher quality filter (Gaussian) may produce better visual results but could potentially have a higher performance cost compared to the box filter.
Best practices when using this variable include:
- Consider the performance implications when choosing between box and Gaussian filters.
- Test both filter options to find the best balance between visual quality and performance for your specific use case.
- Be aware that changes to this variable will affect all rectangular lights in the scene.
Regarding the associated variable CVarRectLighFilterQuality:
The purpose of CVarRectLighFilterQuality is the same as r.RectLightAtlas.FilterQuality - to control the filtering quality for rectangular light textures.
It’s used in the Renderer module, specifically in the RectLightTextureManager component.
The value is set when the CVar is initialized, but can be changed at runtime through console commands.
This variable directly interacts with r.RectLightAtlas.FilterQuality, as they share the same value.
Developers should be aware that this is the actual variable used in the code to retrieve the filter quality setting. It’s accessed using the GetValueOnRenderThread() method, which ensures thread-safe access to the value.
Best practices include using this variable consistently throughout the codebase when referring to the rectangular light atlas filter quality, and ensuring that any modifications to its value are done in a thread-safe manner, preferably through the appropriate Unreal Engine console variable interfaces.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RectLightTextureManager.cpp:53
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarRectLighFilterQuality(
TEXT("r.RectLightAtlas.FilterQuality"),
1,
TEXT("Define the filtering quality used for filtering texture (0:Box filter, 1:Gaussian filter)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighMaxTextureRatio(
TEXT("r.RectLightAtlas.MaxTextureRatio"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarRectLighFilterQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RectLightTextureManager.cpp:52
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighFilterQuality(
TEXT("r.RectLightAtlas.FilterQuality"),
1,
TEXT("Define the filtering quality used for filtering texture (0:Box filter, 1:Gaussian filter)."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarRectLighMaxTextureRatio(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RectLightTextureManager.cpp:726
Scope (from outer to inner):
file
namespace RectLightAtlas
function static void FilterSlotsPass
Source code excerpt:
FRectAtlasFilterTexturePS::FParameters* Parameters = GraphBuilder.AllocParameters<FRectAtlasFilterTexturePS::FParameters>();
Parameters->FilterQuality = FMath::Clamp(CVarRectLighFilterQuality.GetValueOnRenderThread(), 0, 1);
Parameters->SrcAtlasResolution = ToMIP(InAtlas->Desc.Extent, SrcMip);
Parameters->DstSlotBuffer = GraphBuilder.CreateSRV(DstSlotBuffer, PF_R16G16B16A16_UINT);
Parameters->SrcSlotBuffer = GraphBuilder.CreateSRV(SrcSlotBuffer, PF_R16G16B16A16_UINT);
Parameters->SourceAtlasTexture = GraphBuilder.CreateSRV(FRDGTextureSRVDesc::CreateForMipLevel(InAtlas, SrcMip));
Parameters->SourceAtlasSampler = TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
Parameters->VS.AtlasResolution = ToMIP(InAtlas->Desc.Extent, DstMip);