LODColorationColors

LODColorationColors

#Overview

name: LODColorationColors

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of LODColorationColors is to provide a set of colors used for visualizing and debugging Level of Detail (LOD) systems within Unreal Engine 5. This variable is an array of FLinearColor values, each representing a color associated with a specific LOD level.

LODColorationColors is primarily used by the rendering system, specifically for debug visualization purposes. It is relied upon by multiple Unreal Engine subsystems and modules, including:

  1. The Hair Strands system (HairStrandsCore plugin)
  2. The Landscape system
  3. The main Renderer module

The value of this variable is set in the Engine configuration files, as indicated by the UPROPERTY(globalconfig) decorator in the UEngine class definition.

LODColorationColors interacts with other variables and systems, such as:

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

  1. The array size determines the maximum number of LOD levels that can be uniquely colored.
  2. The colors are accessed by index, which corresponds to the LOD level.
  3. When accessing the array, the index is usually clamped to prevent out-of-bounds errors.

Best practices when using LODColorationColors include:

  1. Ensure the array has enough entries to cover all LOD levels in your game.
  2. Choose visually distinct colors for each LOD level to make debugging easier.
  3. Be consistent with color assignments across different asset types (e.g., static meshes, landscapes, hair) for easier interpretation.
  4. Use this variable in conjunction with the appropriate debug view modes and engine show flags to visualize LOD levels effectively.
  5. Remember that this is primarily a debugging tool and should not be relied upon for gameplay or final visual quality.

#Setting Variables

#References In INI files

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

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

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

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

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

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

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

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

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Runtime/HairStrands/Source/HairStrandsCore/Private/GroomComponent.cpp:829

Scope: file

Source code excerpt:

						{
							int32 LODIndex = HairGroupInstances[GroupIt]->HairGroupPublicData ? HairGroupInstances[GroupIt]->HairGroupPublicData->LODIndex : 0;
							LODIndex = FMath::Clamp(LODIndex, 0, GEngine->LODColorationColors.Num() - 1);
							const FLinearColor LODColor = GEngine->LODColorationColors[LODIndex];
							HairColor = FVector(LODColor.R, LODColor.G, LODColor.B);
						}
						auto DebugMaterial = new FHairDebugModeMaterialRenderProxy(Strands_DebugMaterial ? Strands_DebugMaterial->GetRenderProxy() : nullptr, DebugModeScalar, 0, HairMaxRadius, HairColor);
						Collector.RegisterOneFrameMaterialProxy(DebugMaterial);
						Debug_MaterialProxy = DebugMaterial;
					}

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

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** The colors used to render LOD coloration. */
	UPROPERTY(globalconfig)
	TArray<FLinearColor> LODColorationColors;

	/** The colors used to render LOD coloration. */
	UPROPERTY(globalconfig)
	TArray<FLinearColor> HLODColorationColors;

	/** The colors used for texture streaming accuracy debug view modes. */

#Loc: <Workspace>/Engine/Source/Runtime/Landscape/Private/LandscapeRender.cpp:2537

Scope (from outer to inner):

file
namespace    anonymous
function     FLinearColor GetColorForLod

Source code excerpt:

	{
		int32 ColorIndex = INDEX_NONE;
		if (GEngine->LODColorationColors.Num() > 0)
		{
			ColorIndex = CurrentLOD;
			ColorIndex = FMath::Clamp(ColorIndex, 0, GEngine->LODColorationColors.Num() - 1);
		}
		const FLinearColor& LODColor = ColorIndex != INDEX_NONE ? GEngine->LODColorationColors[ColorIndex] : FLinearColor::Gray;

		if (ForcedLOD >= 0)
		{
			return LODColor;
		}

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DebugViewModeRendering.cpp:125

Scope (from outer to inner):

file
function     void SetupDebugViewModePassUniformBufferConstants

Source code excerpt:

		if (ViewInfo.Family->EngineShowFlags.LODColoration)
		{
			Colors = &(GEngine->LODColorationColors);
		}
		else if (ViewInfo.Family->EngineShowFlags.HLODColoration)
		{
			Colors = &GEngine->HLODColorationColors;
		}