r.VolumetricFog.VoxelizationShowOnlyPassIndex

r.VolumetricFog.VoxelizationShowOnlyPassIndex

#Overview

name: r.VolumetricFog.VoxelizationShowOnlyPassIndex

This variable is created as a Console Variable (cvar).

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:

  1. Only enable it when actively debugging volumetric fog issues.
  2. Reset it to -1 when finished debugging to ensure normal rendering behavior.
  3. Use in conjunction with other debugging tools and visualizations for comprehensive analysis.
  4. Be cautious when using in production builds, as it may impact performance and visual quality.

Regarding the associated variable GVolumetricFogVoxelizationShowOnlyPassIndex:

#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,