r.HeterogeneousVolumes.HeightFog

r.HeterogeneousVolumes.HeightFog

#Overview

name: r.HeterogeneousVolumes.HeightFog

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.HeterogeneousVolumes.HeightFog is to control whether height fog is applied to Heterogeneous Volumes in Unreal Engine 5’s rendering system. This setting variable is specifically used for the Heterogeneous Volumes feature, which is part of the rendering subsystem.

Based on the Callsites section, this variable is primarily used in the Renderer module, specifically within the HeterogeneousVolumes functionality. The code is located in the file “HeterogeneousVolumes.cpp” within the Renderer’s private directory.

The value of this variable is set as a console variable using TAutoConsoleVariable. It is initialized with a default value of 1, meaning height fog is applied to Heterogeneous Volumes by default.

The associated variable CVarHeterogeneousVolumesApplyHeightFog interacts directly with r.HeterogeneousVolumes.HeightFog. This C++ variable is used to access the console variable’s value within the code.

Developers must be aware that this variable affects the rendering of Heterogeneous Volumes and can impact the visual appearance of height fog in scenes using this feature. Changing this value will toggle the application of height fog to Heterogeneous Volumes.

Best practices when using this variable include:

  1. Only modifying it if there’s a specific need to disable height fog for Heterogeneous Volumes.
  2. Being aware of its impact on visual consistency across different scenes or projects.
  3. Testing thoroughly after changing its value to ensure desired visual results.

Regarding the associated variable CVarHeterogeneousVolumesApplyHeightFog:

The purpose of CVarHeterogeneousVolumesApplyHeightFog is to provide a programmatic way to access the value of the r.HeterogeneousVolumes.HeightFog console variable within the C++ code.

This variable is used in the Renderer module, specifically in the HeterogeneousVolumes namespace. It’s defined in the same file as the console variable (HeterogeneousVolumes.cpp).

The value of CVarHeterogeneousVolumesApplyHeightFog is set automatically by the TAutoConsoleVariable system, which links it to the r.HeterogeneousVolumes.HeightFog console variable.

It interacts directly with the r.HeterogeneousVolumes.HeightFog console variable, essentially serving as its C++ representation.

Developers should be aware that this variable is used to check the state of height fog application in the ShouldApplyHeightFog() function, which likely influences rendering decisions.

Best practices for using CVarHeterogeneousVolumesApplyHeightFog include:

  1. Using GetValueOnRenderThread() when accessing its value, as shown in the provided code.
  2. Being cautious about caching its value, as it can be changed at runtime through the console variable.
  3. Considering thread safety when accessing this variable, as indicated by the ECVF_RenderThreadSafe flag.

#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:216

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesApplyHeightFog(
	TEXT("r.HeterogeneousVolumes.HeightFog"),
	1,
	TEXT("Applies height fog to Heterogeneous Volumes (Default = 1)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesApplyVolumetricFog(

#Associated Variable and Callsites

This variable is associated with another variable named CVarHeterogeneousVolumesApplyHeightFog. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:215

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesApplyHeightFog(
	TEXT("r.HeterogeneousVolumes.HeightFog"),
	1,
	TEXT("Applies height fog to Heterogeneous Volumes (Default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:488

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool ShouldApplyHeightFog

Source code excerpt:

	bool ShouldApplyHeightFog()
	{
		return CVarHeterogeneousVolumesApplyHeightFog.GetValueOnRenderThread() != 0;
	}

	bool ShouldApplyVolumetricFog()
	{
		return CVarHeterogeneousVolumesApplyVolumetricFog.GetValueOnRenderThread() != 0;
	}