r.VolumetricCloud.LocalLights.ShadowSampleCount
r.VolumetricCloud.LocalLights.ShadowSampleCount
#Overview
name: r.VolumetricCloud.LocalLights.ShadowSampleCount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
[EXPERIMENTAL] Set the volumetric shadow sample count when evaluating local lights. Expenssive! Use for cinematics if needed.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricCloud.LocalLights.ShadowSampleCount is to control the number of shadow samples used when evaluating local lights in volumetric cloud rendering. This setting is part of the rendering system, specifically for volumetric cloud effects.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly in the volumetric cloud rendering subsystem. Based on the callsites, it’s implemented in the VolumetricCloudRendering.cpp file.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 12 and can be changed at runtime using console commands or through engine configuration files.
The associated variable CVarVolumetricCloudLocalLightsShadowSampleCount directly interacts with this setting. It’s used to retrieve the current value of the setting in the render thread.
Developers must be aware that this setting is marked as [EXPERIMENTAL] and is described as expensive. It’s recommended to use this setting judiciously, primarily for cinematics where higher quality is required.
Best practices when using this variable include:
- Use it sparingly due to its performance impact.
- Consider adjusting it only for high-quality renders or cinematics.
- Be aware of the valid range: the value is clamped between 0 and 128 in the code.
- Monitor performance impact when adjusting this value, especially in real-time scenarios.
Regarding the associated variable CVarVolumetricCloudLocalLightsShadowSampleCount:
The purpose of CVarVolumetricCloudLocalLightsShadowSampleCount is to provide a thread-safe way to access and modify the r.VolumetricCloud.LocalLights.ShadowSampleCount setting.
This variable is part of the auto console variable system in Unreal Engine, which allows for runtime configuration of engine parameters.
The value of this variable is set when the engine initializes the console variable system, but it can be modified at runtime through console commands or configuration files.
This variable directly interacts with the r.VolumetricCloud.LocalLights.ShadowSampleCount setting, effectively serving as its storage and access mechanism.
Developers should be aware that this variable is marked as render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed from the render thread.
Best practices for using this variable include:
- Use GetValueOnRenderThread() when accessing the value in render thread code.
- Be cautious about frequently changing this value, as it affects performance-sensitive rendering code.
- Consider caching the value if used frequently in performance-critical sections.
- Remember that changes to this value may not take effect immediately due to frame buffering in the rendering pipeline.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:200
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarVolumetricCloudLocalLightsShadowSampleCount(
TEXT("r.VolumetricCloud.LocalLights.ShadowSampleCount"), 12,
TEXT("[EXPERIMENTAL] Set the volumetric shadow sample count when evaluating local lights. Expenssive! Use for cinematics if needed."),
ECVF_RenderThreadSafe);
//////////////////////////////////////////////////////////////////////////
static TAutoConsoleVariable<int32> CVarVolumetricCloudEmptySpaceSkipping(
#Associated Variable and Callsites
This variable is associated with another variable named CVarVolumetricCloudLocalLightsShadowSampleCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:199
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarVolumetricCloudLocalLightsShadowSampleCount(
TEXT("r.VolumetricCloud.LocalLights.ShadowSampleCount"), 12,
TEXT("[EXPERIMENTAL] Set the volumetric shadow sample count when evaluating local lights. Expenssive! Use for cinematics if needed."),
ECVF_RenderThreadSafe);
//////////////////////////////////////////////////////////////////////////
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:661
Scope (from outer to inner):
file
function void SetupDefaultRenderVolumetricCloudGlobalParameters
Source code excerpt:
VolumetricCloudParams.ForwardLightData = *ViewInfo.ForwardLightingResources.ForwardLightData;
VolumetricCloudParams.LocalLightsShadowSampleCount = FMath::Clamp(CVarVolumetricCloudLocalLightsShadowSampleCount.GetValueOnRenderThread(), 0.0f, 128.0f);
ESceneTextureSetupMode SceneTextureSetupMode = ESceneTextureSetupMode::All;
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::SceneColor);
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::SceneVelocity);
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::GBuffers);
EnumRemoveFlags(SceneTextureSetupMode, ESceneTextureSetupMode::SSAO);