r.SkyAtmosphere.FastSkyLUT

r.SkyAtmosphere.FastSkyLUT

#Overview

name: r.SkyAtmosphere.FastSkyLUT

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

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.SkyAtmosphere.FastSkyLUT is to enable a faster rendering method for the sky atmosphere using a look-up texture (LUT). This setting is part of Unreal Engine’s rendering system, specifically for the sky atmosphere rendering.

This setting variable is primarily used in the SkyAtmosphereRendering subsystem of Unreal Engine’s renderer module. It’s referenced in the SkyAtmosphereComponent, which suggests it’s also relevant to the Engine module.

The value of this variable is set through a console variable (CVarSkyAtmosphereFastSkyLUT) with a default value of 1 (enabled). It can be changed at runtime using console commands or through project settings.

This variable interacts closely with other sky atmosphere rendering settings, such as sample count scalars and aerial perspective settings. It’s associated with CVarSkyAtmosphereFastSkyLUT, which directly controls its behavior.

Developers should be aware that while enabling this setting (value > 0) results in faster rendering, it may introduce visual artifacts, especially in scenes with high-frequency details in the sky, such as earth shadows or scattering lobes.

Best practices for using this variable include:

  1. Enable it (default) for better performance in most scenarios.
  2. Disable it when high-quality, artifact-free sky rendering is crucial, especially in scenes with complex atmospheric effects.
  3. Test both enabled and disabled states to find the best balance between performance and visual quality for your specific project.

Regarding the associated variable CVarSkyAtmosphereFastSkyLUT:

The purpose of CVarSkyAtmosphereFastSkyLUT is to provide a console-accessible way to control the r.SkyAtmosphere.FastSkyLUT setting. It’s part of the rendering system’s configuration mechanism.

This console variable is used in the SkyAtmosphereRendering subsystem of the renderer module. It’s checked in various rendering functions to determine whether to use the fast sky LUT method.

The value is set when the engine initializes the console variables, with a default of 1 (enabled). It can be changed at runtime through console commands.

CVarSkyAtmosphereFastSkyLUT directly controls the behavior of r.SkyAtmosphere.FastSkyLUT. It’s also used in conjunction with other sky atmosphere rendering settings.

Developers should be aware that changes to this console variable will immediately affect the sky rendering method, potentially impacting both performance and visual quality.

Best practices for using this console variable include:

  1. Use it for quick testing and debugging of sky atmosphere rendering.
  2. Consider exposing it in debug menus for easier toggling during development.
  3. Document its effects and default value for the development team to ensure consistent use across the project.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseScalability.ini:629, section: [EffectsQuality@0]

Location: <Workspace>/Engine/Config/BaseScalability.ini:656, section: [EffectsQuality@1]

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

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

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

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:148, section: [EffectsQuality@0]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:161, section: [EffectsQuality@1]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:174, section: [EffectsQuality@2]

Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:187, section: [EffectsQuality@3]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:148, section: [EffectsQuality@0]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:161, section: [EffectsQuality@1]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:174, section: [EffectsQuality@2]

Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:187, section: [EffectsQuality@3]

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSkyAtmosphereFastSkyLUT(
	TEXT("r.SkyAtmosphere.FastSkyLUT"), 1,
	TEXT("When enabled, a look up texture is used to render the sky.\n")
	TEXT("It is faster but can result in visual artefacts if there are some high frequency details\n")
	TEXT("in the sky such as earth shadow or scattering lob."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<float> CVarSkyAtmosphereFastSkyLUTSampleCountMin(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Components/SkyAtmosphereComponent.h:77

Scope (from outer to inner):

file
class        class USkyAtmosphereComponent : public USceneComponent

Source code excerpt:

	/**
	 * Scale the atmosphere tracing sample count. Quality level scalability
	 * The sample count is still clamped according to scalability setting to 'r.SkyAtmosphere.SampleCountMax' when 'r.SkyAtmosphere.FastSkyLUT' is 0.
	 * The sample count is still clamped according to scalability setting to 'r.SkyAtmosphere.FastSkyLUT.SampleCountMax' when 'r.SkyAtmosphere.FastSkyLUT' is 1.
	 * The sample count is still clamped for aerial perspective according to  'r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice'.
	 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Atmosphere", AdvancedDisplay, meta = (UIMin = "0.25", UIMax = "8", ClampMin = "0.25", SliderExponent = 3.0))
	float TraceSampleCountScale;
	


	/** Rayleigh scattering coefficient scale.*/
	UPROPERTY(EditAnywhere, BlueprintReadOnly, interp, Category = "Atmosphere - Rayleigh", meta = (UIMin = 0.0, UIMax = 2.0, ClampMin = 0.0, SliderExponent = 4.0))
	float RayleighScatteringScale;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

////////////////////////////////////////////////////////////////////////// Fast sky

static TAutoConsoleVariable<int32> CVarSkyAtmosphereFastSkyLUT(
	TEXT("r.SkyAtmosphere.FastSkyLUT"), 1,
	TEXT("When enabled, a look up texture is used to render the sky.\n")
	TEXT("It is faster but can result in visual artefacts if there are some high frequency details\n")
	TEXT("in the sky such as earth shadow or scattering lob."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

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

Scope (from outer to inner):

file
function     void FSceneRenderer::RenderSkyAtmosphere

Source code excerpt:


	const FAtmosphereSetup& Atmosphere = SkyAtmosphereSceneProxy.GetAtmosphereSetup();
	SkyRC.bFastSky = CVarSkyAtmosphereFastSkyLUT.GetValueOnRenderThread() > 0;
	SkyRC.bFastAerialPerspective = CVarSkyAtmosphereAerialPerspectiveApplyOnOpaque.GetValueOnRenderThread() > 0;
	SkyRC.bFastAerialPerspectiveDepthTest = CVarSkyAtmosphereAerialPerspectiveDepthTest.GetValueOnRenderThread() > 0;
	SkyRC.bSecondAtmosphereLightEnabled = Scene->IsSecondAtmosphereLightEnabled();

	SkyAtmosphereLightShadowData LightShadowData;
	SkyRC.bShouldSampleOpaqueShadow = ShouldSkySampleAtmosphereLightsOpaqueShadow(*Scene, VisibleLightInfos, LightShadowData);

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

Scope (from outer to inner):

file
function     void FSceneRenderer::RenderSkyAtmosphere

Source code excerpt:


#if WITH_EDITOR
	if (CVarSkyAtmosphereFastSkyLUT.GetValueOnAnyThread() == 0 && CVarSkyAtmosphereAerialPerspectiveApplyOnOpaque.GetValueOnAnyThread() > 0)
	{
		for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
		{
			const FViewInfo& View = Views[ViewIndex];

			AddDrawCanvasPass(GraphBuilder, {}, View, FScreenPassRenderTarget(SceneTextures.Color.Target, View.ViewRect, ERenderTargetLoadAction::ELoad),