r.VolumetricFog
r.VolumetricFog
#Overview
name: r.VolumetricFog
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:
Whether to allow the volumetric fog feature.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VolumetricFog is to control whether the volumetric fog feature is allowed in the rendering system. This setting variable is crucial for managing the visual effects related to atmospheric fog in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the volumetric fog component. This is evident from the file location (Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp) where the variable is defined and used.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 1 (enabled) and can be modified at runtime using console commands or through project settings.
The r.VolumetricFog variable interacts directly with its associated variable GVolumetricFog. They share the same value, with GVolumetricFog being the actual integer variable used in the C++ code, while r.VolumetricFog is the console variable name used for external access and configuration.
Developers must be aware that this variable affects the entire volumetric fog system. Disabling it (setting to 0) will turn off volumetric fog rendering entirely, which can have a significant impact on the visual quality of scenes that rely on atmospheric effects.
Best practices when using this variable include:
- Only disable it if volumetric fog is not needed in the project, as it can provide significant visual improvements.
- Consider performance implications when enabling or disabling volumetric fog, especially on lower-end hardware.
- Use in conjunction with other fog-related settings for fine-tuning the visual appearance and performance.
Regarding the associated variable GVolumetricFog:
The purpose of GVolumetricFog is to serve as the actual integer variable used within the C++ code to control the volumetric fog feature. It’s the internal representation of the r.VolumetricFog console variable.
This variable is used directly in the renderer code to determine whether volumetric fog should be rendered. For example, it’s checked in the condition for rendering fog along with other factors like engine show flags and scene properties.
The value of GVolumetricFog is set through the FAutoConsoleVariableRef system, which links it to the r.VolumetricFog console variable. This allows it to be modified through console commands or engine configurations.
GVolumetricFog interacts primarily with the r.VolumetricFog console variable, as they are directly linked. It’s also used in conjunction with other rendering conditions to determine the final visibility of volumetric fog.
Developers should be aware that modifying GVolumetricFog directly in C++ code is not recommended. Instead, they should use the r.VolumetricFog console variable or project settings to control this feature.
Best practices for GVolumetricFog include:
- Treat it as a read-only variable in most cases, using it for conditional checks in rendering code.
- Rely on the console variable system (r.VolumetricFog) for modifying its value, rather than changing it directly.
- Consider its performance implications when used in frequently called rendering functions.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:138, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:162, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:186, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:213, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:240, section: [ShadowQuality@Cine]
- INI Section:
ShadowQuality@Cine
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:54, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:63, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:72, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/Android/AndroidScalability.ini:81, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:54, section: [ShadowQuality@0]
- INI Section:
ShadowQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:63, section: [ShadowQuality@1]
- INI Section:
ShadowQuality@1
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:72, section: [ShadowQuality@2]
- INI Section:
ShadowQuality@2
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/IOS/IOSScalability.ini:81, section: [ShadowQuality@3]
- INI Section:
ShadowQuality@3
- Raw value:
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/VolumetricFog.cpp:33
Scope: file
Source code excerpt:
int32 GVolumetricFog = 1;
FAutoConsoleVariableRef CVarVolumetricFog(
TEXT("r.VolumetricFog"),
GVolumetricFog,
TEXT("Whether to allow the volumetric fog feature."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GVolumetricFogInjectShadowedLightsSeparately = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GVolumetricFog
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:31
Scope: file
Source code excerpt:
using namespace LightFunctionAtlas;
int32 GVolumetricFog = 1;
FAutoConsoleVariableRef CVarVolumetricFog(
TEXT("r.VolumetricFog"),
GVolumetricFog,
TEXT("Whether to allow the volumetric fog feature."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GVolumetricFogInjectShadowedLightsSeparately = 1;
FAutoConsoleVariableRef CVarVolumetricFogInjectShadowedLightsSeparately(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:1098
Scope (from outer to inner):
file
function BEGIN_SHADER_PARAMETER_STRUCT
Source code excerpt:
return ShouldRenderFog(ViewFamily)
&& Scene
&& GVolumetricFog
&& ViewFamily.EngineShowFlags.VolumetricFog
&& Scene->ExponentialFogs.Num() > 0
&& Scene->ExponentialFogs[0].bEnableVolumetricFog
&& Scene->ExponentialFogs[0].VolumetricFogDistance > 0;
}