r.SkyAtmosphere.FastSkyLUT.SampleCountMin
r.SkyAtmosphere.FastSkyLUT.SampleCountMin
#Overview
name: r.SkyAtmosphere.FastSkyLUT.SampleCountMin
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:
Fast sky minimum sample count used to compute sky/atmosphere scattering and transmittance.\nThe minimal value will be clamped to 1.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkyAtmosphere.FastSkyLUT.SampleCountMin is to set the minimum sample count used for computing sky and atmosphere scattering and transmittance in the fast sky rendering system of Unreal Engine 5’s Sky Atmosphere component.
This setting variable is primarily used by the rendering system, specifically the Sky Atmosphere rendering module. It’s part of the atmospheric rendering optimization that uses Look-Up Tables (LUTs) for faster computation of sky and atmosphere effects.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 4.0f. The value can be changed at runtime through console commands or programmatically.
This variable interacts closely with r.SkyAtmosphere.FastSkyLUT.SampleCountMax, which sets the maximum sample count. Together, these variables define the range of samples used in the fast sky LUT computation.
Developers should be aware that:
- The actual minimum value is clamped to 1, even if a lower value is set.
- This variable affects rendering performance and quality. A higher value may improve quality but at the cost of performance.
- It’s marked as render thread safe and scalable, meaning it can be adjusted based on different quality settings or hardware capabilities.
Best practices when using this variable include:
- Balancing between visual quality and performance based on target hardware.
- Using it in conjunction with r.SkyAtmosphere.FastSkyLUT.SampleCountMax for fine-tuning.
- Testing different values to find the optimal balance for your specific scene and target platforms.
Regarding the associated variable CVarSkyAtmosphereFastSkyLUTSampleCountMin:
This is the actual console variable object that stores and manages the r.SkyAtmosphere.FastSkyLUT.SampleCountMin setting. It’s used internally by the engine to access and modify the value. The purpose and usage are the same as described for r.SkyAtmosphere.FastSkyLUT.SampleCountMin.
The value of this variable is typically accessed using the GetValueOnRenderThread() method, as seen in the SetupSkyAtmosphereInternalCommonParameters function. This ensures thread-safe access to the value during rendering.
Developers should be aware that modifying this variable directly (rather than through the console command system) is generally not recommended unless you’re working on engine-level optimizations or extensions to the Sky Atmosphere system.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:630, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
2.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:657, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
4.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:684, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
4.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:711, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
4.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:739, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
4.0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:149, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:162, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:175, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:188, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:149, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:162, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:175, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
1.0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:188, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
1.0
- 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:79
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSkyAtmosphereFastSkyLUTSampleCountMin(
TEXT("r.SkyAtmosphere.FastSkyLUT.SampleCountMin"), 4.0f,
TEXT("Fast sky minimum sample count used to compute sky/atmosphere scattering and transmittance.\n")
TEXT("The minimal value will be clamped to 1.\n"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereFastSkyLUTSampleCountMax(
TEXT("r.SkyAtmosphere.FastSkyLUT.SampleCountMax"), 32.0f,
#Associated Variable and Callsites
This variable is associated with another variable named CVarSkyAtmosphereFastSkyLUTSampleCountMin
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:78
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereFastSkyLUTSampleCountMin(
TEXT("r.SkyAtmosphere.FastSkyLUT.SampleCountMin"), 4.0f,
TEXT("Fast sky minimum sample count used to compute sky/atmosphere scattering and transmittance.\n")
TEXT("The minimal value will be clamped to 1.\n"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereFastSkyLUTSampleCountMax(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:1250
Scope (from outer to inner):
file
function static void SetupSkyAtmosphereInternalCommonParameters
Source code excerpt:
float DistanceToSampleCountMaxInv = CVarSkyAtmosphereDistanceToSampleCountMax.GetValueOnRenderThread();
InternalCommonParameters.FastSkySampleCountMin = CVarSkyAtmosphereFastSkyLUTSampleCountMin.GetValueOnRenderThread();
InternalCommonParameters.FastSkySampleCountMax = FMath::Min(SkyAtmosphereBaseSampleCount * SkyInfo.GetSkyAtmosphereSceneProxy().GetTraceSampleCountScale(), float(CVarSkyAtmosphereFastSkyLUTSampleCountMax.GetValueOnRenderThread()));
float FastSkyDistanceToSampleCountMaxInv = CVarSkyAtmosphereFastSkyLUTDistanceToSampleCountMax.GetValueOnRenderThread();
InternalCommonParameters.CameraAerialPerspectiveVolumeDepthResolution = float(CameraAerialPerspectiveVolumeDepthResolution);
InternalCommonParameters.CameraAerialPerspectiveVolumeDepthResolutionInv = 1.0f / InternalCommonParameters.CameraAerialPerspectiveVolumeDepthResolution;
InternalCommonParameters.CameraAerialPerspectiveVolumeDepthSliceLengthKm = CameraAerialPerspectiveVolumeDepthSliceLengthKm;