MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold

MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold

#Overview

name: MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold

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 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold is to control the simplification process of mesh area lights in Unreal Engine 5’s lighting system. This setting is specifically used in the Lightmass subsystem, which is responsible for global illumination and advanced lighting calculations.

Based on the callsites, this variable is primarily used in the Lightmass module of Unreal Engine 5. It’s referenced in both the editor-side code (UnrealEd) and the Lightmass program itself.

The value of this variable is set in the Lightmass configuration file (GLightmassIni). It’s read from the “DevOptions.MeshAreaLights” section of the config file using the GConfig system.

This variable interacts with other mesh area light settings, such as MeshAreaLightSimplifyCornerDistanceThreshold and MeshAreaLightSimplifyNormalCosAngleThreshold. Together, these settings control how mesh area lights are simplified and processed.

Developers must be aware that this variable affects the balance between lighting accuracy and performance. A higher value will result in more aggressive simplification of mesh area lights, potentially improving performance but reducing lighting fidelity.

Best practices when using this variable include:

  1. Adjusting it in small increments and observing the impact on both lighting quality and performance.
  2. Testing the setting with a variety of mesh sizes and complexities to ensure it works well across your entire scene.
  3. Considering the target hardware when setting this value, as more powerful systems may be able to handle less aggressive simplification.
  4. Documenting any changes to this setting in your project, as it can have a significant impact on the final look of your scenes.
  5. Using this setting in conjunction with other Lightmass settings to achieve the optimal balance between performance and visual quality.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Lightmass/Lightmass.cpp:2237

Scope (from outer to inner):

file
function     void FLightmassExporter::WriteSceneSettings

Source code excerpt:

		Scene.MeshAreaLightSettings.MeshAreaLightSimplifyNormalCosAngleThreshold = FMath::Cos(FMath::Clamp(MeshAreaLightSimplifyNormalAngleThreshold, 0.0f, 90.0f) * (float)PI / 180.0f);
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.MeshAreaLights"), TEXT("MeshAreaLightSimplifyCornerDistanceThreshold"), Scene.MeshAreaLightSettings.MeshAreaLightSimplifyCornerDistanceThreshold, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.MeshAreaLights"), TEXT("MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold"), Scene.MeshAreaLightSettings.MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold, GLightmassIni));
		VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.MeshAreaLights"), TEXT("MeshAreaLightGeneratedDynamicLightSurfaceOffset"), Scene.MeshAreaLightSettings.MeshAreaLightGeneratedDynamicLightSurfaceOffset, GLightmassIni));
	}
	{
		Scene.AmbientOcclusionSettings.bUseAmbientOcclusion = LevelSettings.bUseAmbientOcclusion;
		Scene.AmbientOcclusionSettings.bGenerateAmbientOcclusionMaterialMask = LevelSettings.bGenerateAmbientOcclusionMaterialMask;
		Scene.AmbientOcclusionSettings.bVisualizeAmbientOcclusion = LevelSettings.bVisualizeAmbientOcclusion;

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/LightingMesh.cpp:329

Scope (from outer to inner):

file
namespace    Lightmass
function     void FStaticLightingMesh::CreateMeshAreaLights

Source code excerpt:

				FMemory::Memset(PrimitiveIndices.GetData(), UnprocessedIndex, PrimitiveIndices.Num() * PrimitiveIndices.GetTypeSize());
				int32 NextPrimitiveIndex = 0;
				const float DistanceThreshold = FBoxSphereBounds3f(BoundingBox).SphereRadius * Scene.MeshAreaLightSettings.MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold;
				// The temporary stack of texels that need to be processed
				TArray<FIntPoint> PendingTexels;
				// Iterate over all texels and assign a primitive index to each one
				// This effectively simplifies the mesh area light by reducing the number of primitives that are needed to represent the light
				for (int32 Y = 0; Y < TexelToCornersMap.GetSizeY(); Y++)
				{

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Public/SceneExport.h:244

Scope (from outer to inner):

file
namespace    Lightmass

Source code excerpt:


	/** Fraction of a mesh's bounds that an emissive texel can be from a simplified primitive and still get merged into that primitive. */
	float MeshAreaLightSimplifyMeshBoundingRadiusFractionThreshold;

	/** Distance along the average normal from the bounds origin of the mesh area light to place a light to handle influencing dynamic objects. */
	float MeshAreaLightGeneratedDynamicLightSurfaceOffset;
};

/** AO settings */