ShowFlag.VolumetricLightmap

ShowFlag.VolumetricLightmap

#Overview

name: ShowFlag.VolumetricLightmap

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

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.VolumetricLightmap is to control the visibility and application of volumetric lightmap lighting in the Unreal Engine 5 rendering system. This setting variable is part of the engine’s show flags, which are used to toggle various rendering features on and off.

ShowFlag.VolumetricLightmap is primarily used by the rendering system, specifically for lighting and global illumination features. Based on the callsites, it’s clear that this variable is utilized in several Unreal Engine subsystems and modules:

  1. The core Engine module
  2. The Renderer module
  3. The GPULightmass plugin
  4. The CinematicPrestreamingEditor plugin

The value of this variable is typically set through the engine’s show flags system, which allows developers and users to toggle various rendering features. It can be controlled via the engine’s GUI, console commands, or programmatically in C++ code.

This variable interacts with several other rendering-related variables and systems, such as:

  1. IndirectLightingCache
  2. Global Illumination systems (e.g., LumenGlobalIllumination)
  3. VolumetricFog
  4. Other lighting-related show flags

Developers should be aware of the following when using this variable:

  1. Toggling this flag affects the visibility of volumetric lightmap lighting in the scene.
  2. It can impact performance, as enabling volumetric lightmaps may increase rendering overhead.
  3. It interacts with other lighting systems and may affect the overall visual quality of the scene.

Best practices when using this variable include:

  1. Use it in conjunction with other lighting-related show flags to achieve the desired visual result.
  2. Consider performance implications when enabling or disabling this feature, especially for lower-end hardware.
  3. Be aware of its impact on other lighting systems and adjust accordingly.

Regarding the associated variable VolumetricLightmap:

The purpose of VolumetricLightmap is to store and manage the actual volumetric lightmap data used for rendering. It is closely related to ShowFlag.VolumetricLightmap, as the show flag controls whether this data is used in rendering.

VolumetricLightmap is primarily used in the GPULightmass plugin and the core rendering systems. It’s part of the FVolumetricLightmapRenderer class and is used to store and manipulate volumetric lightmap data.

The value of this variable is typically set and managed within the GPULightmass plugin, particularly in the FVolumetricLightmapRenderer class.

This variable interacts closely with other volumetric lightmap-related data structures and rendering parameters, such as VolumetricLightmapData and AccumulationBrickData.

Developers should be aware that:

  1. This variable represents the actual volumetric lightmap data, not just a visibility flag.
  2. It’s closely tied to the GPULightmass plugin’s functionality.
  3. Manipulating this data directly can have significant impacts on the scene’s lighting.

Best practices when working with this variable include:

  1. Understand the structure and purpose of the volumetric lightmap data before modifying it.
  2. Use the provided APIs and functions in the GPULightmass plugin to interact with this data rather than modifying it directly.
  3. Be aware of the performance implications of generating and using volumetric lightmap data, especially for large or complex scenes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:159

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSSS, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSSSSF", "Subsurface Scattering (Screen Space)"))
/** Whether to apply volumetric lightmap lighting, when present. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VolumetricLightmap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "VolumetricLightmapSF", "Volumetric Lightmap"))
/** If the indirect lighting cache is enabled, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(IndirectLightingCache, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "IndirectLightingCacheSF", "Indirect Lighting Cache"))
/** calls debug drawing for AIs */
SHOWFLAG_FIXED_IN_SHIPPING(0, DebugAI, SFG_Developer, NSLOCTEXT("UnrealEd", "DebugAISF", "AI Debug"))
/** calls debug drawing for whatever LogVisualizer wants to draw */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisLog, SFG_Developer, NSLOCTEXT("UnrealEd", "VisLogSF", "Log Visualizer"))

#Loc: <Workspace>/Engine/Plugins/Experimental/CinematicPrestreaming/Source/CinematicPrestreamingEditor/Private/CinePrestreamingRecorderSetting.cpp:31

Scope (from outer to inner):

file
function     UCinePrestreamingRecorderSetting::UCinePrestreamingRecorderSetting

Source code excerpt:

	ShowFlagsToDisable.Add("ShowFlag.Atmosphere");
	ShowFlagsToDisable.Add("ShowFlag.VolumetricFog");
	ShowFlagsToDisable.Add("ShowFlag.VolumetricLightmap");
	ShowFlagsToDisable.Add("ShowFlag.LumenGlobalIllumiination");
	ShowFlagsToDisable.Add("ShowFlag.LumenReflections");
	ShowFlagsToDisable.Add("ShowFlag.AmbientOcclusion");
	ShowFlagsToDisable.Add("ShowFlag.DistanceFieldAO");
}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/VolumetricLightmap.cpp:97

Scope (from outer to inner):

file
namespace    GPULightmass
function     FVolumetricLightmapRenderer::FVolumetricLightmapRenderer

