MaxRefinementLevels

MaxRefinementLevels

#Overview

name: MaxRefinementLevels

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

#Summary

#Usage in the C++ source code

The purpose of MaxRefinementLevels is to control the maximum number of subdivision levels for volumetric lightmap bricks in Unreal Engine’s lighting system. Here’s a detailed breakdown:

  1. Purpose: MaxRefinementLevels is used to define the maximum depth of the octree-like structure used for adaptive refinement of volumetric lightmap data. It determines how finely the engine can subdivide the lighting information in areas that require more detail.

  2. Subsystems: This variable is primarily used in the Lightmass system, which is responsible for global illumination calculations. It’s also utilized in the editor when importing and processing volumetric lightmap data.

  3. Value setting: The value is typically set in the project’s LightmassSettings, which can be configured in the editor. It’s also read from the Lightmass.ini configuration file.

  4. Interactions: MaxRefinementLevels interacts with other variables like BrickSize to determine the resolution and memory usage of the volumetric lightmap. It’s used in calculations for grid sizes, cell dimensions, and in determining when to stop subdividing bricks.

  5. Developer awareness: Developers should be aware that higher values of MaxRefinementLevels will allow for finer detail in lighting but will also increase memory usage and processing time. The value is clamped between 1 and 6 in the code to prevent extreme values.

  6. Best practices:

    • Balance MaxRefinementLevels with performance and memory constraints.
    • Consider the scale and detail of your scene when setting this value.
    • Use in conjunction with other volumetric lightmap settings for optimal results.
    • Monitor memory usage and build times when adjusting this value.

In summary, MaxRefinementLevels is a crucial setting for controlling the detail and memory usage of volumetric lightmaps in Unreal Engine. It should be adjusted carefully based on the specific needs of the project and the available resources.

#Setting Variables

#References In INI files

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

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
namespace    GPULightmass

Source code excerpt:


const int32 BrickSize = 4;
const int32 MaxRefinementLevels = 3;

FVolumetricLightmapRenderer::FVolumetricLightmapRenderer(FSceneRenderState* Scene)
	: Scene(Scene)
{
	VolumetricLightmap.Data = &VolumetricLightmapData;
	

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

Scope (from outer to inner):

file
namespace    GPULightmass

Source code excerpt:


	const int32 BrickSizeLog2 = FMath::FloorLog2(BrickSize);
	const int32 DetailCellsPerTopLevelBrick = 1 << (MaxRefinementLevels * BrickSizeLog2);

	FIntVector TopLevelGridSize = FIntVector::DivideAndRoundUp(FullGridSize, DetailCellsPerTopLevelBrick);

	VolumeSize = FVector(TopLevelGridSize) * DetailCellsPerTopLevelBrick * TargetDetailCellSize;
	FBox FinalVolume(VolumeMin, VolumeMin + VolumeSize);

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

Scope (from outer to inner):

file
namespace    GPULightmass

Source code excerpt:

		TArray<FRDGTextureUAV*, FRDGArrayAllocator> VoxelizationVolumeMipUAVs;

		for (int32 Level = 0; Level < MaxRefinementLevels; Level++)
		{
			const FRDGTextureDesc Desc = FRDGTextureDesc::Create3D(
				FIntVector(IndirectionTextureDimensions.X >> (Level * BrickSizeLog2), IndirectionTextureDimensions.Y >> (Level * BrickSizeLog2), IndirectionTextureDimensions.Z >> (Level * BrickSizeLog2)),
				PF_R32_UINT,
				FClearValueBinding::Black,
				ETextureCreateFlags::ShaderResource | ETextureCreateFlags::RenderTargetable | ETextureCreateFlags::UAV);

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

Scope (from outer to inner):

file
function     void FilterWithNeighbors

Source code excerpt:

		checkSlow(Brick.TreeDepth == CurrentDepth);

		const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - Brick.TreeDepth) * BrickSizeLog2);
		const int32 NumBottomLevelBricks = DetailCellsPerCurrentLevelBrick / BrickSize;
		const FVector IndirectionTexturePosition = FVector(Brick.IndirectionTexturePosition);
		const FIntVector BrickLayoutPosition = ComputeBrickLayoutPosition(BrickStartAllocation + BrickIndex, BrickLayoutDimensions) * PaddedBrickSize;

		for (int32 Z = 0; Z < BrickSize; Z++)
		{

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

Scope (from outer to inner):

file
function     void StitchDetailBricksWithLowDensityNeighbors

Source code excerpt:

		const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];
		const FIntVector BrickLayoutPosition = ComputeBrickLayoutPosition(BrickStartAllocation + BrickIndex, BrickLayoutDimensions) * PaddedBrickSize;
		const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - Brick.TreeDepth) * BrickSizeLog2);
		const int32 NumBottomLevelBricks = DetailCellsPerCurrentLevelBrick / BrickSize;
		const FVector IndirectionTexturePosition = FVector(Brick.IndirectionTexturePosition);

		int32 X, Y, Z = 0;

		// Iterate over unique data on the edge of the brick which needs to match padding on lower resolution bricks

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

