r.SupportSkyAtmosphere
r.SupportSkyAtmosphere
#Overview
name: r.SupportSkyAtmosphere
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables SkyAtmosphere rendering and shader code.
It is referenced in 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SupportSkyAtmosphere is to enable or disable SkyAtmosphere rendering and shader code in Unreal Engine 5. This setting variable is primarily used for the rendering system, specifically for atmospheric effects.
The Unreal Engine subsystems that rely on this setting variable are:
- Renderer: As seen in SkyAtmosphereRendering.cpp
- Shader Compiler: As evidenced in ShaderCompiler.cpp and ShaderGenerationUtil.cpp
- RenderCore: As shown in ReadOnlyCVARCache.cpp and Shader.cpp
The value of this variable is set as a console variable (CVar) with a default value of 1 (enabled). It can be modified through the console or project settings.
This variable interacts with other variables, notably:
- r.SupportSkyAtmosphereAffectsHeightFog: This variable depends on r.SupportSkyAtmosphere being true to function.
- PROJECT_SUPPORT_SKY_ATMOSPHERE: A shader define that is set based on the value of r.SupportSkyAtmosphere.
Developers must be aware that:
- This variable is marked as read-only and render thread safe, meaning it should not be changed frequently during runtime.
- Changing this variable may require a shader recompilation, as it affects shader generation.
- It impacts performance and visual quality, as it enables or disables an entire rendering feature.
Best practices when using this variable include:
- Set it early in the project development cycle to avoid unexpected shader recompilations.
- Consider the performance implications when enabling it, especially on lower-end hardware.
- Use it in conjunction with r.SupportSkyAtmosphereAffectsHeightFog for a more comprehensive atmospheric effect.
Regarding the associated variable CVarSupportSkyAtmosphere:
The purpose of CVarSupportSkyAtmosphere is to serve as the actual console variable object that controls the r.SupportSkyAtmosphere setting. It is used internally by the engine to query and set the value of r.SupportSkyAtmosphere.
This variable is primarily used in the RenderCore and Renderer subsystems. Its value is set when the engine initializes the console variables.
CVarSupportSkyAtmosphere interacts directly with r.SupportSkyAtmosphere, as they represent the same setting in different forms (one as a string identifier, the other as an actual variable object).
Developers should be aware that:
- This is the actual variable object that should be queried when checking the state of sky atmosphere support in C++ code.
- It’s initialized with the same default value and description as r.SupportSkyAtmosphere.
Best practices for using CVarSupportSkyAtmosphere include:
- Use IConsoleManager::Get().FindTConsoleVariableDataInt() to access this variable in C++ code when needed.
- Avoid directly modifying this variable; instead, use the r.SupportSkyAtmosphere console command or project settings to change its value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:33
Scope: file
Source code excerpt:
// The project setting (disable runtime and shader code)
static TAutoConsoleVariable<int32> CVarSupportSkyAtmosphere(
TEXT("r.SupportSkyAtmosphere"),
1,
TEXT("Enables SkyAtmosphere rendering and shader code."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
// The project setting for the sky atmosphere component to affect the height fog (disable runtime and shader code)
static TAutoConsoleVariable<int32> CVarSupportSkyAtmosphereAffectsHeightFog(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/RendererSettings.h:867
Scope: file
Source code excerpt:
/**
"The sky atmosphere component can light up the height fog but it requires extra samplers/textures to be bound to apply aerial perspective on transparent surfaces (and all surfaces on mobile via per vertex evaluation)."
"It requires r.SupportSkyAtmosphere to be true."
*/
UPROPERTY(config, EditAnywhere, Category = Optimizations, meta = (
ConsoleVariable = "r.SupportSkyAtmosphereAffectsHeightFog", DisplayName = "Support Sky Atmosphere Affecting Height Fog",
ToolTip = "The sky atmosphere component can light up the height fog but it requires extra samplers/textures to be bound to apply aerial perspective on transparent surfaces (and all surfaces on mobile via per vertex evaluation). It requires r.SupportSkyAtmosphere to be true.",
ConfigRestartRequired = true))
uint32 bSupportSkyAtmosphereAffectsHeightFog : 1;
/**
"Local fog volume components can will need to be applied on translucent, and opaque in forward, so resources will need to be bound to apply aerial perspective on transparent surfaces (and all surfaces on mobile via per vertex evaluation)."
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8456
Scope (from outer to inner):
file
function void GlobalBeginCompileShader
Source code excerpt:
bool bSupportSkyAtmosphere = false;
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportSkyAtmosphere"));
bSupportSkyAtmosphere = CVar && CVar->GetInt() != 0;
SET_SHADER_DEFINE(Input.Environment, PROJECT_SUPPORT_SKY_ATMOSPHERE, bSupportSkyAtmosphere ? 1 : 0);
}
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportCloudShadowOnForwardLitTranslucent"));
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderGenerationUtil.cpp:396
Scope (from outer to inner):
file
function static FShaderGlobalDefines FetchShaderGlobalDefines
Source code excerpt:
bool bSupportSkyAtmosphere = false;
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportSkyAtmosphere"));
bSupportSkyAtmosphere = CVar && CVar->GetInt() != 0;
Ret.PROJECT_SUPPORT_SKY_ATMOSPHERE = bSupportSkyAtmosphere ? 1 : 0;
}
{
static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportSkyAtmosphereAffectsHeightFog"));
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:68
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
const auto CVarVertexFoggingForOpaque = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VertexFoggingForOpaque"));
const auto CVarAllowStaticLighting = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AllowStaticLighting"));
const auto CVarSupportSkyAtmosphere = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportSkyAtmosphere"));
const auto CVarMobileHDR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MobileHDR"));
const auto CVarMobileAllowMovableDirectionalLights = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowMovableDirectionalLights"));
const auto CVarMobileEnableStaticAndCSMShadowReceivers = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"));
const auto CVarMobileEnableMovableLightCSMShaderCulling = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableMovableLightCSMShaderCulling"));
const auto CVarMobileAllowDistanceFieldShadows = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowDistanceFieldShadows"));
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:1984
Scope (from outer to inner):
file
function void ShaderMapAppendKeyString
Source code excerpt:
{
static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportSkyAtmosphere"));
if (CVar && CVar->GetValueOnAnyThread() > 0)
{
KeyString += TEXT("_SKYATM");
static const auto CVarHeightFog = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportSkyAtmosphereAffectsHeightFog"));
if (CVarHeightFog && CVarHeightFog->GetValueOnAnyThread() > 0)
#Associated Variable and Callsites
This variable is associated with another variable named CVarSupportSkyAtmosphere
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:68
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
const auto CVarVertexFoggingForOpaque = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.VertexFoggingForOpaque"));
const auto CVarAllowStaticLighting = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AllowStaticLighting"));
const auto CVarSupportSkyAtmosphere = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportSkyAtmosphere"));
const auto CVarMobileHDR = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MobileHDR"));
const auto CVarMobileAllowMovableDirectionalLights = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowMovableDirectionalLights"));
const auto CVarMobileEnableStaticAndCSMShadowReceivers = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableStaticAndCSMShadowReceivers"));
const auto CVarMobileEnableMovableLightCSMShaderCulling = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.EnableMovableLightCSMShaderCulling"));
const auto CVarMobileAllowDistanceFieldShadows = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.Mobile.AllowDistanceFieldShadows"));
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ReadOnlyCVARCache.cpp:85
Scope (from outer to inner):
file
function void FReadOnlyCVARCache::Initialize
Source code excerpt:
bEnableLowQualityLightmaps = !CVarSupportLowQualityLightmaps || CVarSupportLowQualityLightmaps->GetValueOnAnyThread() != 0 || bForceAllPermutations;
bAllowStaticLighting = CVarAllowStaticLighting->GetValueOnAnyThread() != 0;
bSupportSkyAtmosphere = !CVarSupportSkyAtmosphere || CVarSupportSkyAtmosphere->GetValueOnAnyThread() != 0 || bForceAllPermutations;
// mobile
bMobileHDR = CVarMobileHDR->GetValueOnAnyThread() == 1;
bMobileAllowMovableDirectionalLights = CVarMobileAllowMovableDirectionalLights->GetValueOnAnyThread() != 0;
bMobileAllowDistanceFieldShadows = CVarMobileAllowDistanceFieldShadows->GetValueOnAnyThread() != 0;
bMobileEnableStaticAndCSMShadowReceivers = CVarMobileEnableStaticAndCSMShadowReceivers->GetValueOnAnyThread() != 0;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:32
Scope: file
Source code excerpt:
// The project setting (disable runtime and shader code)
static TAutoConsoleVariable<int32> CVarSupportSkyAtmosphere(
TEXT("r.SupportSkyAtmosphere"),
1,
TEXT("Enables SkyAtmosphere rendering and shader code."),
ECVF_ReadOnly | ECVF_RenderThreadSafe);
// The project setting for the sky atmosphere component to affect the height fog (disable runtime and shader code)