IdealLightMapDensity

IdealLightMapDensity

#Overview

name: IdealLightMapDensity

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of IdealLightMapDensity is to define the ideal density value for lightmaps in Unreal Engine’s rendering system. This variable is used to control the quality and performance balance of lightmap generation and visualization.

The Unreal Engine subsystems that rely on this setting variable are primarily the rendering system and the level editor. It’s used in the LevelEditorActions module and the Renderer module.

The value of this variable is set in the Engine class as a global config property. It can be modified through the SetLightingDensityIdeal function in the LevelEditorActions module.

IdealLightMapDensity interacts with other lightmap-related variables, particularly MaxLightMapDensity and MinLightMapDensity. There’s a constraint that MaxLightMapDensity should always be slightly larger than IdealLightMapDensity.

Developers must be aware that changing IdealLightMapDensity can affect both the visual quality of lightmaps and the performance of lightmap generation. It’s also important to note that modifying this value triggers a redraw of all viewports in the editor.

Best practices when using this variable include:

  1. Balancing it with MaxLightMapDensity and MinLightMapDensity for optimal results.
  2. Adjusting it based on the specific needs of your project, considering both visual quality and performance.
  3. Testing the impact of changes in different lighting scenarios before finalizing a value.
  4. Being mindful of its effect on memory usage, as higher density values can increase memory consumption.
  5. Using it in conjunction with the lightmap density visualization tools in the editor for fine-tuning.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:289, section: [/Script/Engine.Engine]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:963

Scope (from outer to inner):

file
function     float FLevelEditorActionCallbacks::GetLightingDensityIdeal

Source code excerpt:

float FLevelEditorActionCallbacks::GetLightingDensityIdeal()
{
	return ( GEngine->IdealLightMapDensity );
}

void FLevelEditorActionCallbacks::SetLightingDensityIdeal( float Value )
{
	GEngine->IdealLightMapDensity = Value;

	// We need to make sure that Maximum is always slightly larger than ideal...
	if (GEngine->IdealLightMapDensity >= GEngine->MaxLightMapDensity - 0.01f)
	{
		SetLightingDensityMaximum( GEngine->IdealLightMapDensity + 0.01f );
	}

	FEditorSupportDelegates::RedrawAllViewports.Broadcast();
}

float FLevelEditorActionCallbacks::GetLightingDensityMaximum()

#Loc: <Workspace>/Engine/Source/Editor/LevelEditor/Private/LevelEditorActions.cpp:989

Scope (from outer to inner):

file
function     void FLevelEditorActionCallbacks::SetLightingDensityMaximum

Source code excerpt:


	// We need to make sure that Maximum is always slightly larger than ideal...
	if (GEngine->MaxLightMapDensity <= GEngine->IdealLightMapDensity + 0.01f)
	{
		GEngine->MaxLightMapDensity = GEngine->IdealLightMapDensity + 0.01f;
	}

	FEditorSupportDelegates::RedrawAllViewports.Broadcast();
}

float FLevelEditorActionCallbacks::GetLightingDensityColorScale()

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:1264

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** Ideal lightmap density value for coloring. */
	UPROPERTY(globalconfig)
	float IdealLightMapDensity;

	/** Maximum lightmap density value for coloring. */
	UPROPERTY(globalconfig)
	float MaxLightMapDensity;

	/** If true, then render gray scale density. */

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightMapDensityRendering.cpp:56

Scope (from outer to inner):

file
function     void SetupLightmapDensityPassUniformBuffer

Source code excerpt:

			1.0f,
			GEngine->MinLightMapDensity * GEngine->MinLightMapDensity,
			GEngine->IdealLightMapDensity * GEngine->IdealLightMapDensity,
			GEngine->MaxLightMapDensity * GEngine->MaxLightMapDensity);

	LightmapDensityPassParameters.DensitySelectedColor = GEngine->LightMapDensitySelectedColor;

	LightmapDensityPassParameters.VertexMappedColor = GEngine->LightMapDensityVertexMappedColor;
}