r.SkyAtmosphere.DistantSkyLightLUT.Altitude

r.SkyAtmosphere.DistantSkyLightLUT.Altitude

#Overview

name: r.SkyAtmosphere.DistantSkyLightLUT.Altitude

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.SkyAtmosphere.DistantSkyLightLUT.Altitude is to control the altitude at which sky samples are taken to integrate the sky lighting in Unreal Engine’s sky atmosphere rendering system.

This setting variable is primarily used by the rendering system, specifically the sky atmosphere rendering module. Based on the callsites, it’s clear that this variable is utilized in the SkyAtmosphereRendering.cpp file, which is part of the Renderer module in Unreal Engine.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 6.0f, representing 6 kilometers, which is typically the altitude of cirrus clouds.

The associated variable CVarSkyAtmosphereDistantSkyLightLUTAltitude interacts directly with r.SkyAtmosphere.DistantSkyLightLUT.Altitude. They share the same value and purpose.

Developers should be aware that this variable affects the rendering of the sky atmosphere, particularly the integration of sky lighting. Changing this value will alter the appearance of the sky and potentially the overall lighting in the scene.

Best practices when using this variable include:

  1. Understanding that the default value (6km) is chosen to represent typical cirrus cloud altitude, which often provides a good balance for sky lighting.
  2. Adjusting the value carefully and in small increments to achieve desired visual results.
  3. Being mindful that extreme values may lead to unrealistic sky lighting.
  4. Testing any changes across different times of day and weather conditions in your game to ensure consistent quality.

Regarding the associated variable CVarSkyAtmosphereDistantSkyLightLUTAltitude:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarSkyAtmosphereDistantSkyLightLUTAltitude(
	TEXT("r.SkyAtmosphere.DistantSkyLightLUT.Altitude"), 6.0f,
	TEXT("The altitude at which the sky samples are taken to integrate the sky lighting. Default to 6km, typicaly cirrus clouds altitude.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability);

////////////////////////////////////////////////////////////////////////// Debug / Visualization

static TAutoConsoleVariable<int32> CVarSkyAtmosphereLUT32(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarSkyAtmosphereDistantSkyLightLUTAltitude(
	TEXT("r.SkyAtmosphere.DistantSkyLightLUT.Altitude"), 6.0f,
	TEXT("The altitude at which the sky samples are taken to integrate the sky lighting. Default to 6km, typicaly cirrus clouds altitude.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability);

////////////////////////////////////////////////////////////////////////// Debug / Visualization

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

Scope (from outer to inner):

file
function     void FSceneRenderer::RenderSkyAtmosphereLookUpTables

Source code excerpt:

			PassParameters->AtmosphereLightIlluminanceOuterSpace1 = FLinearColor::Black;
		}
		PassParameters->DistantSkyLightSampleAltitude = CVarSkyAtmosphereDistantSkyLightLUTAltitude.GetValueOnAnyThread();

		FIntVector TextureSize = FIntVector(1, 1, 1);
		const FIntVector NumGroups = FIntVector::DivideAndRoundUp(TextureSize, FRenderDistantSkyLightLutCS::GroupSize);
		FComputeShaderUtils::AddPass(GraphBuilder, RDG_EVENT_NAME("DistantSkyLightLut"), PassFlag, ComputeShader, PassParameters, NumGroups);

		PendingRDGResources.DistantSkyLightLut = DistantSkyLightLut;