ShowFlag.AntiAliasing

ShowFlag.AntiAliasing

#Overview

name: ShowFlag.AntiAliasing

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

It is referenced in 18 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.AntiAliasing is to control the visibility of anti-aliasing effects in the rendering pipeline of Unreal Engine 5. Anti-aliasing is a technique used to reduce jagged edges (aliasing) in rendered images, resulting in smoother and more visually appealing graphics.

This setting variable is primarily used in the rendering system of Unreal Engine. It is referenced in various subsystems and modules, including:

  1. The core Engine module
  2. The Composure plugin
  3. The Water plugin
  4. The MovieRenderPipeline plugin
  5. The MeshModelingToolset plugin
  6. The nDisplay plugin
  7. The FunctionalTesting module
  8. The UnrealEd module

The value of this variable is typically set through the engine’s show flags system, which allows for runtime toggling of various rendering features. It can be modified programmatically or through the engine’s user interface.

The ShowFlag.AntiAliasing variable interacts with other related variables, such as TemporalAA. When AntiAliasing is enabled, the engine may use either FXAA (Fast Approximate Anti-Aliasing) or Temporal AA, depending on the TemporalAA setting.

Developers should be aware that:

  1. Disabling anti-aliasing can improve performance but may result in lower image quality.
  2. Some rendering scenarios, like thumbnail generation or specific capture methods, may intentionally disable anti-aliasing for various reasons.
  3. The AntiAliasing flag affects multiple anti-aliasing techniques, not just a single method.

Best practices when using this variable include:

  1. Consider performance implications when enabling or disabling anti-aliasing.
  2. Be consistent in its usage across different rendering scenarios in your project.
  3. Test the visual impact of enabling/disabling anti-aliasing in different environments and on different hardware.

Regarding the associated variable AntiAliasing:

The purpose of the AntiAliasing variable is similar to ShowFlag.AntiAliasing, but it’s used in different contexts, such as in the UAutomationViewSettings class for automation testing and in the LyraGame project for user-facing graphics settings.

This variable is used in the FunctionalTesting module and in game-specific settings implementations. It allows for more granular control over anti-aliasing settings, including the ability to offer different quality levels to the user.

The value of this variable is typically set through game settings interfaces or automation tools. It may be exposed to end-users as a graphics quality option.

Developers should be aware that:

  1. This variable may need to be synced with the engine’s show flags for consistent behavior.
  2. It can be used to provide more detailed anti-aliasing options to users, such as Off, Low, Medium, High quality settings.

