r.Lumen.TranslucencyVolume.GridDistributionLogZOffset

r.Lumen.TranslucencyVolume.GridDistributionLogZOffset

#Overview

name: r.Lumen.TranslucencyVolume.GridDistributionLogZOffset

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.GridDistributionLogZOffset is to control the offset of the logarithmic Z distribution for the translucency volume grid in Unreal Engine 5’s Lumen global illumination system. This setting is part of the rendering system, specifically the translucency volume lighting component of Lumen.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s implemented in the LumenTranslucencyVolumeLighting.cpp file, which is part of the Renderer module.

The value of this variable is set through the console variable system, as indicated by the FAutoConsoleVariableRef declaration. It can be modified at runtime using console commands or through project settings.

The associated variable GTranslucencyGridDistributionLogZOffset interacts directly with r.Lumen.TranslucencyVolume.GridDistributionLogZOffset. They share the same value, with GTranslucencyGridDistributionLogZOffset being the actual variable used in the code.

Developers should be aware that this variable affects the distribution of the translucency volume grid along the Z-axis. Modifying this value will change how the grid is spaced, potentially affecting the quality and performance of translucency lighting calculations.

Best practices when using this variable include:

  1. Only modify it if you understand its impact on the translucency volume lighting system.
  2. Test thoroughly after changes, as it can affect both visual quality and performance.
  3. Consider the interaction with other related variables, such as GTranslucencyGridDistributionZScale.

Regarding the associated variable GTranslucencyGridDistributionLogZOffset:

The purpose of GTranslucencyGridDistributionLogZOffset is to store the actual value used in the code for the logarithmic Z offset of the translucency grid distribution.

This variable is used directly in the Lumen translucency volume lighting calculations, specifically in the GetTranslucencyGridZParams function.

Its value is set by the console variable system and is directly linked to r.Lumen.TranslucencyVolume.GridDistributionLogZOffset.

GTranslucencyGridDistributionLogZOffset interacts with other variables like GTranslucencyGridDistributionLogZScale and GTranslucencyGridDistributionZScale to determine the Z parameters of the translucency grid.

Developers should be aware that this variable is used in performance-critical rendering code and should be modified cautiously.

Best practices for using GTranslucencyGridDistributionLogZOffset include:

  1. Treat it as read-only in most cases, as it’s managed by the console variable system.
  2. When debugging or profiling, monitor its value to understand how it affects the translucency volume calculations.
  3. If custom modifications are necessary, ensure they are done through the proper console variable interface rather than directly changing the variable.

#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:52

Scope: file

Source code excerpt:

float GTranslucencyGridDistributionLogZOffset = 1.0f;
FAutoConsoleVariableRef CVarTranslucencyGridDistributionLogZOffset(
	TEXT("r.Lumen.TranslucencyVolume.GridDistributionLogZOffset"),
	GTranslucencyGridDistributionLogZOffset,
	TEXT(""),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GTranslucencyGridDistributionZScale = 4.0f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GTranslucencyGridDistributionLogZOffset = 1.0f;
FAutoConsoleVariableRef CVarTranslucencyGridDistributionLogZOffset(
	TEXT("r.Lumen.TranslucencyVolume.GridDistributionLogZOffset"),
	GTranslucencyGridDistributionLogZOffset,
	TEXT(""),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GTranslucencyGridDistributionZScale = 4.0f;
FAutoConsoleVariableRef CVarTranslucencyGridDistributionZScale(

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

Scope (from outer to inner):

file
function     void GetTranslucencyGridZParams

Source code excerpt:

{
	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);