r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max
r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max
#Overview
name: r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables building majorant grids to accelerate volume tracking (Default = 0)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max is to enable the building of majorant grids for accelerating volume tracking in the heterogeneous volumes rendering system of Unreal Engine 5.
This setting variable is primarily used in the Renderer module, specifically within the heterogeneous volumes subsystem. Based on the callsites, it’s part of the voxel grid pipeline for heterogeneous volumes rendering.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of 0, meaning the feature is disabled by default.
The associated variable CVarHeterogeneousVolumesEnableMajorantGridMax directly interacts with r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max. They share the same value and purpose.
Developers must be aware that:
- This variable is render thread safe, as indicated by the ECVF_RenderThreadSafe flag.
- Enabling this feature (by setting it to a non-zero value) may impact performance, as it involves additional computations for building majorant grids.
Best practices when using this variable include:
- Only enable it when necessary, as it may have performance implications.
- Test thoroughly with both enabled and disabled states to ensure it provides the desired acceleration without introducing visual artifacts.
- Consider exposing this setting in the game’s graphics options for advanced users, allowing them to fine-tune performance.
Regarding the associated variable CVarHeterogeneousVolumesEnableMajorantGridMax:
- Its purpose is identical to r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max.
- It’s used in the same Renderer module and heterogeneous volumes subsystem.
- Its value is set and retrieved using the CVar system, specifically with GetValueOnRenderThread() method.
- It directly controls whether the majorant grid building process is executed in the BuildMajorantVoxelGrid function.
- Developers should be aware that this variable’s value is checked on the render thread, which is crucial for thread-safe operations.
- Best practices include ensuring that any modifications to this variable are done in a thread-safe manner and considering its impact on rendering performance and quality.
#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:191
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableMajorantGridMax(
TEXT("r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max"),
0,
TEXT("Enables building majorant grids to accelerate volume tracking (Default = 0)\n"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowCameraDownsampleFactor(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesEnableMajorantGridMax
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:190
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableMajorantGridMax(
TEXT("r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max"),
0,
TEXT("Enables building majorant grids to accelerate volume tracking (Default = 0)\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:1220
Scope (from outer to inner):
file
function void BuildMajorantVoxelGrid
Source code excerpt:
}
bool bUseMax = CVarHeterogeneousVolumesEnableMajorantGridMax.GetValueOnRenderThread() != 0;
if (bUseMax)
{
// Downsample majorant grid
FIntVector InputDimensions = TopLevelGridResolution;
FRDGBufferRef InputBuffer = MajorantVoxelGridBuffer;