r.SkyAtmosphere
r.SkyAtmosphere
#Overview
name: r.SkyAtmosphere
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
SkyAtmosphere components are rendered when this is not 0, otherwise ignored.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkyAtmosphere is to control the rendering of SkyAtmosphere components in Unreal Engine 5. It serves as a runtime toggle for enabling or disabling the rendering of sky atmosphere effects.
This setting variable is primarily used by the Renderer subsystem of Unreal Engine 5, specifically within the SkyAtmosphere rendering module. It is defined and used in the SkyAtmosphereRendering.cpp file, which is part of the Runtime/Renderer module.
The value of this variable is set as a console variable (CVar) with a default value of 1. It can be changed at runtime through console commands or programmatically.
The r.SkyAtmosphere variable interacts closely with another variable named CVarSupportSkyAtmosphere. While r.SkyAtmosphere serves as a runtime toggle, CVarSupportSkyAtmosphere appears to be a project-level setting that determines whether sky atmosphere features are supported at all, including shader code generation.
Developers should be aware that:
- Setting r.SkyAtmosphere to 0 will disable the rendering of SkyAtmosphere components, while any non-zero value will enable it.
- The variable is marked as ECVF_RenderThreadSafe, meaning it can be safely modified from the render thread.
- The actual rendering decision is made by checking both r.SkyAtmosphere and CVarSupportSkyAtmosphere in the ShouldRenderSkyAtmosphere function.
Best practices when using this variable include:
- Use it for performance optimization by disabling sky atmosphere rendering when not needed.
- Be cautious when changing its value at runtime, as it may affect the visual consistency of the scene.
- Consider the interaction with CVarSupportSkyAtmosphere when troubleshooting sky atmosphere rendering issues.
Regarding the associated variable CVarSupportSkyAtmosphere:
The purpose of CVarSupportSkyAtmosphere is to control whether sky atmosphere features are supported at the project level, including the generation of necessary shader code.
This variable is also part of the Renderer subsystem and is used in conjunction with r.SkyAtmosphere to determine if sky atmosphere should be rendered.
The value of CVarSupportSkyAtmosphere is likely set at project initialization or compile-time, as it affects shader code generation.
Developers should be aware that:
- Disabling CVarSupportSkyAtmosphere may result in the omission of sky atmosphere-related shader code, potentially reducing compile times and package sizes.
- Changes to this variable may require project recompilation to take effect.
Best practices for CVarSupportSkyAtmosphere include:
- Set it appropriately at the project level based on whether sky atmosphere features are needed.
- Be aware that changing this variable may have more far-reaching effects than r.SkyAtmosphere, as it affects code generation.
- Use this in combination with r.SkyAtmosphere for fine-grained control over sky atmosphere rendering and support.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:27
Scope: file
Source code excerpt:
// The runtime ON/OFF toggle
static TAutoConsoleVariable<int32> CVarSkyAtmosphere(
TEXT("r.SkyAtmosphere"), 1,
TEXT("SkyAtmosphere components are rendered when this is not 0, otherwise ignored.\n"),
ECVF_RenderThreadSafe);
// The project setting (disable runtime and shader code)
static TAutoConsoleVariable<int32> CVarSupportSkyAtmosphere(
TEXT("r.SupportSkyAtmosphere"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarSkyAtmosphere
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:26
Scope: file
Source code excerpt:
// The runtime ON/OFF toggle
static TAutoConsoleVariable<int32> CVarSkyAtmosphere(
TEXT("r.SkyAtmosphere"), 1,
TEXT("SkyAtmosphere components are rendered when this is not 0, otherwise ignored.\n"),
ECVF_RenderThreadSafe);
// The project setting (disable runtime and shader code)
static TAutoConsoleVariable<int32> CVarSupportSkyAtmosphere(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SkyAtmosphereRendering.cpp:378
Scope (from outer to inner):
file
function bool ShouldRenderSkyAtmosphere
Source code excerpt:
check(SkyAtmosphere);
return FReadOnlyCVARCache::SupportSkyAtmosphere() && CVarSkyAtmosphere.GetValueOnRenderThread() > 0;
}
return false;
}
static auto GetSizeAndInvSize = [](int32 Width, int32 Height)
{