r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth
r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth
#Overview
name: r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set the distance in kilometer over which empty space can be evalauted.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth is to control the distance over which empty space can be evaluated in the volumetric cloud rendering system. This setting is part of the rendering system, specifically for optimizing the rendering of volumetric clouds.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically in the volumetric cloud rendering subsystem. It’s defined and used within 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 40.0f, representing 40 kilometers. Users can modify this value at runtime using console commands or through engine configuration files.
The associated variable CVarVolumetricCloudEmptySpaceSkippingVolumeDepth directly interacts with r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth. They share the same value and purpose.
Developers must be aware that this variable is measured in kilometers and affects the performance and visual quality of volumetric cloud rendering. Increasing this value allows for evaluating empty space over a larger distance, potentially improving performance by skipping more empty space during rendering. However, setting it too high might lead to artifacts or missed cloud details.
Best practices when using this variable include:
- Adjusting it based on the scale of your scene and the typical viewing distances.
- Balancing it with other volumetric cloud settings for optimal performance and visual quality.
- Testing different values to find the best trade-off between performance and visual fidelity for your specific use case.
Regarding the associated variable CVarVolumetricCloudEmptySpaceSkippingVolumeDepth:
This is the actual CVar that stores and manages the value of r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth. It’s used in the GetEmptySpaceSkippingVolumeDepth() function to retrieve the current value, which is then converted from kilometers to centimeters for internal use in the engine.
The value can be accessed on the render thread using the GetValueOnRenderThread() method, ensuring thread-safe access to the variable. This is crucial for maintaining consistency in multi-threaded rendering scenarios.
Developers should note that changes to this CVar will take effect in real-time, allowing for dynamic adjustments to the volumetric cloud rendering system. However, frequent changes might impact performance, so it’s generally best to set it once and adjust only when necessary.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:212
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarVolumetricCloudEmptySpaceSkippingVolumeDepth(
TEXT("r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth"), 40.0f,
TEXT("Set the distance in kilometer over which empty space can be evalauted."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarVolumetricCloudEmptySpaceSkippingStartTracingSliceBias(
TEXT("r.VolumetricCloud.EmptySpaceSkipping.StartTracingSliceBias"), 0.0f,
TEXT("The number of slices to bias the start depth with. A valuie of -1 means a bias of one slice towards the view point."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarVolumetricCloudEmptySpaceSkippingVolumeDepth
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:211
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarVolumetricCloudEmptySpaceSkippingVolumeDepth(
TEXT("r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth"), 40.0f,
TEXT("Set the distance in kilometer over which empty space can be evalauted."),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarVolumetricCloudEmptySpaceSkippingStartTracingSliceBias(
TEXT("r.VolumetricCloud.EmptySpaceSkipping.StartTracingSliceBias"), 0.0f,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:971
Scope (from outer to inner):
file
function static float GetEmptySpaceSkippingVolumeDepth
Source code excerpt:
{
const float KilometersToCentimeters = 100000.0f;
return FMath::Max(1.0f, CVarVolumetricCloudEmptySpaceSkippingVolumeDepth.GetValueOnRenderThread()) * KilometersToCentimeters;
}
static float GetEmptySpaceSkippingSliceDepth()
{
const float KilometersToCentimeters = 100000.0f;
float EmptySpaceSkippingVolumeDepth = GetEmptySpaceSkippingVolumeDepth();