DefaultStaticMeshLightingRes

DefaultStaticMeshLightingRes

#Overview

name: DefaultStaticMeshLightingRes

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 DefaultStaticMeshLightingRes is to set a default resolution for static mesh lightmaps in Unreal Engine 5. This setting is primarily used for the static lighting system, specifically for determining the default lightmap resolution for static meshes when a custom resolution is not specified.

This setting variable is mainly relied upon by the Engine module, particularly in components related to static mesh lighting and lightmap generation. It’s used in the StatsViewer module as well, specifically in the StaticMeshLightingInfoStatsPage.

The value of this variable is set in the Lightmass configuration file (GLightmassIni). It’s read from the “DevOptions.StaticLighting” section with the key “DefaultStaticMeshLightingRes”.

This variable interacts with other lightmap-related variables and functions, such as OverriddenLightMapRes and bOverrideLightMapRes. It’s used as a fallback value when custom lightmap resolutions are not set for static meshes.

Developers must be aware that this variable sets a global default for all static meshes that don’t have a custom lightmap resolution. It’s important to choose an appropriate value that balances lighting quality and performance, as higher resolutions can significantly increase memory usage and build times.

Best practices when using this variable include:

  1. Set a reasonable default value that works well for most static meshes in your project.
  2. Override this value for individual static meshes that require higher or lower resolution lightmaps.
  3. Consider the target platform’s capabilities when setting this value.
  4. Be mindful of the impact on build times and memory usage when increasing this value.
  5. Use the StatsViewer to analyze lightmap usage and adjust the default or individual mesh settings as needed.
  6. Regularly review and update this setting as your project evolves to ensure optimal performance and quality.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseLightmass.ini:25, section: [DevOptions.StaticLighting]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/StatsViewer/Private/StatsPages/StaticMeshLightingInfoStatsPage.cpp:527

Scope (from outer to inner):

file
function     void FStaticMeshLightingInfoStatsPage::GetUserSetStaticLightmapResolution

Source code excerpt:

	{
		int32 DefaultRes = 0;
		verify(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("DefaultStaticMeshLightingRes"), DefaultRes, GLightmassIni));

		TSharedRef<STextEntryPopup> TextEntry = 
			SNew(STextEntryPopup)
			.Label(LOCTEXT("StaticMeshLightingInfo_GetResolutionTitle", "Enter Lightmap Resolution"))
			.HintText(LOCTEXT("StaticMeshLightingInfo_GetResolutionToolTip", "Will round to power of two"))
			.DefaultText(FText::AsNumber(DefaultRes))

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/StaticMeshComponent.cpp:2633

Scope (from outer to inner):

file
function     void UStaticMeshComponent::GetEstimatedLightMapResolution

Source code excerpt:

		{
			int32 TempInt = 0;
			verify(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("DefaultStaticMeshLightingRes"), TempInt, GLightmassIni));

			Width	= TempInt;
			Height	= TempInt;
		}
	}
	else

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshLight.cpp:520

Scope (from outer to inner):

file
function     bool UStaticMeshComponent::SetStaticLightingMapping

Source code excerpt:

							// Set it to the default value from the ini
							int32 TempInt = 0;
							verify(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("DefaultStaticMeshLightingRes"), TempInt, GLightmassIni));
							OverriddenLightMapRes = TempInt;
							bSuccessful = true;
						}
					}
					else
					{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/StaticMeshLight.cpp:546

Scope (from outer to inner):

file
function     bool UStaticMeshComponent::SetStaticLightingMapping

Source code excerpt:

							// Set it to the default value from the ini
							int32 TempInt = 0;
							verify(GConfig->GetInt(TEXT("DevOptions.StaticLighting"), TEXT("DefaultStaticMeshLightingRes"), TempInt, GLightmassIni));
							OverriddenLightMapRes = TempInt;
							bOverrideLightMapRes = true;
							bSuccessful = true;
						}
					}
					else