r.SkyAtmosphere.TransmittanceLUT

r.SkyAtmosphere.TransmittanceLUT

#Overview

name: r.SkyAtmosphere.TransmittanceLUT

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.SkyAtmosphere.TransmittanceLUT is to control the generation of the sky transmittance lookup table (LUT) in Unreal Engine’s sky atmosphere rendering system. This setting variable is part of the rendering subsystem, specifically the sky atmosphere rendering module.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the SkyAtmosphereRendering component. This can be seen from the file path where the variable is defined and used: ‘Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp’.

The value of this variable is set using a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with a default value of 1, meaning it’s enabled by default. Developers can change this value at runtime using console commands or through project settings.

This variable interacts with other related variables, such as CVarSkyAtmosphereTransmittanceLUTSampleCount, which controls the sample count used to evaluate transmittance. It also interacts with CVarSkyAtmosphereTransmittanceLUTUseSmallFormat, which determines the format of the transmittance LUT.

Developers must be aware that this variable has a significant impact on the sky rendering quality and performance. Disabling it (setting to 0) will prevent the generation of the sky transmittance LUT, which could result in lower quality sky rendering but potentially improved performance.

Best practices when using this variable include:

  1. Keep it enabled (1) for high-quality sky rendering.
  2. Consider disabling it for performance-critical scenarios or on lower-end hardware.
  3. When enabled, fine-tune the related variables like sample count for optimal quality-performance balance.

Regarding the associated variable CVarSkyAtmosphereTransmittanceLUT:

The purpose of CVarSkyAtmosphereTransmittanceLUT is identical to r.SkyAtmosphere.TransmittanceLUT, as they share the same value and functionality. It’s the internal representation of the console variable in the C++ code.

This variable is used in the Renderer module, specifically in the SkyAtmosphereRendering component. It’s checked in various functions related to sky atmosphere rendering, such as InitSkyAtmosphereForScene and RenderSkyAtmosphereLookUpTables.

The value is set when the TAutoConsoleVariable is initialized, but can be changed at runtime through console commands or engine settings.

It interacts with other variables in the sky atmosphere rendering system, particularly those related to the transmittance LUT generation and usage.

Developers should be aware that this variable directly controls whether the transmittance LUT is generated and used in the rendering pipeline. Changes to this variable will affect both visual quality and performance.

Best practices for using CVarSkyAtmosphereTransmittanceLUT align with those for r.SkyAtmosphere.TransmittanceLUT, as they are essentially the same variable represented in different contexts within the engine code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:147

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSkyAtmosphereTransmittanceLUT(
	TEXT("r.SkyAtmosphere.TransmittanceLUT"), 1,
	TEXT("Enable the generation of the sky transmittance.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarSkyAtmosphereTransmittanceLUTSampleCount(
	TEXT("r.SkyAtmosphere.TransmittanceLUT.SampleCount"), 10.0f,
	TEXT("The sample count used to evaluate transmittance."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:146

Scope: file

Source code excerpt:

////////////////////////////////////////////////////////////////////////// Transmittance LUT

static TAutoConsoleVariable<int32> CVarSkyAtmosphereTransmittanceLUT(
	TEXT("r.SkyAtmosphere.TransmittanceLUT"), 1,
	TEXT("Enable the generation of the sky transmittance.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarSkyAtmosphereTransmittanceLUTSampleCount(
	TEXT("r.SkyAtmosphere.TransmittanceLUT.SampleCount"), 10.0f,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:1142

Scope (from outer to inner):

file
function     void InitSkyAtmosphereForScene

Source code excerpt:

		// Initialise per scene/atmosphere resources
		//
		if (CVarSkyAtmosphereTransmittanceLUT.GetValueOnAnyThread() > 0)
		{
			const bool TranstmittanceLUTUseSmallFormat = CVarSkyAtmosphereTransmittanceLUTUseSmallFormat.GetValueOnRenderThread() > 0;

			TRefCountPtr<IPooledRenderTarget>& TransmittanceLutTexture = SkyInfo.GetTransmittanceLutTexture();
			Desc = FPooledRenderTargetDesc::Create2DDesc(
				FIntPoint(TransmittanceLutWidth, TransmittanceLutHeight),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:1330

Scope (from outer to inner):

file
function     void FSceneRenderer::RenderSkyAtmosphereLookUpTables

Source code excerpt:

	// Transmittance LUT
	FGlobalShaderMap* GlobalShaderMap = GetGlobalShaderMap(FeatureLevel);
	if (CVarSkyAtmosphereTransmittanceLUT.GetValueOnRenderThread() > 0)
	{
		TShaderMapRef<FRenderTransmittanceLutCS> ComputeShader(GlobalShaderMap);

		FRenderTransmittanceLutCS::FParameters * PassParameters = GraphBuilder.AllocParameters<FRenderTransmittanceLutCS::FParameters>();
		PassParameters->Atmosphere = Scene->GetSkyAtmosphereSceneInfo()->GetAtmosphereUniformBuffer();
		PassParameters->SkyAtmosphere = SkyInfo.GetInternalCommonParametersUniformBuffer();