Source code excerpt:

	: Scene(Scene)
{
	VolumetricLightmap.Data = &VolumetricLightmapData;
	
	NumTotalPassesToRender = Scene->Settings->GISamples * Scene->Settings->VolumetricLightmapQualityMultiplier;
	
	if (Scene->Settings->bUseIrradianceCaching)
	{
		NumTotalPassesToRender += Scene->Settings->IrradianceCacheQuality;	

#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/VolumetricLightmap.cpp:109

Scope (from outer to inner):

file
namespace    GPULightmass
function     FPrecomputedVolumetricLightmap* FVolumetricLightmapRenderer::GetPrecomputedVolumetricLightmapForPreview

Source code excerpt:

FPrecomputedVolumetricLightmap* FVolumetricLightmapRenderer::GetPrecomputedVolumetricLightmapForPreview()
{
	return &VolumetricLightmap;
}

BEGIN_SHADER_PARAMETER_STRUCT(FVoxelizeMeshPassParameters, )
	SHADER_PARAMETER_STRUCT_REF(FViewUniformShaderParameters, View)
	SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FSceneUniformParameters, Scene)
	SHADER_PARAMETER_RDG_UNIFORM_BUFFER(FVLMVoxelizationParams, PassUniformBuffer)

#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/VolumetricLightmap.h:33

Scope (from outer to inner):

file
namespace    GPULightmass
class        class FVolumetricLightmapRenderer

Source code excerpt:

	FSceneRenderState* Scene;

	FPrecomputedVolumetricLightmap VolumetricLightmap;
	FPrecomputedVolumetricLightmapData VolumetricLightmapData;
	FVolumetricLightmapBrickData AccumulationBrickData;
	TRefCountPtr<IPooledRenderTarget> IndirectionTexture;

	FVector VolumeMin;
	FVector VolumeSize;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PrimitiveDrawingUtils.cpp:1524

Scope (from outer to inner):

file
function     bool IsRichView

Source code excerpt:

	if( !ViewFamily.EngineShowFlags.LOD ||
		// Force FDrawBasePassDynamicMeshAction to be used since it has access to the view and can implement the show flags
		!ViewFamily.EngineShowFlags.VolumetricLightmap ||
		!ViewFamily.EngineShowFlags.IndirectLightingCache ||
		!ViewFamily.EngineShowFlags.Lighting ||
		!ViewFamily.EngineShowFlags.Materials)
	{
		return true;
	}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:159

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSSS, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSSSSF", "Subsurface Scattering (Screen Space)"))
/** Whether to apply volumetric lightmap lighting, when present. */
SHOWFLAG_ALWAYS_ACCESSIBLE(VolumetricLightmap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "VolumetricLightmapSF", "Volumetric Lightmap"))
/** If the indirect lighting cache is enabled, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(IndirectLightingCache, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "IndirectLightingCacheSF", "Indirect Lighting Cache"))
/** calls debug drawing for AIs */
SHOWFLAG_FIXED_IN_SHIPPING(0, DebugAI, SFG_Developer, NSLOCTEXT("UnrealEd", "DebugAISF", "AI Debug"))
/** calls debug drawing for whatever LogVisualizer wants to draw */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisLog, SFG_Developer, NSLOCTEXT("UnrealEd", "VisLogSF", "Log Visualizer"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:1136

Scope (from outer to inner):

file
function     void SetupPrecomputedVolumetricLightmapUniformBufferParameters

Source code excerpt:

void SetupPrecomputedVolumetricLightmapUniformBufferParameters(const FScene* Scene, FEngineShowFlags EngineShowFlags, FViewUniformShaderParameters& ViewUniformShaderParameters)
{
	if (Scene && Scene->VolumetricLightmapSceneData.HasData() && EngineShowFlags.VolumetricLightmap)
	{
		const FPrecomputedVolumetricLightmapData* VolumetricLightmapData = Scene->VolumetricLightmapSceneData.GetLevelVolumetricLightmap()->Data;

		FVector BrickDimensions;
		const FVolumetricLightmapBasicBrickDataLayers* BrickData = nullptr;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VisualizeVolumetricLightmap.cpp:1

Scope: file

Source code excerpt:


/*=============================================================================
	VolumetricLightmap.cpp
=============================================================================*/

#include "Stats/Stats.h"
#include "DataDrivenShaderPlatformInfo.h"
#include "Engine/Engine.h"
#include "HAL/IConsoleManager.h"
#include "RHI.h"
#include "RenderResource.h"

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

Scope (from outer to inner):

file
function     void FSceneRenderer::ComputeVolumetricFog

Source code excerpt:


			float StaticLightingScatteringIntensityValue = 0;
			if (View.Family->EngineShowFlags.GlobalIllumination && View.Family->EngineShowFlags.VolumetricLightmap)
			{
				StaticLightingScatteringIntensityValue = FogInfo.VolumetricFogStaticLightingScatteringIntensity;
			}
			PassParameters->StaticLightingScatteringIntensity = StaticLightingScatteringIntensityValue;

			PassParameters->PhaseG = FogInfo.VolumetricFogScatteringDistribution;