r.VolumetricFog.GridSizeZ

r.VolumetricFog.GridSizeZ

#Overview

name: r.VolumetricFog.GridSizeZ

The value of this variable can be defined or overridden in .ini config files. 3 .ini config files referencing this setting variable.

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.GridSizeZ is to control the number of Volumetric Fog cells used in the Z-axis (vertical direction) for rendering volumetric fog in Unreal Engine 5. This setting variable is part of the rendering system, specifically for the volumetric fog feature.

The Unreal Engine renderer subsystem relies on this setting variable, as evidenced by its location in the ‘VolumetricFog.cpp’ file within the Renderer module.

The value of this variable is set through the console variable system. It’s initialized with a default value of 64 and can be modified at runtime using console commands or through project settings.

This variable interacts directly with its associated variable GVolumetricFogGridSizeZ. They share the same value, with GVolumetricFogGridSizeZ being the actual integer variable used in the code, while r.VolumetricFog.GridSizeZ is the console variable name for user interaction.

Developers must be aware that this variable affects the quality and performance of volumetric fog rendering. A higher value will result in more detailed fog but at the cost of increased computational overhead.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of your scene and target hardware.
  2. Balancing it with other volumetric fog settings for optimal quality and performance.
  3. Testing different values to find the sweet spot between visual quality and performance for your specific use case.

Regarding the associated variable GVolumetricFogGridSizeZ:

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:188, section: [ShadowQuality@2]

Location: <Workspace>/Engine/Config/BaseScalability.ini:215, section: [ShadowQuality@3]

Location: <Workspace>/Engine/Config/BaseScalability.ini:242, section: [ShadowQuality@Cine]

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GVolumetricFogGridSizeZ = 64;
FAutoConsoleVariableRef CVarVolumetricFogGridSizeZ(
	TEXT("r.VolumetricFog.GridSizeZ"),
	GVolumetricFogGridSizeZ,
	TEXT("How many Volumetric Fog cells to use in z."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GVolumetricFogTemporalReprojection = 1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	);

int32 GVolumetricFogGridSizeZ = 64;
FAutoConsoleVariableRef CVarVolumetricFogGridSizeZ(
	TEXT("r.VolumetricFog.GridSizeZ"),
	GVolumetricFogGridSizeZ,
	TEXT("How many Volumetric Fog cells to use in z."),
	ECVF_Scalability | ECVF_RenderThreadSafe
	);

int32 GVolumetricFogTemporalReprojection = 1;
FAutoConsoleVariableRef CVarVolumetricFogTemporalReprojection(

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

Scope (from outer to inner):

file
function     static int32 GetVolumetricFogGridSizeZ

Source code excerpt:

static int32 GetVolumetricFogGridSizeZ()
{
	return FMath::Max(1, GVolumetricFogGridSizeZ);
}

static FIntPoint GetVolumetricFogTextureResourceRes(const FViewInfo& View)
{
	// Allocate texture using scene render targets size so we do not reallocate every frame when dynamic resolution is used in order to avoid resources allocation hitches.
	FIntPoint BufferSize = View.GetSceneTexturesConfig().Extent;