r.Shadow.RectLightReceiverBias
r.Shadow.RectLightReceiverBias
#Overview
name: r.Shadow.RectLightReceiverBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Receiver bias used by rect light. Value between 0 and 1.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.RectLightReceiverBias is to control the receiver bias used for rectangular light shadows in Unreal Engine’s rendering system. This setting variable is specifically designed to fine-tune the shadow rendering for rectangular lights.
This setting variable is primarily used by the Renderer module of Unreal Engine, specifically within the shadow rendering subsystem. It’s referenced in the ShadowRendering.cpp file, which is part of the core rendering functionality.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0.3f and can be adjusted at runtime. The value is constrained between 0 and 1, as indicated in the description.
The variable interacts directly with its associated variable CVarRectLightShadowReceiverBias. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the shadow rendering quality for rectangular lights. Adjusting this value can help reduce shadow artifacts or improve shadow definition, depending on the specific needs of the scene.
Best practices when using this variable include:
- Start with the default value (0.3f) and adjust only if necessary.
- Test changes in various lighting conditions to ensure optimal results.
- Be mindful that extreme values (close to 0 or 1) may introduce undesirable visual artifacts.
- Consider the performance impact when adjusting this value, as it may affect shadow rendering complexity.
Regarding the associated variable CVarRectLightShadowReceiverBias:
The purpose of CVarRectLightShadowReceiverBias is identical to r.Shadow.RectLightReceiverBias. It’s an implementation detail that allows the engine to access the same value through the console variable system.
This variable is used in the GetShaderReceiverDepthBias function within the FProjectedShadowInfo class. It’s specifically accessed for rectangular lights (LightType_Rect) to determine the appropriate shadow receiver bias.
The value of this variable is set and accessed using the GetValueOnRenderThread() method, ensuring thread-safe operations in the rendering pipeline.
Developers should treat CVarRectLightShadowReceiverBias as an internal implementation of r.Shadow.RectLightReceiverBias. They should not attempt to modify or access this variable directly, but instead use the r.Shadow.RectLightReceiverBias console command for any necessary adjustments.
Best practices for CVarRectLightShadowReceiverBias align with those of r.Shadow.RectLightReceiverBias, as they represent the same underlying value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowRendering.cpp:105
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarRectLightShadowReceiverBias(
TEXT("r.Shadow.RectLightReceiverBias"),
0.3f,
TEXT("Receiver bias used by rect light. Value between 0 and 1."),
ECVF_RenderThreadSafe);
///////////////////////////////////////////////////////////////////////////////////////////////////
// Spot light
#Associated Variable and Callsites
This variable is associated with another variable named CVarRectLightShadowReceiverBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowRendering.cpp:104
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarRectLightShadowReceiverBias(
TEXT("r.Shadow.RectLightReceiverBias"),
0.3f,
TEXT("Receiver bias used by rect light. Value between 0 and 1."),
ECVF_RenderThreadSafe);
///////////////////////////////////////////////////////////////////////////////////////////////////
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowRendering.cpp:1971
Scope (from outer to inner):
file
function float FProjectedShadowInfo::GetShaderReceiverDepthBias
Source code excerpt:
{
case LightType_Directional : ShadowReceiverBias = CVarCSMShadowReceiverBias.GetValueOnRenderThread(); break;
case LightType_Rect : ShadowReceiverBias = CVarRectLightShadowReceiverBias.GetValueOnRenderThread(); break;
case LightType_Spot : ShadowReceiverBias = CVarSpotLightShadowReceiverBias.GetValueOnRenderThread(); break;
case LightType_Point : ShadowReceiverBias = GetShaderSlopeDepthBias(); break;
}
}
// Return the min lerp value for depth biasing