r.HeterogeneousVolumes.VolumetricFog
r.HeterogeneousVolumes.VolumetricFog
#Overview
name: r.HeterogeneousVolumes.VolumetricFog
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Applies volumetric fog to Heterogeneous Volumes (Default = 1)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.VolumetricFog is to control the application of volumetric fog to Heterogeneous Volumes in Unreal Engine 5’s rendering system.
This setting variable is primarily used in the Renderer module, specifically within the HeterogeneousVolumes subsystem. It’s part of the advanced rendering features that deal with complex volumetric effects.
The value of this variable is set as a console variable with a default value of 1 (enabled). It can be changed at runtime through console commands or programmatically.
The associated variable CVarHeterogeneousVolumesApplyVolumetricFog directly interacts with r.HeterogeneousVolumes.VolumetricFog. This C++ variable is used to access and check the current value of the setting.
Developers must be aware that this variable affects the rendering performance and visual quality of Heterogeneous Volumes. Enabling volumetric fog (value 1) will increase rendering complexity but provide more realistic atmospheric effects. Disabling it (value 0) may improve performance at the cost of visual fidelity.
Best practices when using this variable include:
- Testing performance impact in various scenarios before changing the default value.
- Considering the target hardware capabilities when deciding whether to enable or disable this feature.
- Using it in conjunction with other fog and atmospheric settings for a cohesive visual result.
Regarding the associated variable CVarHeterogeneousVolumesApplyVolumetricFog:
The purpose of CVarHeterogeneousVolumesApplyVolumetricFog is to provide programmatic access to the r.HeterogeneousVolumes.VolumetricFog setting within the C++ code.
This variable is used in the Renderer module, specifically in the HeterogeneousVolumes subsystem to determine if volumetric fog should be applied.
The value of this variable is set automatically based on the r.HeterogeneousVolumes.VolumetricFog console variable.
It interacts directly with the r.HeterogeneousVolumes.VolumetricFog setting, essentially serving as its C++ representation.
Developers should be aware that this variable is accessed on the render thread, as evident from the GetValueOnRenderThread() method used in the ShouldApplyVolumetricFog() function.
Best practices for using this variable include:
- Always access it on the render thread to avoid threading issues.
- Use the provided ShouldApplyVolumetricFog() function for consistency and proper thread safety.
- Be cautious about changing its value directly, as it’s meant to reflect the console variable setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:223
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesApplyVolumetricFog(
TEXT("r.HeterogeneousVolumes.VolumetricFog"),
1,
TEXT("Applies volumetric fog to Heterogeneous Volumes (Default = 1)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesApplyFogInscatteringMode(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesApplyVolumetricFog
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:222
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesApplyVolumetricFog(
TEXT("r.HeterogeneousVolumes.VolumetricFog"),
1,
TEXT("Applies volumetric fog to Heterogeneous Volumes (Default = 1)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:493
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function bool ShouldApplyVolumetricFog
Source code excerpt:
bool ShouldApplyVolumetricFog()
{
return CVarHeterogeneousVolumesApplyVolumetricFog.GetValueOnRenderThread() != 0;
}
EFogMode GetApplyFogInscattering()
{
return static_cast<EFogMode>(FMath::Clamp(CVarHeterogeneousVolumesApplyFogInscatteringMode.GetValueOnRenderThread(), 0, 2));
}