r.Lumen.TranslucencyVolume.GridDistributionZScale

r.Lumen.TranslucencyVolume.GridDistributionZScale

#Overview

name: r.Lumen.TranslucencyVolume.GridDistributionZScale

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.Lumen.TranslucencyVolume.GridDistributionZScale is to control the Z-axis scale distribution of the translucency volume grid in Unreal Engine 5’s Lumen global illumination system. This setting variable is specifically used in the rendering system, particularly for the Lumen translucency volume lighting calculations.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the Lumen translucency volume lighting component. This can be seen from the file path where the variable is defined: “Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp”.

The value of this variable is set using an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands. The default value is set to 4.0f.

This variable interacts with another variable named GTranslucencyGridDistributionZScale. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the Z-axis distribution of the translucency volume grid, which can impact the quality and performance of translucency lighting in scenes using Lumen. Changing this value may affect the visual fidelity and performance of translucent objects in the scene.

Best practices when using this variable include:

  1. Experimenting with different values to find the optimal balance between visual quality and performance for your specific scene.
  2. Considering the impact on performance when increasing the value, as it may lead to a higher number of grid cells along the Z-axis.
  3. Using it in conjunction with other Lumen translucency volume settings for fine-tuning the lighting quality.

Regarding the associated variable GTranslucencyGridDistributionZScale:

The purpose of GTranslucencyGridDistributionZScale is the same as r.Lumen.TranslucencyVolume.GridDistributionZScale, as they share the same value. It’s used internally in the C++ code to apply the Z-scale distribution to the translucency volume grid.

This variable is used in the Renderer module, specifically in the LumenTranslucencyVolumeLighting component. It’s directly used in calculations for determining the grid size and parameters along the Z-axis.

The value of GTranslucencyGridDistributionZScale is set by the console variable r.Lumen.TranslucencyVolume.GridDistributionZScale.

It interacts with other variables in the GetTranslucencyGridZParams function, such as GTranslucencyGridDistributionLogZScale and GTranslucencyGridDistributionLogZOffset, to calculate the grid size and parameters.

Developers should be aware that modifying GTranslucencyGridDistributionZScale directly in the code is not recommended, as its value is controlled by the console variable. Instead, they should use the console variable to adjust the value at runtime or in configuration files.

Best practices for using this variable include:

  1. Accessing it through the console variable r.Lumen.TranslucencyVolume.GridDistributionZScale rather than modifying it directly in the code.
  2. Consider its impact on the overall translucency volume lighting calculations when optimizing rendering performance.
  3. Use it in conjunction with other related variables to fine-tune the translucency volume grid distribution for optimal results.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:60

Scope: file

Source code excerpt:

float GTranslucencyGridDistributionZScale = 4.0f;
FAutoConsoleVariableRef CVarTranslucencyGridDistributionZScale(
	TEXT("r.Lumen.TranslucencyVolume.GridDistributionZScale"),
	GTranslucencyGridDistributionZScale,
	TEXT(""),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GTranslucencyGridEndDistanceFromCamera = 8000;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:58

Scope: file

Source code excerpt:

);

float GTranslucencyGridDistributionZScale = 4.0f;
FAutoConsoleVariableRef CVarTranslucencyGridDistributionZScale(
	TEXT("r.Lumen.TranslucencyVolume.GridDistributionZScale"),
	GTranslucencyGridDistributionZScale,
	TEXT(""),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GTranslucencyGridEndDistanceFromCamera = 8000;
FAutoConsoleVariableRef CVarTranslucencyGridEndDistanceFromCamera(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:392

Scope (from outer to inner):

file
function     void GetTranslucencyGridZParams

Source code excerpt:

void GetTranslucencyGridZParams(float NearPlane, float FarPlane, FVector& OutZParams, int32& OutGridSizeZ)
{
	OutGridSizeZ = FMath::TruncToInt(FMath::Log2((FarPlane - NearPlane) * GTranslucencyGridDistributionLogZScale) * GTranslucencyGridDistributionZScale) + 1;
	OutZParams = FVector(GTranslucencyGridDistributionLogZScale, GTranslucencyGridDistributionLogZOffset, GTranslucencyGridDistributionZScale);
}

FVector TranslucencyVolumeTemporalRandom(uint32 FrameNumber)
{
	// Center of the voxel
	FVector RandomOffsetValue(.5f, .5f, .5f);