QuadComplexityColors

QuadComplexityColors

#Overview

name: QuadComplexityColors

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of QuadComplexityColors is to define an array of linear colors used for rendering quad complexity visualization in Unreal Engine 5. This setting variable is part of the rendering system, specifically used in debug visualization modes.

The Unreal Engine subsystems that rely on this setting variable are primarily the rendering module and the engine core. It’s used in the UEngine class, which is a fundamental part of the engine, and in the post-processing passes of the renderer.

The value of this variable is set as a global config property (UPROPERTY(globalconfig)) in the UEngine class. This means it can be configured in the engine’s configuration files and potentially modified at runtime.

QuadComplexityColors interacts with other variables and systems:

  1. It’s used alongside LightComplexityColors, which serves a similar purpose for light complexity visualization.
  2. It’s used in conjunction with the NormalizedQuadComplexityValue to calculate the ComplexityScale in the visualization passes.

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

  1. The number of colors in this array affects the granularity of the quad complexity visualization.
  2. It’s used in both the main rendering path and the mobile rendering path, so changes will affect both platforms.
  3. The colors are used in a “stair” sampling method, meaning each color represents a distinct range of complexity values.

Best practices when using this variable include:

  1. Ensure the array contains enough colors to provide meaningful differentiation in the visualization.
  2. Choose colors that provide clear contrast to make complexity differences easily visible.
  3. Consider the needs of colorblind users when selecting the color palette.
  4. Be consistent with the number of colors used here and in LightComplexityColors for a coherent debugging experience.
  5. If modifying this variable, test the visualization on both desktop and mobile platforms to ensure desired results.

#Setting Variables

#References In INI files

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

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

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

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

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

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

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

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

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

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

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

#References in C++ code

#Callsites

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

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

Scope (from outer to inner):

file
class        class UEngine : public UObject , public FExec

Source code excerpt:

	/** The colors used to render quad complexity. */
	UPROPERTY(globalconfig)
	TArray<FLinearColor> QuadComplexityColors;

	/** The colors used to render light complexity. */
	UPROPERTY(globalconfig)
	TArray<FLinearColor> LightComplexityColors;

	/** The colors used to render stationary light overlap. */

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1873

Scope (from outer to inner):

file
function     void AddDebugViewPostProcessingPasses

Source code excerpt:

		case DVSM_QuadComplexity:
		{
			float ComplexityScale = 1.f / (float)(GEngine->QuadComplexityColors.Num() - 1) / NormalizedQuadComplexityValue; // .1f comes from the values used in LightAccumulator_GetResult

			FVisualizeComplexityInputs PassInputs;
			PassInputs.OverrideOutput = OverrideOutput;
			PassInputs.SceneColor = SceneColor;
			PassInputs.Colors = GEngine->QuadComplexityColors;
			PassInputs.ColorSamplingMethod = FVisualizeComplexityInputs::EColorSamplingMethod::Stair;
			PassInputs.ComplexityScale = ComplexityScale;
			PassInputs.bDrawLegend = true;

			SceneColor = AddVisualizeComplexityPass(GraphBuilder, View, PassInputs);
			break;

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:2881

Scope (from outer to inner):

file
function     void AddMobilePostProcessingPasses

Source code excerpt:

		case DVSM_QuadComplexity:
		{
			float ComplexityScale = 1.f / (float)(GEngine->QuadComplexityColors.Num() - 1) / NormalizedQuadComplexityValue; // .1f comes from the values used in LightAccumulator_GetResult

			FVisualizeComplexityInputs PassInputs;
			PassInputs.OverrideOutput = OverrideOutput;
			PassInputs.SceneColor = SceneColor;
			PassInputs.Colors = GEngine->QuadComplexityColors;
			PassInputs.ColorSamplingMethod = FVisualizeComplexityInputs::EColorSamplingMethod::Stair;
			PassInputs.ComplexityScale = ComplexityScale;
			PassInputs.bDrawLegend = true;
			PassInputs.OverrideOutput.LoadAction = View.IsFirstInFamily() ? ERenderTargetLoadAction::EClear : ERenderTargetLoadAction::ELoad;

			SceneColor = AddVisualizeComplexityPass(GraphBuilder, View, PassInputs);