r.AntiAliasingMethod

r.AntiAliasingMethod

#Overview

name: r.AntiAliasingMethod

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

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.AntiAliasingMethod is to control the anti-aliasing technique used in the rendering system of Unreal Engine 5. It allows developers to specify which anti-aliasing method should be applied to smooth out jagged edges in rendered images.

This setting variable is primarily used by the rendering subsystem of Unreal Engine. It’s referenced in the Engine module, the MovieRenderPipeline plugin, and the FunctionalTesting module, indicating its importance across different areas of the engine.

The value of this variable is set through the console variable system. It can be modified at runtime or set in configuration files. The default value is 4, as seen in the SceneView.cpp file.

This variable interacts with other rendering-related variables, such as r.MSAACount, which determines the level of multi-sample anti-aliasing when MSAA is selected.

Developers should be aware that:

  1. The variable accepts integer values from 0 to 3, each representing a different anti-aliasing method.
  2. The chosen method can impact performance and visual quality.
  3. Some methods may not be available in all rendering contexts (e.g., MSAA is only available in the desktop forward renderer).

Best practices when using this variable include:

  1. Choose the appropriate method based on your project’s performance requirements and visual goals.
  2. Test the visual impact and performance of different methods in various scenarios.
  3. Consider allowing end-users to adjust this setting for performance optimization on different hardware.
  4. Be aware that changing this setting may require adjustments to other related rendering settings for optimal results.
  5. Use the appropriate method for your target platforms, as some methods may not be supported on all devices.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultEngine.ini:113, section: [/Script/Engine.RendererSettings]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:211

Scope: file

Source code excerpt:

// see EAntiAliasingMethod
static TAutoConsoleVariable<int32> CVarDefaultAntiAliasing(
	TEXT("r.AntiAliasingMethod"),
	4,
	TEXT("Engine default (project setting) for AntiAliasingMethod is (postprocess volume/camera/game setting still can override)\n")
	TEXT(" 0: off (no anti-aliasing)\n")
	TEXT(" 1: Fast Approximate Anti-Aliasing (FXAA)\n")
	TEXT(" 2: Temporal Anti-Aliasing (TAA)\n")
	TEXT(" 3: Multisample Anti-Aliasing (MSAA, Only available on the desktop forward renderer)\n")

#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineUtils.cpp:111

Scope (from outer to inner):

file
namespace    UE
namespace    MovieRenderPipeline
function     EAntiAliasingMethod GetEffectiveAntiAliasingMethod

Source code excerpt:

			EAntiAliasingMethod AntiAliasingMethod = EAntiAliasingMethod::AAM_None;

			IConsoleVariable* AntiAliasingCVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.AntiAliasingMethod"));
			if (AntiAliasingCVar)
			{
				int32 Value = AntiAliasingCVar->GetInt();
				if (Value >= 0 && Value < AAM_MAX)
				{
					AntiAliasingMethod = (EAntiAliasingMethod)Value;

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:239

Scope (from outer to inner):

file
function     FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup

Source code excerpt:


FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup()
	: DefaultFeature_AntiAliasing(TEXT("r.AntiAliasingMethod"))
	, DefaultFeature_AutoExposure(TEXT("r.DefaultFeature.AutoExposure"))
	, DefaultFeature_MotionBlur(TEXT("r.DefaultFeature.MotionBlur"))
	, MotionBlurQuality(TEXT("r.MotionBlurQuality"))
	, ScreenSpaceReflectionQuality(TEXT("r.SSR.Quality"))
	, EyeAdaptationQuality(TEXT("r.EyeAdaptationQuality"))
	, ContactShadows(TEXT("r.ContactShadows"))

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneUtils.cpp:86

Scope (from outer to inner):

file
function     EAntiAliasingMethod GetDefaultAntiAliasingMethod

Source code excerpt:

	else
	{
		static auto* DefaultAntiAliasingCvar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AntiAliasingMethod"));
		AntiAliasingMethod = EAntiAliasingMethod(FMath::Clamp<int32>(DefaultAntiAliasingCvar->GetValueOnAnyThread(), 0, AAM_MAX));
	}

	if (AntiAliasingMethod == AAM_MAX)
	{
		ensureMsgf(false, TEXT("Unknown anti-aliasing method."));

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RendererScene.cpp:1369

Scope (from outer to inner):

file
function     static void UpdateEarlyZPassModeCVarSinkFunction

Source code excerpt:

static void UpdateEarlyZPassModeCVarSinkFunction()
{
	static auto* CVarAntiAliasingMethod = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.AntiAliasingMethod"));
	static auto* CVarMSAACount = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MSAACount"));
	static int32 CachedAntiAliasingMethod = CVarAntiAliasingMethod->GetValueOnGameThread();
	static int32 CachedMSAACount = CVarMSAACount->GetValueOnGameThread();
	static int32 CachedEarlyZPass = CVarEarlyZPass.GetValueOnGameThread();
	static int32 CachedBasePassWriteDepthEvenWithFullPrepass = CVarBasePassWriteDepthEvenWithFullPrepass.GetValueOnGameThread();