r.VolumetricCloud.EmptySpaceSkipping
r.VolumetricCloud.EmptySpaceSkipping
#Overview
name: r.VolumetricCloud.EmptySpaceSkipping
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enable/disable empty space skipping to accelerate cloud tracing through emty areas. EXPERIMENTAL
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricCloud.EmptySpaceSkipping is to enable or disable empty space skipping in volumetric cloud rendering. This setting is part of the rendering system, specifically for optimizing the performance of volumetric cloud rendering.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically within the volumetric cloud rendering subsystem. It’s defined and used in the VolumetricCloudRendering.cpp file.
The value of this variable is set through a console variable (CVarVolumetricCloudEmptySpaceSkipping) with a default value of 0 (disabled). Users can change this value at runtime using console commands or through engine configuration files.
This variable interacts with several other variables and systems:
- It’s used in conjunction with CVarVolumetricCloudDisableCompute and RHIIsTypedUAVLoadSupported to determine if compute-based cloud empty space skipping should be used.
- It’s associated with CVarVolumetricCloudEmptySpaceSkippingVolumeDepth, which sets the distance over which empty space can be evaluated.
Developers should be aware that:
- This feature is marked as EXPERIMENTAL, indicating it may not be fully stable or optimized.
- It’s a render thread safe and scalability setting, meaning it can be adjusted dynamically and may impact performance across different hardware configurations.
- The empty space skipping is designed to accelerate cloud tracing through empty areas, potentially improving performance.
Best practices when using this variable include:
- Testing thoroughly on various hardware configurations to ensure it provides a performance benefit without visual artifacts.
- Using it in conjunction with CVarVolumetricCloudEmptySpaceSkippingVolumeDepth to fine-tune the optimization.
- Being cautious about enabling it in production builds until it’s no longer marked as EXPERIMENTAL.
Regarding the associated variable CVarVolumetricCloudEmptySpaceSkipping:
The purpose of CVarVolumetricCloudEmptySpaceSkipping is to provide a programmatic way to control the r.VolumetricCloud.EmptySpaceSkipping setting within the engine’s C++ code. It’s an instance of TAutoConsoleVariable
This variable is used in the Renderer module, specifically in the VolumetricCloudRendering.cpp file. Its value is typically set through engine configuration or console commands, but can also be accessed and modified in C++ code.
The value of this variable is checked in the ShouldUseComputeCloudEmptySpaceSkipping function to determine if compute-based empty space skipping should be used for volumetric clouds.
Developers should be aware that:
- Changes to this variable will affect rendering performance and potentially visual quality.
- It’s a render thread safe variable, meaning it can be safely accessed from the render thread.
Best practices for using this variable include:
- Using GetValueOnRenderThread() when accessing its value from render thread code.
- Consider exposing this setting to users or designers if fine-tuning of volumetric cloud performance is needed.
- Monitor performance impacts when modifying this value, especially on lower-end hardware.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:207
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVolumetricCloudEmptySpaceSkipping(
TEXT("r.VolumetricCloud.EmptySpaceSkipping"), 0,
TEXT("Enable/disable empty space skipping to accelerate cloud tracing through emty areas. EXPERIMENTAL"),
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."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarVolumetricCloudEmptySpaceSkipping
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:206
Scope: file
Source code excerpt:
//////////////////////////////////////////////////////////////////////////
static TAutoConsoleVariable<int32> CVarVolumetricCloudEmptySpaceSkipping(
TEXT("r.VolumetricCloud.EmptySpaceSkipping"), 0,
TEXT("Enable/disable empty space skipping to accelerate cloud tracing through emty areas. EXPERIMENTAL"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarVolumetricCloudEmptySpaceSkippingVolumeDepth(
TEXT("r.VolumetricCloud.EmptySpaceSkipping.VolumeDepth"), 40.0f,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:245
Scope (from outer to inner):
file
function static bool ShouldUseComputeCloudEmptySpaceSkipping
Source code excerpt:
static bool ShouldUseComputeCloudEmptySpaceSkipping()
{
return !CVarVolumetricCloudDisableCompute.GetValueOnRenderThread() && RHIIsTypedUAVLoadSupported(PF_R16F) && CVarVolumetricCloudEmptySpaceSkipping.GetValueOnRenderThread() > 0;
}
bool ShouldRenderVolumetricCloud(const FScene* Scene, const FEngineShowFlags& EngineShowFlags)
{
if (Scene && Scene->HasVolumetricCloud() && EngineShowFlags.Atmosphere && EngineShowFlags.Cloud)
{