bCompressLightmaps

bCompressLightmaps

#Overview

name: bCompressLightmaps

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

#Summary

#Usage in the C++ source code

The purpose of bCompressLightmaps is to control whether lightmaps should be compressed in the Unreal Engine 5 rendering system. This setting variable is primarily used in the static lighting and lightmap generation processes.

Based on the callsites, this setting variable is utilized by the following Unreal Engine subsystems and modules:

  1. GPULightmass plugin (Experimental)
  2. Static Lighting System
  3. World Settings

The value of this variable is set in multiple places:

  1. In the UGPULightmassSettings class, it’s defined as a UPROPERTY with a default value of true.
  2. In the FLightmassWorldInfoSettings constructor, it’s initialized to true.
  3. It can be modified through the World Settings in the editor.
  4. It’s also read from a configuration file (GLightmassIni) in the StaticLightingSystem.

The bCompressLightmaps variable interacts with other variables and systems:

  1. It affects the GCompressLightmaps global variable in the Static Lighting System.
  2. It’s used in conjunction with the World Settings’ LightmassSettings.

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

  1. Compressing lightmaps can save memory and disk space but may slightly impact rendering performance and visual quality.
  2. The setting can be overridden at different levels (project settings, world settings, etc.).
  3. Changing this setting requires rebuilding lightmaps to take effect.

Best practices when using this variable include:

  1. Keep it enabled (true) by default to save memory and disk space.
  2. Only disable it if you notice visual artifacts or need the highest possible lightmap quality.
  3. Consider the trade-off between quality and performance/storage when adjusting this setting.
  4. Test the impact of changing this setting in your specific use case, as the effects may vary depending on the project’s complexity and target hardware.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Private/Scene/Scene.cpp:2989

Scope (from outer to inner):

file
namespace    GPULightmass
function     void FScene::ApplyFinishedLightmapsToWorld

Source code excerpt:

		}

		GCompressLightmaps = Settings->bCompressLightmaps;

		FLightMap2D::EncodeTextures(World, LightingScenario, true, true);
		FShadowMap2D::EncodeTextures(World, LightingScenario, true, true);

		SlowTask.EnterProgressFrame(1, LOCTEXT("ApplyingNewLighting", "Applying new lighting"));

#Loc: <Workspace>/Engine/Plugins/Experimental/GPULightmass/Source/GPULightmass/Public/GPULightmassSettings.h:59

Scope (from outer to inner):

file
class        class UGPULightmassSettings : public UObject

Source code excerpt:

	// Use caution when disabling this.
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = General)
	bool bCompressLightmaps = true;

	// Total number of ray paths executed per texel across all bounces.
	// Set this to the lowest value that gives artifact-free results with the denoiser.
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = GlobalIllumination, DisplayName = "GI Samples", meta = (ClampMin = "32", ClampMax = "65536", UIMax = "8192"))
	int32 GISamples = 512;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/StaticLightingSystem/StaticLightingSystem.cpp:666

Scope (from outer to inner):

file
function     bool FStaticLightingSystem::BeginLightmassProcess

Source code excerpt:

		verify(GConfig->GetBool(TEXT("DevOptions.StaticLighting"), TEXT("bAllowCropping"), GAllowLightmapCropping, GLightmassIni));
		verify(GConfig->GetBool(TEXT("DevOptions.StaticLighting"), TEXT("bRebuildDirtyGeometryForLighting"), bRebuildDirtyGeometryForLighting, GLightmassIni));
		verify(GConfig->GetBool(TEXT("DevOptions.StaticLighting"), TEXT("bCompressLightmaps"), GCompressLightmaps, GLightmassIni));

		GCompressLightmaps = GCompressLightmaps && World->GetWorldSettings()->LightmassSettings.bCompressLightmaps;

		GAllowLightmapPadding = true;
		FMemory::Memzero(&LightingMeshBounds, sizeof(FBox));
		FMemory::Memzero(&AutomaticImportanceVolumeBounds, sizeof(FBox));

		GLightingBuildQuality = Options.QualityLevel;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:147

Scope: file

Source code excerpt:

	 */
	UPROPERTY(BlueprintReadWrite, EditAnywhere, Category=LightmassGeneral, AdvancedDisplay)
	uint8 bCompressLightmaps:1;

	/** 
	 * Size of an Volumetric Lightmap voxel at the highest density (used around geometry), in world space units. 
	 * This setting has a large impact on build times and memory, use with caution.  
	 * Halving the DetailCellSize can increase memory by up to a factor of 8x.
	 */

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/GameFramework/WorldSettings.h:214

Scope (from outer to inner):

file
function     FLightmassWorldInfoSettings

Source code excerpt:

		, bVisualizeMaterialDiffuse(false)
		, bVisualizeAmbientOcclusion(false)
		, bCompressLightmaps(true)
		, VolumetricLightmapDetailCellSize(200)
		, VolumetricLightmapMaximumBrickMemoryMb(30)
		, VolumetricLightmapSphericalHarmonicSmoothing(.02f)
		, VolumeLightSamplePlacementScale(1)
		, DirectIlluminationOcclusionFraction(0.5f)
		, IndirectIlluminationOcclusionFraction(1.0f)