r.LumenScene.DirectLighting.CloudTransmittance
r.LumenScene.DirectLighting.CloudTransmittance
#Overview
name: r.LumenScene.DirectLighting.CloudTransmittance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to sample cloud shadows when avaible.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.DirectLighting.CloudTransmittance is to control whether cloud shadows are sampled when available in the Lumen Scene Direct Lighting system. This setting variable is part of the rendering system, specifically the Lumen global illumination system in Unreal Engine 5.
This setting variable is used in the Renderer module, particularly in the Lumen Scene Direct Lighting subsystem. It’s defined and used within the LumenSceneDirectLighting.cpp file, which suggests it’s closely tied to the Lumen rendering pipeline.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1, indicating that cloud shadow sampling is enabled by default.
The associated variable GLumenDirectLightingCloudTransmittance directly interacts with this console variable. It’s an integer variable that shares the same value as the console variable and is used in the actual rendering code.
Developers should be aware that this variable affects the quality and performance of the Lumen direct lighting system. Enabling cloud transmittance (by setting the value to 1) will result in more accurate lighting calculations that take into account cloud shadows, but it may also impact performance.
Best practices when using this variable include:
- Consider the performance impact when enabling cloud transmittance, especially on lower-end hardware.
- Use it in conjunction with other Lumen settings to achieve the desired balance between visual quality and performance.
- Test the impact of enabling/disabling this feature in various lighting scenarios to understand its visual importance in your specific game or application.
Regarding the associated variable GLumenDirectLightingCloudTransmittance:
The purpose of GLumenDirectLightingCloudTransmittance is to store and provide quick access to the cloud transmittance setting within the C++ code of the Lumen direct lighting system.
This variable is used directly in the rendering code, specifically in the ComputeShadowMaskFromLightAttenuation function within the Lumen Scene Direct Lighting system. It determines whether the system should consider cloud transmittance when calculating shadow masks.
The value of this variable is set by the console variable system, mirroring the value of r.LumenScene.DirectLighting.CloudTransmittance.
This variable interacts closely with the Light struct in the rendering system, specifically with the bMayCastCloudTransmittance property of individual lights.
Developers should be aware that this variable directly affects the behavior of the shadow mask computation in the Lumen direct lighting system. When it’s set to 0, cloud transmittance calculations are skipped entirely.
Best practices for using this variable include:
- Avoid directly modifying this variable in code; instead, use the console variable to change its value.
- Consider the performance implications when enabling cloud transmittance, especially in scenes with complex lighting setups.
- Use it in conjunction with other Lumen and lighting settings to achieve the desired visual quality and performance balance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:45
Scope: file
Source code excerpt:
int32 GLumenDirectLightingCloudTransmittance = 1;
FAutoConsoleVariableRef CVarLumenDirectLightingCloudTransmittance(
TEXT("r.LumenScene.DirectLighting.CloudTransmittance"),
GLumenDirectLightingCloudTransmittance,
TEXT("Whether to sample cloud shadows when avaible."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarLumenDirectLightingMeshSDFShadowRayBias(
#Associated Variable and Callsites
This variable is associated with another variable named GLumenDirectLightingCloudTransmittance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:43
Scope: file
Source code excerpt:
);
int32 GLumenDirectLightingCloudTransmittance = 1;
FAutoConsoleVariableRef CVarLumenDirectLightingCloudTransmittance(
TEXT("r.LumenScene.DirectLighting.CloudTransmittance"),
GLumenDirectLightingCloudTransmittance,
TEXT("Whether to sample cloud shadows when avaible."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<float> CVarLumenDirectLightingMeshSDFShadowRayBias(
TEXT("r.LumenScene.DirectLighting.MeshSDF.ShadowRayBias"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLighting.cpp:1082
Scope (from outer to inner):
file
function static int32 ComputeShadowMaskFromLightAttenuation
Source code excerpt:
const FMaterialRenderProxy* LightFunctionMaterialProxy = Light.LightFunctionMaterialProxy;
const bool bMayUseCloudTransmittance = GLumenDirectLightingCloudTransmittance != 0 && Light.bMayCastCloudTransmittance;
const uint32 DispatchIndirectArgOffset = (Light.LightIndex * NumViews + ViewIndex) * sizeof(FRHIDispatchIndirectParameters);
if (LightFunctionMaterialProxy)
{
FLumenDirectLightingShadowMaskFromLightAttenuationWithLightFunctionCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FLumenDirectLightingShadowMaskFromLightAttenuationWithLightFunctionCS::FParameters>();
SetCommonParameters(PassParameters->Common);