r.VolumetricFog.VoxelizationShowOnlyPassIndex
r.VolumetricFog.VoxelizationShowOnlyPassIndex
#Overview
name: r.VolumetricFog.VoxelizationShowOnlyPassIndex
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When >= 0, indicates a single voxelization pass to render for debugging.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog.VoxelizationShowOnlyPassIndex is to provide a debugging tool for the volumetric fog voxelization process in Unreal Engine’s rendering system. It allows developers to isolate and render a single voxelization pass for inspection and troubleshooting.
This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the volumetric fog voxelization subsystem. Based on the callsites, it’s clear that this variable is utilized in the VolumetricFogVoxelization.cpp file, which is part of the core rendering functionality.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of -1 and can be modified at runtime using console commands or through engine configuration files.
The associated variable GVolumetricFogVoxelizationShowOnlyPassIndex directly interacts with r.VolumetricFog.VoxelizationShowOnlyPassIndex. They share the same value, with GVolumetricFogVoxelizationShowOnlyPassIndex being the actual integer variable used in the C++ code, while r.VolumetricFog.VoxelizationShowOnlyPassIndex is the console variable name used for external access and configuration.
Developers must be aware that this variable is intended for debugging purposes only. When set to a value greater than or equal to 0, it will cause the engine to render only a single voxelization pass, which may significantly impact the visual quality and performance of the volumetric fog in the scene.
Best practices when using this variable include:
- Only enable it when actively debugging volumetric fog issues.
- Reset it to -1 when finished debugging to ensure normal rendering behavior.
- Use in conjunction with other debugging tools and visualizations for comprehensive analysis.
- Be cautious when using in production builds, as it may impact performance and visual quality.
Regarding the associated variable GVolumetricFogVoxelizationShowOnlyPassIndex:
- Its purpose is to serve as the actual integer storage for the debug setting within the C++ code.
- It’s used directly in the rendering logic to determine which voxelization pass should be rendered.
- The value is set through the console variable system, mirroring r.VolumetricFog.VoxelizationShowOnlyPassIndex.
- It interacts with the rendering loop, specifically in the FVoxelizeVolumeMeshProcessor::Process function, to control which passes are executed.
- Developers should not modify this variable directly in code, but instead use the console variable system to ensure proper synchronization.
- Best practices include using this variable only for its intended debugging purpose and ensuring it’s reset to -1 when not actively debugging volumetric fog issues.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogVoxelization.cpp:28
Scope: file
Source code excerpt:
int32 GVolumetricFogVoxelizationShowOnlyPassIndex = -1;
FAutoConsoleVariableRef CVarVolumetricFogVoxelizationShowOnlyPassIndex(
TEXT("r.VolumetricFog.VoxelizationShowOnlyPassIndex"),
GVolumetricFogVoxelizationShowOnlyPassIndex,
TEXT("When >= 0, indicates a single voxelization pass to render for debugging."),
ECVF_RenderThreadSafe
);
static FORCEINLINE int32 GetVoxelizationSlicesPerPass(EShaderPlatform Platform)
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFogVoxelizationShowOnlyPassIndex
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogVoxelization.cpp:26
Scope: file
Source code excerpt:
);
int32 GVolumetricFogVoxelizationShowOnlyPassIndex = -1;
FAutoConsoleVariableRef CVarVolumetricFogVoxelizationShowOnlyPassIndex(
TEXT("r.VolumetricFog.VoxelizationShowOnlyPassIndex"),
GVolumetricFogVoxelizationShowOnlyPassIndex,
TEXT("When >= 0, indicates a single voxelization pass to render for debugging."),
ECVF_RenderThreadSafe
);
static FORCEINLINE int32 GetVoxelizationSlicesPerPass(EShaderPlatform Platform)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogVoxelization.cpp:538
Scope (from outer to inner):
file
function bool FVoxelizeVolumeMeshProcessor::Process
Source code excerpt:
for (int32 VoxelizationPassIndex = 0; VoxelizationPassIndex < NumVoxelizationPasses; VoxelizationPassIndex++)
{
if (GVolumetricFogVoxelizationShowOnlyPassIndex < 0 || GVolumetricFogVoxelizationShowOnlyPassIndex == VoxelizationPassIndex)
{
FVoxelizeVolumeShaderElementData ShaderElementData(VoxelizationPassIndex);
ShaderElementData.InitializeMeshMaterialData(ViewIfDynamicMeshCommand, PrimitiveSceneProxy, MeshBatch, -1, true);
BuildMeshDrawCommands(
MeshBatch,