r.SkyAtmosphere.SampleCountMax
r.SkyAtmosphere.SampleCountMax
#Overview
name: r.SkyAtmosphere.SampleCountMax
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The maximum sample count used to compute sky/atmosphere scattering and transmittance The effective sample count is usually lower and depends on distance and SampleCountScale on the component, as well as .ini files.\nThe minimal value will be clamped to r.SkyAtmosphere.SampleCountMin + 1.\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkyAtmosphere.SampleCountMax is to control the maximum sample count used to compute sky and atmosphere scattering and transmittance in Unreal Engine 5’s rendering system.
This setting variable is primarily used by the rendering system, specifically for the sky atmosphere component. It is part of the SkyAtmosphere rendering module in Unreal Engine 5.
The value of this variable is set through a console variable (CVarSkyAtmosphereSampleCountMax) with a default value of 32.0f. It can be modified at runtime through console commands or through engine configuration files.
This variable interacts with several other variables:
- r.SkyAtmosphere.SampleCountMin: The minimum sample count, which affects the clamping of r.SkyAtmosphere.SampleCountMax.
- TraceSampleCountScale: A property of the SkyAtmosphereComponent that scales the sample count.
- r.SkyAtmosphere.FastSkyLUT and r.SkyAtmosphere.FastSkyLUT.SampleCountMax: These affect the clamping of the sample count when fast sky LUT is enabled.
- r.SkyAtmosphere.AerialPerspectiveLUT.SampleCountMaxPerSlice: This clamps the sample count for aerial perspective.
Developers should be aware that:
- The effective sample count is usually lower than the maximum and depends on distance and SampleCountScale on the component.
- The value is clamped to a minimum of r.SkyAtmosphere.SampleCountMin + 1.
- This setting affects rendering performance and quality, so it should be balanced accordingly.
Best practices when using this variable include:
- Adjust it based on the specific needs of your scene and target hardware.
- Use it in conjunction with other sky atmosphere settings for optimal results.
- Consider scalability settings in your project to automatically adjust this value based on hardware capabilities.
The associated variable CVarSkyAtmosphereSampleCountMax is the actual console variable that stores and manages the r.SkyAtmosphere.SampleCountMax value. It’s used internally by the engine to retrieve the current value of the setting. The same considerations and best practices apply to this variable as they do to r.SkyAtmosphere.SampleCountMax.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:633, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
16.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:660, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
32.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:687, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
64.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:714, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
128.0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:742, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
256.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:54
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarSkyAtmosphereSampleCountMax(
TEXT("r.SkyAtmosphere.SampleCountMax"), 32.0f,
TEXT("The maximum sample count used to compute sky/atmosphere scattering and transmittance The effective sample count is usually lower and depends on distance and SampleCountScale on the component, as well as .ini files.\n")
TEXT("The minimal value will be clamped to r.SkyAtmosphere.SampleCountMin + 1.\n"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereDistanceToSampleCountMax(
TEXT("r.SkyAtmosphere.DistanceToSampleCountMax"), 150.0f,
#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 CVarSkyAtmosphereSampleCountMax
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:53
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereSampleCountMax(
TEXT("r.SkyAtmosphere.SampleCountMax"), 32.0f,
TEXT("The maximum sample count used to compute sky/atmosphere scattering and transmittance The effective sample count is usually lower and depends on distance and SampleCountScale on the component, as well as .ini files.\n")
TEXT("The minimal value will be clamped to r.SkyAtmosphere.SampleCountMin + 1.\n"),
ECVF_RenderThreadSafe | ECVF_Scalability);
static TAutoConsoleVariable<float> CVarSkyAtmosphereDistanceToSampleCountMax(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:1247
Scope (from outer to inner):
file
function static void SetupSkyAtmosphereInternalCommonParameters
Source code excerpt:
InternalCommonParameters.SampleCountMin = CVarSkyAtmosphereSampleCountMin.GetValueOnRenderThread();
InternalCommonParameters.SampleCountMax = FMath::Min(SkyAtmosphereBaseSampleCount * SkyInfo.GetSkyAtmosphereSceneProxy().GetTraceSampleCountScale(), float(CVarSkyAtmosphereSampleCountMax.GetValueOnRenderThread()));
float DistanceToSampleCountMaxInv = CVarSkyAtmosphereDistanceToSampleCountMax.GetValueOnRenderThread();
InternalCommonParameters.FastSkySampleCountMin = CVarSkyAtmosphereFastSkyLUTSampleCountMin.GetValueOnRenderThread();
InternalCommonParameters.FastSkySampleCountMax = FMath::Min(SkyAtmosphereBaseSampleCount * SkyInfo.GetSkyAtmosphereSceneProxy().GetTraceSampleCountScale(), float(CVarSkyAtmosphereFastSkyLUTSampleCountMax.GetValueOnRenderThread()));
float FastSkyDistanceToSampleCountMaxInv = CVarSkyAtmosphereFastSkyLUTDistanceToSampleCountMax.GetValueOnRenderThread();