r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice
r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice
#Overview
name: r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice
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).
- type:
Var
- help:
The sample count used per slice to evaluate aerial perspective. The effective sample count is usually lower and depends on SampleCountScale on the component as well as .ini files.\nscattering and transmittance in camera frustum space froxel.\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice is to control the maximum sample count used per slice when evaluating aerial perspective in the Sky Atmosphere rendering system of Unreal Engine 5.
This setting variable is primarily used by the rendering system, specifically the Sky Atmosphere rendering module. It’s part of the atmospheric rendering features that create realistic sky and atmospheric effects in Unreal Engine.
The value of this variable is set as a console variable (CVar) in the engine’s C++ code. It’s initialized with a default value of 2.0f, but can be adjusted at runtime through console commands or configuration files.
This variable interacts closely with the SampleCountScale property of the SkyAtmosphereComponent. The effective sample count used for aerial perspective calculation is determined by considering both this CVar and the component’s SampleCountScale.
Developers should be aware that this variable acts as an upper limit for the sample count. The actual sample count used may be lower, depending on other factors like the SampleCountScale and settings in .ini files.
Best practices when using this variable include:
- Adjusting it carefully to balance between visual quality and performance.
- Considering its interaction with the SkyAtmosphereComponent’s SampleCountScale.
- Being aware that higher values will increase rendering quality but also increase computational cost.
Regarding the associated variable CVarSkyAtmosphereAerialPerspectiveLUTSampleCountMaxPerSlice:
This is the actual console variable implementation of the setting. It shares the same value and purpose as r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice.
It’s used directly in the rendering code to clamp the sample count for aerial perspective calculations. For example, in the SetupSkyAtmosphereInternalCommonParameters function, it’s used to determine the CameraAerialPerspectiveSampleCountPerSlice parameter.
Developers should note that this CVar is marked with ECVF_RenderThreadSafe and ECVF_Scalability flags, indicating it’s safe to modify on the render thread and is considered a scalability setting that can affect performance.
When working with this variable, developers should consider its impact on both visual quality and performance, and adjust it in conjunction with other Sky Atmosphere settings for optimal results.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:627, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:654, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:681, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:708, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:736, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
8
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:146, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:159, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:172, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:185, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:146, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:159, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:172, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:185, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
1
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:126
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSkyAtmosphereAerialPerspectiveLUTSampleCountMaxPerSlice(
TEXT("r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice"), 2.0f,
TEXT("The sample count used per slice to evaluate aerial perspective. The effective sample count is usually lower and depends on SampleCountScale on the component as well as .ini files.\n")
TEXT("scattering and transmittance in camera frustum space froxel.\n"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereAerialPerspectiveLUTWidth(
TEXT("r.SkyAtmosphere.AerialPerspectiveLUT.Width"), 32,
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Components/SkyAtmosphereComponent.h:79
Scope (from outer to inner):
file
class class USkyAtmosphereComponent : public USceneComponent
Source code excerpt:
* 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;
/** The Rayleigh scattering coefficients resulting from molecules in the air at an altitude of 0 kilometer. */
#Associated Variable and Callsites
This variable is associated with another variable named CVarSkyAtmosphereAerialPerspectiveLUTSampleCountMaxPerSlice
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:125
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereAerialPerspectiveLUTSampleCountMaxPerSlice(
TEXT("r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice"), 2.0f,
TEXT("The sample count used per slice to evaluate aerial perspective. The effective sample count is usually lower and depends on SampleCountScale on the component as well as .ini files.\n")
TEXT("scattering and transmittance in camera frustum space froxel.\n"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereAerialPerspectiveLUTWidth(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:1258
Scope (from outer to inner):
file
function static void SetupSkyAtmosphereInternalCommonParameters
Source code excerpt:
InternalCommonParameters.CameraAerialPerspectiveVolumeDepthSliceLengthKm = CameraAerialPerspectiveVolumeDepthSliceLengthKm;
InternalCommonParameters.CameraAerialPerspectiveVolumeDepthSliceLengthKmInv = 1.0f / CameraAerialPerspectiveVolumeDepthSliceLengthKm;
InternalCommonParameters.CameraAerialPerspectiveSampleCountPerSlice = FMath::Max(AerialPerspectiveBaseSampleCountPerSlice, FMath::Min(2.0f * SkyInfo.GetSkyAtmosphereSceneProxy().GetTraceSampleCountScale(), float(CVarSkyAtmosphereAerialPerspectiveLUTSampleCountMaxPerSlice.GetValueOnRenderThread())));
InternalCommonParameters.TransmittanceSampleCount = CVarSkyAtmosphereTransmittanceLUTSampleCount.GetValueOnRenderThread();
InternalCommonParameters.MultiScatteringSampleCount = CVarSkyAtmosphereMultiScatteringLUTSampleCount.GetValueOnRenderThread();
const FSkyAtmosphereSceneProxy& SkyAtmosphereSceneProxy = SkyInfo.GetSkyAtmosphereSceneProxy();
InternalCommonParameters.SkyLuminanceFactor = FVector3f(SkyAtmosphereSceneProxy.GetSkyLuminanceFactor());