r.Shadow.Virtual.PageMarkingPixelStrideY
r.Shadow.Virtual.PageMarkingPixelStrideY
#Overview
name: r.Shadow.Virtual.PageMarkingPixelStrideY
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Same as PageMarkingPixelStrideX, but on the vertical axis of the screen.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.Virtual.PageMarkingPixelStrideY is to control the vertical stride for page marking in virtual shadow maps. It determines the spacing between pixels sampled vertically when marking pages for allocation in the virtual shadow map system.
This setting variable is part of Unreal Engine’s rendering system, specifically the virtual shadow map subsystem. It’s used in the Renderer module, within the VirtualShadowMaps component.
The value of this variable is set through a console variable (CVarVirtualShadowMapPageMarkingPixelStrideY) with a default value of 2. It can be changed at runtime through console commands or programmatically.
This variable interacts closely with CVarVirtualShadowMapPageMarkingPixelStrideX, which controls the horizontal stride. Together, they define a 2D stride for page marking.
Developers should be aware that:
- This variable affects performance and quality of virtual shadow maps.
- Lower values provide more accurate page allocation but at a higher performance cost.
- The value is clamped between 1 and 128 when used.
Best practices when using this variable include:
- Adjusting it in conjunction with PageMarkingPixelStrideX for balanced performance.
- Testing different values to find the optimal balance between shadow quality and performance for your specific scene.
- Consider scene complexity and target hardware when setting this value.
Regarding the associated variable CVarVirtualShadowMapPageMarkingPixelStrideY:
The purpose of CVarVirtualShadowMapPageMarkingPixelStrideY is to provide a configurable interface for the r.Shadow.Virtual.PageMarkingPixelStrideY setting. It’s an auto console variable that allows runtime modification of the vertical stride value.
This variable is part of the same virtual shadow map system in the Renderer module. Its value is set when the engine initializes and can be modified through console commands.
CVarVirtualShadowMapPageMarkingPixelStrideY directly controls r.Shadow.Virtual.PageMarkingPixelStrideY. When its value is accessed, it’s done through the GetValueOnRenderThread() method, ensuring thread-safe access.
Developers should be aware that:
- Changes to this variable take effect immediately on the render thread.
- It’s marked as ECVF_RenderThreadSafe, meaning it’s safe to modify from any thread.
Best practices for using this variable include:
- Using it for runtime adjustments and performance tuning.
- Considering its impact on both performance and shadow quality when modifying.
- Documenting any non-default values used in production to aid in debugging and optimization.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.cpp:344
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVirtualShadowMapPageMarkingPixelStrideY(
TEXT("r.Shadow.Virtual.PageMarkingPixelStrideY"),
2,
TEXT("Same as PageMarkingPixelStrideX, but on the vertical axis of the screen."),
ECVF_RenderThreadSafe);
namespace Nanite
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarVirtualShadowMapPageMarkingPixelStrideY
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.cpp:343
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarVirtualShadowMapPageMarkingPixelStrideY(
TEXT("r.Shadow.Virtual.PageMarkingPixelStrideY"),
2,
TEXT("Same as PageMarkingPixelStrideX, but on the vertical axis of the screen."),
ECVF_RenderThreadSafe);
namespace Nanite
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapArray.cpp:1478
Scope (from outer to inner):
file
function void FVirtualShadowMapArray::BuildPageAllocations
lambda-function
Source code excerpt:
const FIntPoint PixelStride(
FMath::Clamp(CVarVirtualShadowMapPageMarkingPixelStrideX.GetValueOnRenderThread(), 1, 128),
FMath::Clamp(CVarVirtualShadowMapPageMarkingPixelStrideY.GetValueOnRenderThread(), 1, 128));
// If Lumen has valid front layer history data use it, otherwise use same frame front layer depth
bool bFrontLayerEnabled = false;
if (IsVSMTranslucentHighQualityEnabled())
{
if (FrontLayerTranslucencyData.IsValid())