Scope (from outer to inner):

file
function     void CopyPaddingFromUniqueData

Source code excerpt:

		const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];
		const FIntVector BrickLayoutPosition = ComputeBrickLayoutPosition(BrickStartAllocation + BrickIndex, BrickLayoutDimensions) * PaddedBrickSize;
		const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - Brick.TreeDepth) * BrickSizeLog2);
		const int32 NumBottomLevelBricks = DetailCellsPerCurrentLevelBrick / BrickSize;
		const FVector IndirectionTexturePosition = FVector(Brick.IndirectionTexturePosition);

		int32 X, Y, Z = 0;

		// Iterate over padding voxels

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

Scope (from outer to inner):

file
function     void CopyVolumeBorderFromInterior

Source code excerpt:

		const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];
		const FIntVector BrickLayoutPosition = ComputeBrickLayoutPosition(BrickStartAllocation + BrickIndex, BrickLayoutDimensions) * PaddedBrickSize;
		const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - Brick.TreeDepth) * BrickSizeLog2);
		const int32 NumBottomLevelBricks = DetailCellsPerCurrentLevelBrick / BrickSize;
		const FVector IndirectionTexturePosition = FVector(Brick.IndirectionTexturePosition);

		// Operate on bricks on the edge of the volume covered by the indirection texture
		if (Brick.IndirectionTexturePosition.X + NumBottomLevelBricks == CurrentLevelData.IndirectionTextureDimensions.X)
		{

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

Scope (from outer to inner):

file
function     int32 TrimBricksByInterpolationError

Source code excerpt:

	int32 NumBricksRemoved = 0;

	if (VolumetricLightmapSettings.MaxRefinementLevels > 1)
	{
		TArray<const FImportedVolumetricLightmapBrick*>& HighestDensityBricks = BricksByDepth[VolumetricLightmapSettings.MaxRefinementLevels - 1];
		const int32 ParentLevel = VolumetricLightmapSettings.MaxRefinementLevels - 2;
		TArray<const FImportedVolumetricLightmapBrick*>& ParentLevelBricks = BricksByDepth[ParentLevel];

		const int32 BrickSize = VolumetricLightmapSettings.BrickSize;
		const float InvTotalBrickSize = 1.0f / (BrickSize * BrickSize * BrickSize);
		const int32 BrickSizeLog2 = FMath::FloorLog2(BrickSize);
		const int32 DetailCellsPerParentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - ParentLevel) * BrickSizeLog2);
		const int32 NumParentBottomLevelBricks = DetailCellsPerParentLevelBrick / BrickSize;

		for (int32 BrickIndex = 0; BrickIndex < HighestDensityBricks.Num(); BrickIndex++)
		{
			const FImportedVolumetricLightmapBrick& Brick = *HighestDensityBricks[BrickIndex];
			const FImportedVolumetricLightmapBrick* ParentBrick = NULL;

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

Scope (from outer to inner):

file
function     int32 TrimBricksForMemoryLimit

Source code excerpt:

	int32 NumBricksBeforeTrimming = 0;

	for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
	{
		const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];
		NumBricksBeforeTrimming += BricksAtCurrentDepth.Num();
	}

	const int32 PaddedBrickSize = VolumetricLightmapSettings.BrickSize + 1;
	TArray<const FImportedVolumetricLightmapBrick*>& HighestDensityBricks = BricksByDepth[VolumetricLightmapSettings.MaxRefinementLevels - 1];

	const uint64 BrickSizeBytes = VoxelSizeBytes * PaddedBrickSize * PaddedBrickSize * PaddedBrickSize;
	const uint64 MaxBrickBytes = static_cast<uint64>(MaximumBrickMemoryMb * 1024 * 1024);
	check(FMath::DivideAndRoundUp(MaxBrickBytes, BrickSizeBytes) <= 0x7FFFFFFFull);
	const int32 NumBricksBudgeted = (int32)FMath::DivideAndRoundUp(MaxBrickBytes, BrickSizeBytes);
	const int32 NumBricksToRemove = FMath::Clamp<int32>(NumBricksBeforeTrimming - NumBricksBudgeted, 0, HighestDensityBricks.Num());

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

