r.HeterogeneousVolumes.FrustumGrid.DepthSliceCount
r.HeterogeneousVolumes.FrustumGrid.DepthSliceCount
#Overview
name: r.HeterogeneousVolumes.FrustumGrid.DepthSliceCount
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The number of depth slices (Default = 512)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.FrustumGrid.DepthSliceCount is to control the number of depth slices in the frustum grid used for heterogeneous volume rendering in Unreal Engine 5. This setting is primarily related to the rendering system, specifically for handling volumetric effects.
This setting variable is used within the Renderer module of Unreal Engine, specifically in the HeterogeneousVolumes subsystem. It’s defined and used in the HeterogeneousVolumesVoxelGridPipeline.cpp file, which suggests it’s part of the voxel grid pipeline for heterogeneous volumes rendering.
The value of this variable is set as a console variable with a default value of 512. It can be changed at runtime through the console or configuration files.
This variable interacts directly with its associated variable CVarHeterogeneousVolumesFrustumGridDepthSliceCount. They share the same value and purpose.
Developers must be aware that this variable affects the granularity of depth sampling in the frustum grid. A higher value will result in more precise depth sampling but may increase memory usage and potentially impact performance.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your scene and the desired balance between quality and performance.
- Testing different values to find the optimal setting for your particular use case.
- Being mindful of potential performance impacts when increasing this value significantly.
Regarding the associated variable CVarHeterogeneousVolumesFrustumGridDepthSliceCount:
This is the actual console variable that stores and manages the depth slice count. It’s defined using TAutoConsoleVariable, which allows it to be changed at runtime. The variable is marked as render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed from the render thread.
The GetDepthSliceCountForFrustumGrid() function uses this variable to retrieve the current depth slice count, ensuring it’s at least 1. This function is likely called by other parts of the rendering system when they need to know the current depth slice count for the frustum grid.
When working with this variable, developers should:
- Use the GetDepthSliceCountForFrustumGrid() function to retrieve the value, as it ensures a valid minimum value.
- Be aware that changes to this variable will affect the rendering pipeline, so it should be modified with caution.
- Consider exposing this setting in user-facing graphics options if fine-tuning of volumetric effects is desired.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:45
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFrustumGridDepthSliceCount(
TEXT("r.HeterogeneousVolumes.FrustumGrid.DepthSliceCount"),
512,
TEXT("The number of depth slices (Default = 512)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFrustumGridMaxBottomLevelMemoryInMegabytes(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesFrustumGridDepthSliceCount
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:44
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFrustumGridDepthSliceCount(
TEXT("r.HeterogeneousVolumes.FrustumGrid.DepthSliceCount"),
512,
TEXT("The number of depth slices (Default = 512)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:307
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function int32 GetDepthSliceCountForFrustumGrid
Source code excerpt:
int32 GetDepthSliceCountForFrustumGrid()
{
return FMath::Max(CVarHeterogeneousVolumesFrustumGridDepthSliceCount.GetValueOnRenderThread(), 1);
}
int32 GetMaxBottomLevelMemoryInMegabytesForFrustumGrid()
{
return FMath::Max(CVarHeterogeneousVolumesFrustumGridMaxBottomLevelMemoryInMegabytes.GetValueOnRenderThread(), 1);
}