r.VolumetricFog.Emissive

r.VolumetricFog.Emissive

#Overview

name: r.VolumetricFog.Emissive

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VolumetricFog.Emissive is to control whether the volumetric fog system should include an emissive component. This setting variable is part of the rendering system, specifically the volumetric fog subsystem in Unreal Engine 5.

Based on the callsites, this setting variable is primarily used in the Renderer module, particularly in the volumetric fog rendering pipeline. The main files that reference this variable are VolumetricFog.cpp and VolumetricFogVoxelization.cpp.

The value of this variable is set through the console variable system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime using console commands or through engine configuration files.

The associated variable GVolumetricFogEmissive interacts directly with r.VolumetricFog.Emissive. They share the same value, with GVolumetricFogEmissive being the internal representation used in the C++ code.

Developers should be aware that:

  1. This variable affects the rendering performance and visual quality of volumetric fog.
  2. It’s a scalability option, meaning it can be adjusted based on performance requirements.
  3. It’s render thread safe, allowing for changes during runtime without causing threading issues.

Best practices when using this variable include:

  1. Consider the performance impact when enabling the emissive component, especially on lower-end hardware.
  2. Use it in conjunction with other volumetric fog settings for optimal visual results.
  3. Allow this setting to be configurable by end-users for performance scalability.

Regarding the associated variable GVolumetricFogEmissive:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:114

Scope: file

Source code excerpt:

int32 GVolumetricFogEmissive = 1;
FAutoConsoleVariableRef CVarVolumetricFogEmissive(
	TEXT("r.VolumetricFog.Emissive"),
	GVolumetricFogEmissive,
	TEXT("Whether to allow the volumetric fog emissive component."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GVolumetricFogRectLightTexture = 0;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFogVoxelization.cpp:584

Scope (from outer to inner):

file
function     void FVoxelizeVolumeMeshProcessor::CollectPSOInitializers

Source code excerpt:

	AddRenderTargetInfo(VolumeDesc.Format, VolumeDesc.Flags, RenderTargetsInfo);

	static const auto CVarVolumetrixFogEmissive = IConsoleManager::Get().FindConsoleVariable(TEXT("r.VolumetricFog.Emissive"));
	const bool bUseEmissive = (!CVarVolumetrixFogEmissive) || (CVarVolumetrixFogEmissive->GetInt() > 0);
	if (bUseEmissive)
	{
		AddRenderTargetInfo(VolumeDesc.Format, VolumeDesc.Flags, RenderTargetsInfo);
	}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:112

Scope: file

Source code excerpt:

);

int32 GVolumetricFogEmissive = 1;
FAutoConsoleVariableRef CVarVolumetricFogEmissive(
	TEXT("r.VolumetricFog.Emissive"),
	GVolumetricFogEmissive,
	TEXT("Whether to allow the volumetric fog emissive component."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

int32 GVolumetricFogRectLightTexture = 0;
FAutoConsoleVariableRef CVarVolumetricRectLightTexture(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricFog.cpp:1390

Scope (from outer to inner):

file
function     void FSceneRenderer::ComputeVolumetricFog

Source code excerpt:

		FRDGTexture* BlackDummyTexture = GraphBuilder.RegisterExternalTexture(GSystemTextures.BlackDummy);
		FRDGTexture* VolumetricBlackDummyTexture = GraphBuilder.RegisterExternalTexture(GSystemTextures.VolumetricBlackDummy);
		const bool bUseEmissive = GVolumetricFogEmissive > 0;

		// The potential light function for the main directional light is kept separate to be applied during the main VolumetricFogLightScattering pass (as an optimisation).
		FRDGTexture* DirectionalLightFunctionTexture = GraphBuilder.RegisterExternalTexture(GSystemTextures.WhiteDummy);
		bool bUseDirectionalLightShadowing = false;

		// Recover the information about the light use as the forward directional light for cloud shadowing