r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame
r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame
#Overview
name: r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Rebuilds volumetric acceleration structures every frame (default = 1)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame is to control the rebuilding of volumetric acceleration structures in the path tracing system of Unreal Engine 5. This setting variable is specifically related to the rendering system, particularly the path tracing feature for heterogeneous volumes.
This setting variable is utilized by the Renderer module of Unreal Engine, specifically within the path tracing subsystem. Based on the callsites, it’s clear that this variable is used in the PathTracing.cpp file, which is part of the core rendering implementation.
The value of this variable is set as a console variable using TAutoConsoleVariable, with a default value of 1. This means that by default, the volumetric acceleration structures are rebuilt every frame.
The associated variable CVarPathTracingHeterogeneousVolumesRebuildEveryFrame interacts directly with this setting. It’s used to retrieve the current value of the setting on the render thread.
Developers must be aware that this variable significantly impacts performance and rendering quality. Rebuilding volumetric acceleration structures every frame can be computationally expensive, but it ensures the most up-to-date representation of the scene’s volumetric elements.
Best practices when using this variable include:
- Consider performance implications when enabling it.
- Use it in conjunction with other path tracing settings for optimal results.
- Test thoroughly in various scenarios to ensure it doesn’t cause unexpected performance drops.
Regarding the associated variable CVarPathTracingHeterogeneousVolumesRebuildEveryFrame:
The purpose of CVarPathTracingHeterogeneousVolumesRebuildEveryFrame is to provide a programmatic way to access the value of the r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame setting within the C++ code.
This variable is used within the Renderer module, specifically in the path tracing implementation. It’s used to determine whether to force a rebuild of the volumetric acceleration structures each frame.
The value of this variable is set when the r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame console variable is set. It directly reflects the console variable’s value.
This variable interacts with the path tracing system, influencing the creation and updating of volume grids used in heterogeneous volume rendering.
Developers should be aware that this variable is accessed on the render thread, which is crucial for thread-safety in rendering operations.
Best practices for using this variable include:
- Only access it on the render thread to avoid threading issues.
- Use it in conjunction with other path tracing variables for a cohesive rendering strategy.
- Consider caching its value if used frequently to avoid repeated calls to GetValueOnRenderThread().
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:331
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPathTracingHeterogeneousVolumesRebuildEveryFrame(
TEXT("r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame"),
1,
TEXT("Rebuilds volumetric acceleration structures every frame (default = 1)\n"),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarPathTracingCameraMediumTracking(
#Associated Variable and Callsites
This variable is associated with another variable named CVarPathTracingHeterogeneousVolumesRebuildEveryFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:330
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarPathTracingHeterogeneousVolumesRebuildEveryFrame(
TEXT("r.PathTracing.HeterogeneousVolumes.RebuildEveryFrame"),
1,
TEXT("Rebuilds volumetric acceleration structures every frame (default = 1)\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PathTracing.cpp:2760
Scope: file
Source code excerpt:
{
RDG_EVENT_SCOPE(GraphBuilder, "Path Tracing Compute (%d x %d)", DispatchResX, DispatchResY);
bool bForceRebuild = CVarPathTracingHeterogeneousVolumesRebuildEveryFrame.GetValueOnRenderThread() != 0;
bCreateVolumeGrids = bForceRebuild ||
!PathTracingState->AdaptiveFrustumGridParameterCache.TopLevelGridBuffer ||
!PathTracingState->AdaptiveOrthoGridParameterCache.TopLevelGridBuffer;
if (bCreateVolumeGrids)
{
FVoxelGridBuildOptions BuildOptions;