r.VolumetricFog.TemporalReprojection

r.VolumetricFog.TemporalReprojection

#Overview

name: r.VolumetricFog.TemporalReprojection

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VolumetricFog.TemporalReprojection is to control whether temporal reprojection is used on volumetric fog in Unreal Engine’s rendering system. This setting variable is part of the volumetric fog rendering subsystem within the Renderer module.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the volumetric fog rendering component. It’s used in the VolumetricFog.cpp file, which is responsible for handling volumetric fog calculations and rendering.

The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands or through engine configuration files.

This variable interacts with another variable named GVolumetricFogTemporalReprojection. They share the same value and are used interchangeably in the code. Additionally, it interacts with GVolumetricFogJitter in determining the random offset for temporal reprojection.

Developers must be aware that this variable affects the quality and performance of volumetric fog rendering. Enabling temporal reprojection can improve the visual quality of volumetric fog by reducing noise and flickering, but it may also have a performance impact.

Best practices when using this variable include:

  1. Consider the target platform’s performance capabilities when enabling or disabling this feature.
  2. Test the visual quality and performance impact in various scenarios to find the optimal setting for your game.
  3. Be aware that changing this setting may require adjustments to other fog-related parameters to maintain the desired visual appearance.

Regarding the associated variable GVolumetricFogTemporalReprojection:

The purpose of GVolumetricFogTemporalReprojection is to serve as the internal representation of the r.VolumetricFog.TemporalReprojection console variable within the engine’s C++ code.

This variable is used directly in the Renderer module, specifically in the volumetric fog rendering logic. It’s referenced in functions like VolumetricFogTemporalRandom and ComputeVolumetricFog.

The value of GVolumetricFogTemporalReprojection is set by the console variable system when r.VolumetricFog.TemporalReprojection is modified.

It interacts with GVolumetricFogJitter to determine whether to apply temporal random offsets to the volumetric fog calculations.

Developers should be aware that this variable is the actual flag checked in the rendering code, so any runtime changes to r.VolumetricFog.TemporalReprojection will be reflected in this variable.

Best practices for using GVolumetricFogTemporalReprojection include:

  1. Avoid directly modifying this variable in code; instead, use the console variable system to ensure consistency.
  2. When adding new volumetric fog features, check this variable to determine if temporal reprojection should be applied.
  3. Consider the performance implications of enabling or disabling this feature in performance-critical sections of the rendering pipeline.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:73

Scope: file

Source code excerpt:

int32 GVolumetricFogTemporalReprojection = 1;
FAutoConsoleVariableRef CVarVolumetricFogTemporalReprojection(
	TEXT("r.VolumetricFog.TemporalReprojection"),
	GVolumetricFogTemporalReprojection,
	TEXT("Whether to use temporal reprojection on volumetric fog."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GVolumetricFogJitter = 1;

#Associated Variable and Callsites

This variable is associated with another variable named GVolumetricFogTemporalReprojection. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:71

Scope: file

Source code excerpt:

	);

int32 GVolumetricFogTemporalReprojection = 1;
FAutoConsoleVariableRef CVarVolumetricFogTemporalReprojection(
	TEXT("r.VolumetricFog.TemporalReprojection"),
	GVolumetricFogTemporalReprojection,
	TEXT("Whether to use temporal reprojection on volumetric fog."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GVolumetricFogJitter = 1;
FAutoConsoleVariableRef CVarVolumetricFogJitter(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:184

Scope (from outer to inner):

file
function     FVector3f VolumetricFogTemporalRandom

Source code excerpt:

	FVector3f RandomOffsetValue(.5f, .5f, .5f);

	if (GVolumetricFogJitter && GVolumetricFogTemporalReprojection)
	{
		RandomOffsetValue = FVector3f(Halton(FrameNumber & 1023, 2), Halton(FrameNumber & 1023, 3), Halton(FrameNumber & 1023, 5));
	}

	return RandomOffsetValue;
}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:1358

Scope (from outer to inner):

file
function     void FSceneRenderer::ComputeVolumetricFog

Source code excerpt:


		const bool bUseTemporalReprojection =
			GVolumetricFogTemporalReprojection
			&& View.ViewState
			&& !IsMobilePlatform(View.GetShaderPlatform());

		IntegrationData.bTemporalHistoryIsValid =
			bUseTemporalReprojection
			&& !View.bCameraCut