r.CapsuleMinSkyAngle
r.CapsuleMinSkyAngle
#Overview
name: r.CapsuleMinSkyAngle
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimum light source angle derived from the precomputed unoccluded sky vector (stationary skylight present)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.CapsuleMinSkyAngle is to set the minimum light source angle derived from the precomputed unoccluded sky vector when a stationary skylight is present in the scene. This setting variable is part of the rendering system, specifically related to capsule shadow rendering and indirect lighting calculations.
This setting variable is primarily used in the Renderer module of Unreal Engine, as evidenced by its location in the CapsuleShadowRendering.cpp file. It’s particularly relevant for the capsule shadow rendering system and indirectly affects the lighting calculations.
The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. This allows the value to be changed at runtime or through configuration files.
The associated variable GCapsuleMinSkyAngle interacts directly with r.CapsuleMinSkyAngle. They share the same value, with GCapsuleMinSkyAngle being the actual float variable used in the code, while r.CapsuleMinSkyAngle is the console variable name used to set its value.
Developers must be aware that this variable affects the minimum angle used in calculating indirect lighting from the sky. It’s used in conjunction with other variables like GCapsuleSkyAngleScale to determine the cone angle for indirect shadows from the sky.
Best practices when using this variable include:
- Understanding its impact on lighting quality and performance.
- Adjusting it in conjunction with other related variables for optimal results.
- Testing different values in various lighting scenarios to find the best balance between quality and performance.
Regarding the associated variable GCapsuleMinSkyAngle:
The purpose of GCapsuleMinSkyAngle is to store the actual float value used in the capsule shadow rendering calculations. It’s directly linked to r.CapsuleMinSkyAngle and is used in the code where the minimum sky angle calculations are performed.
This variable is used within the Renderer module, specifically in the capsule shadow rendering system. It’s accessed in the creation of indirect capsule shadow resources and in the calculation of light directions.
The value of GCapsuleMinSkyAngle is set through the r.CapsuleMinSkyAngle console variable. Any changes to r.CapsuleMinSkyAngle will directly affect GCapsuleMinSkyAngle.
GCapsuleMinSkyAngle interacts with other variables in the lighting calculations, such as GCapsuleSkyAngleScale and GCapsuleIndirectConeAngle.
Developers should be aware that modifying GCapsuleMinSkyAngle directly in the code is not recommended. Instead, they should use the r.CapsuleMinSkyAngle console variable to adjust its value.
Best practices for GCapsuleMinSkyAngle include:
- Accessing its value through the appropriate getter functions or directly when necessary in rendering code.
- Understanding its role in the broader context of capsule shadow rendering and indirect lighting calculations.
- Considering its impact when optimizing rendering performance or adjusting lighting quality.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:106
Scope: file
Source code excerpt:
float GCapsuleMinSkyAngle = 15;
FAutoConsoleVariableRef CVarCapsuleMinSkyAngle(
TEXT("r.CapsuleMinSkyAngle"),
GCapsuleMinSkyAngle,
TEXT("Minimum light source angle derived from the precomputed unoccluded sky vector (stationary skylight present)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
const int32 GComputeLightDirectionFromVolumetricLightmapGroupSize = 64;
#Associated Variable and Callsites
This variable is associated with another variable named GCapsuleMinSkyAngle
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:104
Scope: file
Source code excerpt:
);
float GCapsuleMinSkyAngle = 15;
FAutoConsoleVariableRef CVarCapsuleMinSkyAngle(
TEXT("r.CapsuleMinSkyAngle"),
GCapsuleMinSkyAngle,
TEXT("Minimum light source angle derived from the precomputed unoccluded sky vector (stationary skylight present)"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
const int32 GComputeLightDirectionFromVolumetricLightmapGroupSize = 64;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:791
Scope (from outer to inner):
file
function static IndirectCapsuleShadowsResources CreateIndirectCapsuleShadowsResources
Source code excerpt:
// Stationary sky light case
// Get the indirect shadow direction from the unoccluded sky direction
const float ConeAngle = FMath::Max(Allocation->CurrentSkyBentNormal.W * GCapsuleSkyAngleScale * .5f * PI, GCapsuleMinSkyAngle * PI / 180.0f);
PackedLightDirection = FVector4f(FVector3f(Allocation->CurrentSkyBentNormal), ConeAngle);
}
else if (SkyLight
&& !SkyLight->bHasStaticLighting
&& !SkyLight->bWantsStaticShadowing
&& View.Family->EngineShowFlags.SkyLighting)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CapsuleShadowRendering.cpp:929
Scope (from outer to inner):
file
function static IndirectCapsuleShadowsResources CreateIndirectCapsuleShadowsResources
Source code excerpt:
PassParameters->CapsuleIndirectConeAngle = GCapsuleIndirectConeAngle;
PassParameters->CapsuleSkyAngleScale = GCapsuleSkyAngleScale;
PassParameters->CapsuleMinSkyAngle = GCapsuleMinSkyAngle;
PassParameters->RWComputedLightDirectionData = ComputedLightDirectionUAV;
PassParameters->LightDirectionData = IndirectShadowLightDirectionSRV;
FComputeShaderUtils::AddPass(
GraphBuilder,
RDG_EVENT_NAME("LightDirectionFromVolumetricLightmap"),