r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance
r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance
#Overview
name: r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Sets far-plane distance for the frustum grid (Default = -1.0)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance is to set the far-plane distance for the frustum grid in the heterogeneous volumes rendering system. This setting variable is primarily used in the rendering system, specifically for managing the voxel grid pipeline in heterogeneous volume rendering.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the HeterogeneousVolumes namespace within the rendering pipeline.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of -1.0 and can be modified at runtime.
This variable interacts with CVarHeterogeneousVolumesFrustumGridFarPlaneDistance, which is the associated console variable that shares the same value. It’s also used in conjunction with other variables related to the frustum grid, such as CVarHeterogeneousVolumesFrustumGridDepthSliceCount.
Developers must be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed and modified from the render thread without causing race conditions or other threading issues.
Best practices when using this variable include:
- Only modifying it when necessary, as it affects the rendering pipeline.
- Considering the performance implications of changing the far-plane distance.
- Testing thoroughly after modifications to ensure desired visual results and performance.
Regarding the associated variable CVarHeterogeneousVolumesFrustumGridFarPlaneDistance:
The purpose of CVarHeterogeneousVolumesFrustumGridFarPlaneDistance is to provide a programmatic interface to access and modify the far-plane distance for the frustum grid in the heterogeneous volumes rendering system.
This console variable is used within the Renderer module, specifically in the HeterogeneousVolumes namespace.
The value of this variable is set through the CVar system and can be accessed using the GetValueOnRenderThread() method.
It directly corresponds to the r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance setting and is used to retrieve the current value of the far-plane distance in the GetFarPlaneDistanceForFrustumGrid() function.
Developers should be aware that this variable is accessed on the render thread, which is important for maintaining thread safety in the rendering pipeline.
Best practices for using this variable include:
- Accessing it only from render thread-safe contexts.
- Using the GetValueOnRenderThread() method to retrieve its value.
- Considering caching the value if it’s accessed frequently to avoid potential performance overhead from repeated CVar lookups.
#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:38
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesFrustumGridFarPlaneDistance(
TEXT("r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance"),
-1.0,
TEXT("Sets far-plane distance for the frustum grid (Default = -1.0)\n"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFrustumGridDepthSliceCount(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesFrustumGridFarPlaneDistance
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:37
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesFrustumGridFarPlaneDistance(
TEXT("r.HeterogeneousVolumes.FrustumGrid.FarPlaneDistance"),
-1.0,
TEXT("Sets far-plane distance for the frustum grid (Default = -1.0)\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:302
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function float GetFarPlaneDistanceForFrustumGrid
Source code excerpt:
float GetFarPlaneDistanceForFrustumGrid()
{
return CVarHeterogeneousVolumesFrustumGridFarPlaneDistance.GetValueOnRenderThread();
}
int32 GetDepthSliceCountForFrustumGrid()
{
return FMath::Max(CVarHeterogeneousVolumesFrustumGridDepthSliceCount.GetValueOnRenderThread(), 1);
}