r.AOOverwriteSceneColor

r.AOOverwriteSceneColor

#Overview

name: r.AOOverwriteSceneColor

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.AOOverwriteSceneColor is to control whether Ambient Occlusion (AO) should overwrite the scene color for debugging purposes in Unreal Engine’s rendering system.

This setting variable is primarily used in the rendering subsystem, specifically in the Ambient Occlusion and Reflection Environment rendering modules.

The value of this variable is set through the Unreal Engine console system, as indicated by the FAutoConsoleVariableRef declaration. It can be changed at runtime using console commands.

The associated variable GAOOverwriteSceneColor interacts directly with r.AOOverwriteSceneColor. They share the same value, with GAOOverwriteSceneColor being the C++ variable used in the code to check the setting’s state.

Developers must be aware that this variable is intended for debugging purposes. When enabled, it will cause the Ambient Occlusion to overwrite the scene color, which is not desirable for final rendering but can be useful for isolating and examining AO effects.

Best practices when using this variable include:

  1. Only enable it temporarily for debugging AO issues.
  2. Remember to disable it before final rendering or shipping the game.
  3. Use it in conjunction with other AO-related debug views for comprehensive analysis.

Regarding the associated variable GAOOverwriteSceneColor:

The purpose of GAOOverwriteSceneColor is to provide a C++ accessible flag for the r.AOOverwriteSceneColor console variable.

It is used in the rendering subsystem, specifically in the Reflection Environment rendering code.

The value of GAOOverwriteSceneColor is set by the console variable system when r.AOOverwriteSceneColor is changed.

It interacts with the GetReflectionEnvironmentCVar() function to determine the blending state for the reflection environment rendering.

Developers should be aware that changing GAOOverwriteSceneColor directly in C++ code may lead to inconsistencies with the console variable state. Always use the console variable system to modify this setting.

Best practices include:

  1. Treat GAOOverwriteSceneColor as a read-only variable in C++ code.
  2. Use the console variable r.AOOverwriteSceneColor to change its value.
  3. When debugging AO issues, check both the console variable and GAOOverwriteSceneColor to ensure they are in sync.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:99

Scope: file

Source code excerpt:

int32 GAOOverwriteSceneColor = 0;
FAutoConsoleVariableRef CVarAOOverwriteSceneColor(
	TEXT("r.AOOverwriteSceneColor"),
	GAOOverwriteSceneColor,
	TEXT(""),
	ECVF_RenderThreadSafe
	);

int32 GAOJitterConeDirections = 0;

#Associated Variable and Callsites

This variable is associated with another variable named GAOOverwriteSceneColor. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DistanceFieldAmbientOcclusion.cpp:97

Scope: file

Source code excerpt:

	);

int32 GAOOverwriteSceneColor = 0;
FAutoConsoleVariableRef CVarAOOverwriteSceneColor(
	TEXT("r.AOOverwriteSceneColor"),
	GAOOverwriteSceneColor,
	TEXT(""),
	ECVF_RenderThreadSafe
	);

int32 GAOJitterConeDirections = 0;
FAutoConsoleVariableRef CVarAOJitterConeDirections(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:1844

Scope (from outer to inner):

file
function     static void AddSkyReflectionPass
lambda-function

Source code excerpt:

		FPixelShaderUtils::InitFullscreenPipelineState(InRHICmdList, View.ShaderMap, PixelShader, GraphicsPSOInit);

		extern int32 GAOOverwriteSceneColor;
		if (GetReflectionEnvironmentCVar() == 2 || GAOOverwriteSceneColor)
		{
			// override scene color for debugging
			GraphicsPSOInit.BlendState = TStaticBlendState<>::GetRHI();
		}
		else
		{