r.SkyAtmosphere.LUT32

r.SkyAtmosphere.LUT32

#Overview

name: r.SkyAtmosphere.LUT32

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

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.LUT32 is to control the precision of Look-Up Tables (LUTs) used in the sky atmosphere rendering system of Unreal Engine 5. It determines whether to use full 32-bit per-channel precision for all sky LUTs.

This setting variable is primarily used in the rendering system, specifically for the sky atmosphere rendering subsystem. Based on the callsites, it’s clear that this variable is utilized in the SkyAtmosphereRendering module of the engine.

The value of this variable is set through a console variable (CVarSkyAtmosphereLUT32) which is initialized with a default value of 0. This means that by default, the engine does not use 32-bit precision for sky LUTs.

The associated variable CVarSkyAtmosphereLUT32 directly interacts with r.SkyAtmosphere.LUT32. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to 1) will increase the precision of sky LUTs, which could potentially improve visual quality but at the cost of increased memory usage and potentially decreased performance. This is because 32-bit precision requires more memory and computational resources compared to lower precision formats.

Best practices when using this variable include:

  1. Only enable it when higher precision is necessary for your specific use case.
  2. Test the performance impact when enabling this option, especially on lower-end hardware.
  3. Consider using it selectively, perhaps only in certain high-fidelity areas of your game or for specific visual effects where the increased precision is most noticeable.

Regarding the associated variable CVarSkyAtmosphereLUT32:

The purpose of CVarSkyAtmosphereLUT32 is identical to r.SkyAtmosphere.LUT32. It’s the actual console variable that controls the setting.

This variable is used in the SkyAtmosphereRendering module of the Unreal Engine. It directly affects the pixel format used for sky LUTs and aerial perspective volumes.

The value is set when the engine initializes the console variables, with a default value of 0.

CVarSkyAtmosphereLUT32 interacts with various texture creation and rendering processes in the sky atmosphere system. When enabled, it changes the pixel format of certain textures from PF_FloatRGBA to PF_A32B32G32R32F.

Developers should be aware that this variable has a direct impact on memory usage and potentially on rendering performance. It’s marked with ECVF_RenderThreadSafe and ECVF_Scalability flags, indicating it’s safe to change at runtime and is considered a scalability option.

Best practices include carefully considering the trade-off between visual quality and performance when deciding to enable this option, and potentially exposing it as a high-end graphics option in the game’s settings menu for users with powerful hardware.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:1011, section: [Android_PowerVR_G6xxx DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:1016, section: [Android_PowerVR_GT7xxx DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:1021, section: [Android_PowerVR_GE8xxx DeviceProfile]

Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:1026, section: [Android_PowerVR_GM9xxx DeviceProfile]

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSkyAtmosphereLUT32(
	TEXT("r.SkyAtmosphere.LUT32"), 0,
	TEXT("Use full 32bit per-channel precision for all sky LUTs.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarSkyAtmosphereEditorNotifications(
	TEXT("r.SkyAtmosphere.EditorNotifications"), 1,
	TEXT("Enable the rendering of in editor notification to warn the user about missing sky dome pixels on screen. It is better to keep it enabled and will be removed when shipping.\n"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

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

static TAutoConsoleVariable<int32> CVarSkyAtmosphereLUT32(
	TEXT("r.SkyAtmosphere.LUT32"), 0,
	TEXT("Use full 32bit per-channel precision for all sky LUTs.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarSkyAtmosphereEditorNotifications(
	TEXT("r.SkyAtmosphere.EditorNotifications"), 1,

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

Scope (from outer to inner):

file
function     void InitSkyAtmosphereForView

Source code excerpt:

		EPixelFormat TextureLUTFormat = GetSkyLutTextureFormat(Scene->GetFeatureLevel());
		EPixelFormat TextureLUTSmallFormat = GetSkyLutSmallTextureFormat();
		EPixelFormat TextureAerialLUTFormat = (CVarSkyAtmosphereLUT32.GetValueOnAnyThread() != 0) ? PF_A32B32G32R32F : PF_FloatRGBA;

		//
		// Initialise view resources.
		//
		
		FPooledRenderTargetDesc SkyAtmosphereViewLutTextureDesc = FPooledRenderTargetDesc::Create2DDesc(

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

Scope (from outer to inner):

file
function     void FSceneRenderer::RenderSkyAtmosphereLookUpTables

Source code excerpt:

		{
			FIntVector CameraAPLutSize = View.SkyAtmosphereCameraAerialPerspectiveVolume->GetDesc().GetSize();
			EPixelFormat TextureAerialLUTFormat = (CVarSkyAtmosphereLUT32.GetValueOnAnyThread() != 0) ? PF_A32B32G32R32F : PF_FloatRGBA;
			FRDGTextureRef RealTimeReflectionCaptureCamera360APLutTexture = GraphBuilder.CreateTexture(
				FRDGTextureDesc::Create3D(CameraAPLutSize, TextureAerialLUTFormat, FClearValueBinding::None, 
					TexCreate_ShaderResource | TexCreate_UAV), TEXT("SkyAtmosphere.RealTimeSkyCapCamera360APLut"));
			FRDGTextureUAVRef RealTimeReflectionCaptureSkyAtmosphereViewLutTextureUAV = GraphBuilder.CreateUAV(FRDGTextureUAVDesc(RealTimeReflectionCaptureCamera360APLutTexture, 0));

			FRenderCameraAerialPerspectiveVolumeCS::FPermutationDomain PermutationVector;