Scope (from outer to inner):

file
function     void BuildIndirectionTexture

Source code excerpt:

	int32 BrickAllocation = 0;

	for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
	{
		const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];

		for (int32 BrickIndex = 0; BrickIndex < BricksAtCurrentDepth.Num(); BrickIndex++)
		{
			const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];

			if (CurrentDepth == VolumetricLightmapSettings.MaxRefinementLevels - 1)
			{
				const FGuid PersistentLevelGuid = FGuid(0, 0, 0, 0);

				// Skip non-intersecting, bottom detailed bricks for persistent level
				if (bOnlyBuildForPersistentLevel && Brick.IntersectingLevelGuid != PersistentLevelGuid)
				{

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

Scope (from outer to inner):

file
function     void BuildIndirectionTexture

Source code excerpt:

			checkSlow(IndirectionTextureDataStride == sizeof(uint8) * 4);

			const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - Brick.TreeDepth) * BrickSizeLog2);
			const int32 NumBottomLevelBricks = DetailCellsPerCurrentLevelBrick / VolumetricLightmapSettings.BrickSize;
			check(NumBottomLevelBricks < MaxBricksInLayoutOneDim);

			for (int32 Z = 0; Z < NumBottomLevelBricks; Z++)
			{
				for (int32 Y = 0; Y < NumBottomLevelBricks; Y++)

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:


	TArray<TArray<const FImportedVolumetricLightmapBrick*>> BricksByDepth;
	BricksByDepth.Empty(VolumetricLightmapSettings.MaxRefinementLevels);
	BricksByDepth.AddDefaulted(VolumetricLightmapSettings.MaxRefinementLevels);

	for (int32 TaskDataIndex = 0; TaskDataIndex < TaskDataArray.Num(); TaskDataIndex++)
	{
		const FImportedVolumetricLightmapTaskData& TaskData = TaskDataArray[TaskDataIndex];

		for (int32 BrickIndex = 0; BrickIndex < TaskData.Bricks.Num(); BrickIndex++)

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

	int32 BrickTextureLinearAllocator = 0;

	for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
	{
		const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];
		BrickTextureLinearAllocator += BricksAtCurrentDepth.Num();
	}

	FIntVector BrickLayoutDimensions;

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:


	const int32 BrickSizeLog2 = FMath::FloorLog2(BrickSize);
	const int32 DetailCellsPerTopLevelBrick = 1 << (VolumetricLightmapSettings.MaxRefinementLevels * BrickSizeLog2);
	const int32 IndirectionCellsPerTopLevelCell = DetailCellsPerTopLevelBrick / BrickSize;

	int32 IndirectionTextureDataStride;
	{
		CurrentLevelData.IndirectionTextureDimensions = VolumetricLightmapSettings.TopLevelGridSize * IndirectionCellsPerTopLevelCell;
		CurrentLevelData.IndirectionTexture.Format = PF_R8G8B8A8_UINT;

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

	int32 BrickStartAllocation = 0;

	for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
	{
		const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];

		for (int32 BrickIndex = 0; BrickIndex < BricksAtCurrentDepth.Num(); BrickIndex++)
		{
			const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:


		// Compute the allocation start for the highest density level bricks
		for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels - 1; CurrentDepth++)
		{
			BrickStartAllocation += BricksByDepth[CurrentDepth].Num();
		}

		TArray<const FImportedVolumetricLightmapBrick*>& HighestDensityBricks = BricksByDepth[VolumetricLightmapSettings.MaxRefinementLevels - 1];

		// Need to double buffer bInsideGeometry as it is both read and written
		TArray<Lightmass::FIrradianceVoxelImportProcessingData> NewVoxelImportProcessingData = VoxelImportProcessingData;

		// Reads from unique data of any density bricks, writes to unique data
		// This is doing a filter in-place, which is only reliable because source and dest voxels are mutually exclusive

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

			HighestDensityBricks,
			BrickStartAllocation,
			VolumetricLightmapSettings.MaxRefinementLevels - 1,
			BrickLayoutDimensions,
			VolumetricLightmapSettings,
			CurrentLevelData,
			VoxelImportProcessingData,
			NewVoxelImportProcessingData);

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

	BrickStartAllocation = 0;

	for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
	{
		const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];

		if (bStitchDetailBricksWithLowDensityNeighbors && CurrentDepth > 0)
		{
			// Reads from both unique and padding data of lower density bricks, writes to unique data

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:


	{
		for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
		{
			const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];

			for (int32 BrickIndex = 0; BrickIndex < BricksAtCurrentDepth.Num(); BrickIndex++)
			{
				const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

				FGuid LevelGuid;

				if (CurrentDepth == VolumetricLightmapSettings.MaxRefinementLevels - 1)
				{
					LevelGuid = Brick.IntersectingLevelGuid;
				}
				else
				{
					// Top level bricks are put into persistent level

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

		BrickStartAllocation = 0;

		for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
		{
			const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];

			for (int32 BrickIndex = 0; BrickIndex < BricksAtCurrentDepth.Num(); BrickIndex++)
			{
				const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

				FGuid LevelGuid;

				if (CurrentDepth == VolumetricLightmapSettings.MaxRefinementLevels - 1)
				{
					LevelGuid = Brick.IntersectingLevelGuid;
				}
				else
				{
					// Top level bricks are put into persistent level

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:


		{
			for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
			{
				const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];

				for (int32 BrickIndex = 0; BrickIndex < BricksAtCurrentDepth.Num(); BrickIndex++)
				{
					const FImportedVolumetricLightmapBrick& Brick = *BricksAtCurrentDepth[BrickIndex];

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

					FGuid LevelGuid;

					if (CurrentDepth == VolumetricLightmapSettings.MaxRefinementLevels - 1)
					{
						LevelGuid = Brick.IntersectingLevelGuid;
					}
					else
					{
						// Top level bricks are put into persistent level

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

		int32 TotalNumBricks = 0;

		for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
		{
			const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];
			TotalNumBricks += BricksAtCurrentDepth.Num();
		}

		const uint64 ActualBrickSizeBytes = BrickDataSize / TotalNumBricks;

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

Scope (from outer to inner):

file
function     void FLightmassProcessor::ImportVolumetricLightmap

Source code excerpt:

		const float TotalVolume = VolumetricLightmapSettings.VolumeSize.X * VolumetricLightmapSettings.VolumeSize.Y * VolumetricLightmapSettings.VolumeSize.Z;

		for (int32 CurrentDepth = 0; CurrentDepth < VolumetricLightmapSettings.MaxRefinementLevels; CurrentDepth++)
		{
			const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - CurrentDepth) * BrickSizeLog2);
			const FVector CurrentDepthBrickSize = DetailCellSize * DetailCellsPerCurrentLevelBrick;
			const TArray<const FImportedVolumetricLightmapBrick*>& BricksAtCurrentDepth = BricksByDepth[CurrentDepth];
			const double CurrentDepthBrickVolume = CurrentDepthBrickSize.X * CurrentDepthBrickSize.Y * CurrentDepthBrickSize.Z;

			UE_LOG(LogVolumetricLightmapImport, Log, TEXT("         %u: %.1f%% covering %.1f%% of volume"),
				CurrentDepth,

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

Scope (from outer to inner):

file
function     void FLightmassExporter::SetVolumetricLightmapSettings

Source code excerpt:


	VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.VolumetricLightmaps"), TEXT("BrickSize"), OutSettings.BrickSize, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetInt(TEXT("DevOptions.VolumetricLightmaps"), TEXT("MaxRefinementLevels"), OutSettings.MaxRefinementLevels, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.VolumetricLightmaps"), TEXT("VoxelizationCellExpansionForSurfaceGeometry"), OutSettings.VoxelizationCellExpansionForSurfaceGeometry, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.VolumetricLightmaps"), TEXT("VoxelizationCellExpansionForVolumeGeometry"), OutSettings.VoxelizationCellExpansionForVolumeGeometry, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.VolumetricLightmaps"), TEXT("VoxelizationCellExpansionForLights"), OutSettings.VoxelizationCellExpansionForLights, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.VolumetricLightmaps"), TEXT("MinBrickError"), OutSettings.MinBrickError, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetFloat(TEXT("DevOptions.VolumetricLightmaps"), TEXT("SurfaceLightmapMinTexelsPerVoxelAxis"), OutSettings.SurfaceLightmapMinTexelsPerVoxelAxis, GLightmassIni));
	VERIFYLIGHTMASSINI(GConfig->GetBool(TEXT("DevOptions.VolumetricLightmaps"), TEXT("bCullBricksBelowLandscape"), OutSettings.bCullBricksBelowLandscape, GLightmassIni));

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

Scope (from outer to inner):

file
function     void FLightmassExporter::SetVolumetricLightmapSettings

Source code excerpt:


	OutSettings.BrickSize = FMath::RoundUpToPowerOfTwo(OutSettings.BrickSize);
	OutSettings.MaxRefinementLevels = FMath::Clamp(OutSettings.MaxRefinementLevels, 1, 6);
	OutSettings.VoxelizationCellExpansionForSurfaceGeometry = FMath::Max(OutSettings.VoxelizationCellExpansionForSurfaceGeometry, 0.0f);
	OutSettings.VoxelizationCellExpansionForVolumeGeometry = FMath::Max(OutSettings.VoxelizationCellExpansionForVolumeGeometry, 0.0f);
	OutSettings.VoxelizationCellExpansionForLights = FMath::Max(OutSettings.VoxelizationCellExpansionForLights, 0.0f);

	const float TargetDetailCellSize = WorldInfoSettings.VolumetricLightmapDetailCellSize;

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

Scope (from outer to inner):

file
function     void FLightmassExporter::SetVolumetricLightmapSettings

Source code excerpt:


	const int32 BrickSizeLog2 = FMath::FloorLog2(OutSettings.BrickSize);
	const int32 DetailCellsPerTopLevelBrick = 1 << (OutSettings.MaxRefinementLevels * BrickSizeLog2);

	OutSettings.TopLevelGridSize = FIntVector::DivideAndRoundUp(FullGridSize, DetailCellsPerTopLevelBrick);

	OutSettings.VolumeSize = FVector3f(OutSettings.TopLevelGridSize) * DetailCellsPerTopLevelBrick * TargetDetailCellSize;
}

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/AdaptiveVolumetricLightmap.cpp:291

Scope (from outer to inner):

file
namespace    Lightmass
function     bool FStaticLightingSystem::ShouldRefineVoxel

Source code excerpt:

	}

	const int32 CandidateMipLevel = VolumetricLightmapSettings.MaxRefinementLevels - TreeDepth - 1;

	if (CandidateMipLevel < AllowedMipRange.X)
	{
		return false;
	}

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/AdaptiveVolumetricLightmap.cpp:461

Scope (from outer to inner):

file
namespace    Lightmass
function     void FStaticLightingSystem::RecursivelyBuildBrickTree

Source code excerpt:


	const int32 BrickSizeLog2 = FMath::FloorLog2(VolumetricLightmapSettings.BrickSize);
	const int32 DetailCellsPerTopLevelBrick = 1 << (VolumetricLightmapSettings.MaxRefinementLevels * BrickSizeLog2);
	const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - TreeDepth) * BrickSizeLog2);
	const float InvBrickSize = 1.0f / VolumetricLightmapSettings.BrickSize;
	const int32 NumCellsPerBrick = VolumetricLightmapSettings.BrickSize * VolumetricLightmapSettings.BrickSize * VolumetricLightmapSettings.BrickSize;

	// Assume children are present if we are only processing a portion of the brick
	bool bHasChildren = StartCellIndex > 0;

	if (TreeDepth + 1 < VolumetricLightmapSettings.MaxRefinementLevels)
	{
		const int32 DetailCellsPerChildLevelBrick = DetailCellsPerCurrentLevelBrick / VolumetricLightmapSettings.BrickSize;
		const FVector3f BrickNormalizedMin = (FVector3f)LocalCellCoordinate / (float)DetailCellsPerTopLevelBrick;
		const FVector3f WorldBrickMin = TopLevelCellBounds.Min + BrickNormalizedMin * TopLevelCellBounds.GetSize();
		const FVector3f WorldChildCellSize = InvBrickSize * TopLevelCellBounds.GetSize() * DetailCellsPerCurrentLevelBrick / (float)DetailCellsPerTopLevelBrick;

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/AdaptiveVolumetricLightmap.cpp:559

Scope (from outer to inner):

file
namespace    Lightmass
function     void FStaticLightingSystem::ProcessVolumetricLightmapBrickTask

Source code excerpt:

	const int32 BrickSize = VolumetricLightmapSettings.BrickSize;
	const int32 BrickSizeLog2 = FMath::FloorLog2(BrickSize);
	const int32 DetailCellsPerTopLevelBrick = 1 << (VolumetricLightmapSettings.MaxRefinementLevels * BrickSizeLog2);
	const int32 IndirectionCellsPerTopLevelCell = DetailCellsPerTopLevelBrick / BrickSize;

	const float InvBrickSize = 1.0f / BrickSize;
	const int32 TotalBrickSize = BrickSize * BrickSize * BrickSize;
	const FIntVector IndirectionTextureDimensions = VolumetricLightmapSettings.TopLevelGridSize * IndirectionCellsPerTopLevelCell;

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/AdaptiveVolumetricLightmap.cpp:594

Scope (from outer to inner):

file
namespace    Lightmass
function     void FStaticLightingSystem::ProcessVolumetricLightmapBrickTask

Source code excerpt:

	const FVector3f BrickNormalizedMin = (FVector3f)BuildData.LocalCellCoordinate / (float)DetailCellsPerTopLevelBrick;
	const FVector3f WorldBrickMin = TopLevelBrickMin + BrickNormalizedMin * TopLevelBrickSize;
	const int32 DetailCellsPerCurrentLevelBrick = 1 << ((VolumetricLightmapSettings.MaxRefinementLevels - BuildData.TreeDepth) * BrickSizeLog2);
	const FVector3f WorldChildCellSize = InvBrickSize * TopLevelBrickSize * DetailCellsPerCurrentLevelBrick / (float)DetailCellsPerTopLevelBrick;
	const int32 NumBottomLevelBricks = DetailCellsPerCurrentLevelBrick / BrickSize;
	const float BoundarySize = NumBottomLevelBricks * InvBrickSize;

	FLMRandomStream RandomStream(0);
	float AverageClosestGeometryDistance = 0;

#Loc: <Workspace>/Engine/Source/Programs/UnrealLightmass/Private/Lighting/AdaptiveVolumetricLightmap.cpp:632

Scope: file

Source code excerpt:

				const bool bDebugSamples = bDebugVolumetricLightmapCell 
					&& BuildData.bDebugBrick
					&& BuildData.TreeDepth == VolumetricLightmapSettings.MaxRefinementLevels - 1
					&& DebugWorldPosition.X >= VoxelPosition.X && DebugWorldPosition.Y >= VoxelPosition.Y && DebugWorldPosition.Z >= VoxelPosition.Z
					&& DebugWorldPosition.X < VoxelPosition.X + WorldChildCellSize.X && DebugWorldPosition.Y < VoxelPosition.Y + WorldChildCellSize.Y && DebugWorldPosition.Z < VoxelPosition.Z + WorldChildCellSize.Z;

				if (bDebugSamples)
				{
					Task->MappingContext.DebugOutput->bValid = true;

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

Scope (from outer to inner):

file
namespace    Lightmass
class        class FVolumetricLightmapSettings

Source code excerpt:


	/** Maximum number of times to subdivide bricks around geometry. */
	int32 MaxRefinementLevels;

	/** 
	 * Fraction of a cell's size to expand it by when voxelizing.  
	 * Larger values add more resolution around geometry, improving the lighting gradients but costing more memory.
	 */
	float VoxelizationCellExpansionForSurfaceGeometry;