Best practices include:

  1. Providing clear descriptions of what each anti-aliasing quality level means in terms of visual improvement and performance impact.
  2. Ensuring that changes to this setting are properly applied to the rendering pipeline.
  3. Consider platform-specific limitations when exposing anti-aliasing options to users.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:27

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, Tonemapper, SFG_PostProcess, NSLOCTEXT("UnrealEd", "TonemapperSF", "Tonemapper"))
/** Any Anti-aliasing e.g. FXAA, Temporal AA, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(AntiAliasing, SFG_Normal, NSLOCTEXT("UnrealEd", "AntiAliasingSF", "Anti-aliasing"))
/** Only used in AntiAliasing is on, true:uses Temporal AA, otherwise FXAA, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture  */
SHOWFLAG_ALWAYS_ACCESSIBLE(TemporalAA, SFG_Advanced, NSLOCTEXT("UnrealEd", "TemporalAASF", "Temporal AA (instead FXAA)"))
/** e.g. Ambient cube map, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(AmbientCubemap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "AmbientCubemapSF", "Ambient Cubemap"))
/** Human like eye simulation to adapt to the brightness of the view, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(EyeAdaptation, SFG_PostProcess, NSLOCTEXT("UnrealEd", "EyeAdaptationSF", "Eye Adaptation"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Compositing/Composure/Source/Composure/Private/ComposureUtils.cpp:17

Scope (from outer to inner):

file
function     void FComposureUtils::SetEngineShowFlagsForPostprocessingOnly

Source code excerpt:

	EngineShowFlags.Decals = false;
	EngineShowFlags.Translucency = false;
	EngineShowFlags.AntiAliasing = false;
	EngineShowFlags.MotionBlur = false;
	EngineShowFlags.Bloom = false;
	EngineShowFlags.EyeAdaptation = false;
	EngineShowFlags.VolumetricFog = false;
	EngineShowFlags.Atmosphere = false;
	EngineShowFlags.Fog = false;

#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterInfoRendering.cpp:649

Scope (from outer to inner):

file
namespace    UE::WaterInfo
function     static FSceneRenderer* CreateWaterInfoSceneRenderer

Source code excerpt:

	ShowFlags.Translucency = 0;
	ShowFlags.SeparateTranslucency = 0;
	ShowFlags.AntiAliasing = 0;
	ShowFlags.Fog = 0;
	ShowFlags.VolumetricFog = 0;
	ShowFlags.DynamicShadows = 0;

	ShowFlags.SetDisableOcclusionQueries(true);
	ShowFlags.SetVirtualShadowMapPersistentData(false);

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

Scope (from outer to inner):

file
function     void UMoviePipeline::TickProducingFrames

Source code excerpt:

			float WorldTimeDilation = GetWorld()->GetWorldSettings()->GetEffectiveTimeDilation();

			UMoviePipelineAntiAliasingSetting* AntiAliasing = FindOrAddSettingForShot<UMoviePipelineAntiAliasingSetting>(CurrentCameraCut);
			if (AntiAliasing->TemporalSampleCount == 1)
			{
				TicksToEndOfPreviousFrame = FrameMetrics.TicksPerOutputFrame;
			}
			else
			{
				// The first sub-frame accumulation is going to try to go forward

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

Scope (from outer to inner):

file
function     void UMoviePipeline::TickProducingFrames

Source code excerpt:

		float WorldTimeDilation = GetWorld()->GetWorldSettings()->GetEffectiveTimeDilation();

		UMoviePipelineAntiAliasingSetting* AntiAliasing = FindOrAddSettingForShot<UMoviePipelineAntiAliasingSetting>(CurrentCameraCut);
		if (AntiAliasing->TemporalSampleCount == 1)
		{
			TicksToEndOfPreviousFrame = FrameMetrics.TicksPerOutputFrame;
		}
		else
		{
			// The first sub-frame accumulation is going to try to go forward

#Loc: <Workspace>/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Private/Scene/WorldRenderCapture.cpp:698

Scope (from outer to inner):

file
function     bool FWorldRenderCapture::CaptureDeviceDepthFromPosition

Source code excerpt:


	FEngineShowFlags ShowFlags(ESFIM_Game);
	Internal::SetCommonShowFlags(ShowFlags, false); // Never use AntiAliasing so we dont blend pixels at different depths

	FSceneViewFamilyContext ViewFamily(
		FSceneViewFamily::ConstructionValues(
			RenderTargetResource,
			World->Scene,
			ShowFlags)

#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterConfigurator/Private/Views/Viewport/DisplayClusterConfiguratorSCSEditorViewportClient.cpp:65

Scope (from outer to inner):

file
function     FDisplayClusterConfiguratorSCSEditorViewportClient::FDisplayClusterConfiguratorSCSEditorViewportClient

Source code excerpt:

	SyncEditorSettings();

	EngineShowFlags.AntiAliasing = DisplayClusterSettings->bEditorEnableAA;
	EngineShowFlags.EyeAdaptation = false;
	
	//OverrideNearClipPlane(1.0f);
	bUsingOrbitCamera = true;

	//This seems to be needed to get the correct world time in the preview.

#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterConfigurator/Private/Views/Viewport/DisplayClusterConfiguratorSCSEditorViewportClient.cpp:1110

Scope (from outer to inner):

file
function     void FDisplayClusterConfiguratorSCSEditorViewportClient::ToggleEnableAA

Source code excerpt:

	UDisplayClusterConfiguratorEditorSettings* Settings = GetMutableDefault<UDisplayClusterConfiguratorEditorSettings>();
	Settings->bEditorEnableAA = !Settings->bEditorEnableAA;
	EngineShowFlags.AntiAliasing = Settings->bEditorEnableAA;
	
	Settings->PostEditChange();
	Settings->SaveConfig();
}

void FDisplayClusterConfiguratorSCSEditorViewportClient::ToggleShowPreview()

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

Scope (from outer to inner):

file
class        class FAutomationViewExtension : public FWorldSceneViewExtension
function     virtual void SetupViewFamily

Source code excerpt:

			// Turn off common show flags for noisy sources of rendering.
			FEngineShowFlags& ShowFlags = InViewFamily.EngineShowFlags;
			ShowFlags.SetAntiAliasing(ViewSettings->AntiAliasing);
			ShowFlags.SetMotionBlur(ViewSettings->MotionBlur);
			ShowFlags.SetTemporalAA(ViewSettings->TemporalAA);
			ShowFlags.SetScreenSpaceReflections(ViewSettings->ScreenSpaceReflections);
			ShowFlags.SetScreenSpaceAO(ViewSettings->ScreenSpaceAO);
			ShowFlags.SetDistanceFieldAO(ViewSettings->DistanceFieldAO);
			ShowFlags.SetContactShadows(ViewSettings->ContactShadows);

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationViewSettings.h:15

Scope (from outer to inner):

file
class        class UAutomationViewSettings : public UDataAsset
function     UAutomationViewSettings

Source code excerpt:

public:
	UAutomationViewSettings()
		: AntiAliasing(true)
		, MotionBlur(true)
		, TemporalAA(true)
		, ScreenSpaceReflections(true)
		, ScreenSpaceAO(true)
		, DistanceFieldAO(true)
		, ContactShadows(true)

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Public/AutomationViewSettings.h:28

Scope (from outer to inner):

file
class        class UAutomationViewSettings : public UDataAsset

Source code excerpt:


	UPROPERTY(EditAnywhere, Category="Rendering")
	bool AntiAliasing;
	
	UPROPERTY(EditAnywhere, Category="Rendering")
	bool MotionBlur;
	
	UPROPERTY(EditAnywhere, Category="Rendering")
	bool TemporalAA;

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/ThumbnailRendering/MaterialInstanceThumbnailRenderer.cpp:93

Scope (from outer to inner):

file
function     void UMaterialInstanceThumbnailRenderer::Draw

Source code excerpt:

			ViewFamily.EngineShowFlags.SetSeparateTranslucency(ThumbnailScene->ShouldSetSeparateTranslucency(MatInst));
			ViewFamily.EngineShowFlags.MotionBlur = 0;
			ViewFamily.EngineShowFlags.AntiAliasing = 0;

			RenderViewFamily(Canvas, &ViewFamily, ThumbnailScene->CreateView(&ViewFamily, X, Y, Width, Height));

			ThumbnailScene->SetMaterialInterface(nullptr);
		}
	}

#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/ThumbnailRendering/VolumeTextureThumbnailRenderer.cpp:167

Scope (from outer to inner):

file
function     void UVolumeTextureThumbnailRenderer::Draw

Source code excerpt:

			ViewFamily.EngineShowFlags.SetSeparateTranslucency(true);
			ViewFamily.EngineShowFlags.MotionBlur = 0;
			ViewFamily.EngineShowFlags.AntiAliasing = 0;

			RenderViewFamily(Canvas, &ViewFamily, ThumbnailScene->CreateView(&ViewFamily, X, Y, Width, Height));
		}

		ThumbnailScene->SetMaterialInterface(nullptr);
	}

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

Scope (from outer to inner):

file
function     void FSceneView::SetupAntiAliasingMethod

Source code excerpt:

		const bool bWillApplyTemporalAA = Family->EngineShowFlags.PostProcessing || bIsPlanarReflection;

		if (!bWillApplyTemporalAA || !Family->EngineShowFlags.AntiAliasing)
		{
			AntiAliasingMethod = AAM_None;
		}

		if (AntiAliasingMethod == AAM_TemporalAA)
		{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:7919

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:

			Input.DebugGroupName.ReplaceInline(TEXT("LOCAL_LIGHTS_PREPASS_ENABLED"), TEXT("LLPP"));
			Input.DebugGroupName.ReplaceInline(TEXT("PostProcess"), TEXT("Post"));
			Input.DebugGroupName.ReplaceInline(TEXT("AntiAliasing"), TEXT("AA"));
			Input.DebugGroupName.ReplaceInline(TEXT("Mobile"), TEXT("Mob"));
			Input.DebugGroupName.ReplaceInline(TEXT("Linear"), TEXT("Lin"));
			Input.DebugGroupName.ReplaceInline(TEXT("INT32_MAX"), TEXT("IMAX"));
			Input.DebugGroupName.ReplaceInline(TEXT("Policy"), TEXT("Pol"));
			Input.DebugGroupName.ReplaceInline(TEXT("EAtmRenderFlag==E_"), TEXT(""));
		}

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:634

Scope (from outer to inner):

file
function     void EngineShowFlagOverride

Source code excerpt:


#define DISABLE_ENGINE_SHOWFLAG(Name) if(Value-- >  0) EngineShowFlags.Set##Name(false);
			 DISABLE_ENGINE_SHOWFLAG(AntiAliasing)
			 DISABLE_ENGINE_SHOWFLAG(EyeAdaptation)
			 DISABLE_ENGINE_SHOWFLAG(SeparateTranslucency)
			 DISABLE_ENGINE_SHOWFLAG(DepthOfField)
			 DISABLE_ENGINE_SHOWFLAG(AmbientOcclusion)
			 DISABLE_ENGINE_SHOWFLAG(CameraImperfections)
			 DISABLE_ENGINE_SHOWFLAG(Decals)

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:27

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(1, Tonemapper, SFG_PostProcess, NSLOCTEXT("UnrealEd", "TonemapperSF", "Tonemapper"))
/** Any Anti-aliasing e.g. FXAA, Temporal AA, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(AntiAliasing, SFG_Normal, NSLOCTEXT("UnrealEd", "AntiAliasingSF", "Anti-aliasing"))
/** Only used in AntiAliasing is on, true:uses Temporal AA, otherwise FXAA, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture  */
SHOWFLAG_ALWAYS_ACCESSIBLE(TemporalAA, SFG_Advanced, NSLOCTEXT("UnrealEd", "TemporalAASF", "Temporal AA (instead FXAA)"))
/** e.g. Ambient cube map, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(AmbientCubemap, SFG_LightingFeatures, NSLOCTEXT("UnrealEd", "AmbientCubemapSF", "Ambient Cubemap"))
/** Human like eye simulation to adapt to the brightness of the view, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(EyeAdaptation, SFG_PostProcess, NSLOCTEXT("UnrealEd", "EyeAdaptationSF", "Eye Adaptation"))
/** Display a histogram of the scene HDR color */

#Loc: <Workspace>/Projects/Lyra/Source/LyraGame/Settings/LyraGameSettingRegistry_Video.cpp:437

Scope (from outer to inner):

file
function     UGameSettingCollection* ULyraGameSettingRegistry::InitializeVideoSettings

Source code excerpt:

		{
			UGameSettingValueDiscreteDynamic_Number* Setting = NewObject<UGameSettingValueDiscreteDynamic_Number>();
			Setting->SetDevName(TEXT("AntiAliasing"));
			Setting->SetDisplayName(LOCTEXT("AntiAliasing_Name", "Anti-Aliasing"));
			Setting->SetDescriptionRichText(LOCTEXT("AntiAliasing_Description", "Anti-Aliasing reduces jaggy artifacts along geometry edges. Increasing this setting will make edges look smoother, but can reduce performance. Higher settings mean more anti-aliasing."));

			Setting->SetDynamicGetter(GET_LOCAL_SETTINGS_FUNCTION_PATH(GetAntiAliasingQuality));
			Setting->SetDynamicSetter(GET_LOCAL_SETTINGS_FUNCTION_PATH(SetAntiAliasingQuality));
			Setting->AddOption(0, LOCTEXT("AntiAliasingLow", "Off"));