Keywords: UE4, Anti-Aliasing, Temporal AA

The latest article: UE5 Anti-Aliasing Notes

How to change Anti-Aliasing method on desktop devices

Project Settings -> Engine -> Rendering -> Default Settings -> Anti-Aliasing Method.

Default Anti-Aliasing method is Temporal AA.

Post-process Anti-aliasing was removed from Post Process Volume.

How to modify parameters of Temporal AA at run-time
r.TemporalAACurrentFrameWeight 0.2
r.TemporalAASamples 4
r.Tonemapper.Sharpen 0.8 // Somewhere between 0.5 and 1.0 seems like a sweet spot.

Reference:
https://forums.unrealengine.com/development-discussion/rendering/106829-sharp-temporal-aa/page2?134157-Sharp-Temporal-AA=&viewfull=1

Switch AA method using console command
//0 = none, 1 = FXAA, 2 = TemporalAA, 3 = MSAA
r.DefaultFeature.AntiAliasing 2

Changing AA Type via Console Command
https://answers.unrealengine.com/questions/212041/view.html

How to enable Temporal AA on mobile devices

Using command:

r.MobileMSAA 1
r.DefaultFeature.AntiAliasing 2

r.MobileMSAA 1 means to disable MSAA, more details see the engine source SceneRenderTargets.cpp.

Or enable by project settings:
Project Settings -> Engine -> Rendering -> Default Settings -> Set Anti-Aliasing Method as TemporalAA.
Project Settings -> Engine -> Rendering -> Mobile -> Set Mobile MSAA as NO MSAA, and ensure that there’s no r.MobileMSAA=0 in DefaultEngine.ini.

Precautions:

  • There’s a bug in version 4.19 that Temporal AA can’t be enabled on mobile device. it works fine in version 4.18.
  • Default Anti-Aliasing method on mobile is Temporal AA.
  • TAA isn’t available on low-end mobile devices since imperfection of TAA at low frame rate.
  • If there’s an image blurring (ghost) on mobile devices while TAA was enabled on running at low frame rate, it’s caused by the poor performance. If there’re some overhead on rendering, image blurring would occurs on mobile devices.

MSAA Sample Count

Engine\Source\Runtime\Renderer\Private\PostProcess\SceneRenderTargets.cpp

static TAutoConsoleVariable<int32> CVarMSAACount(
    TEXT("r.MSAACount"),
    4,
    TEXT("Number of MSAA samples to use with the forward renderer.  Only used when MSAA is enabled in the rendering project settings.\n")
    TEXT("0: MSAA disabled (Temporal AA enabled)\n")
    TEXT("1: MSAA disabled\n")
    TEXT("2: Use 2x MSAA\n")
    TEXT("4: Use 4x MSAA")
    TEXT("8: Use 8x MSAA"),
    ECVF_RenderThreadSafe | ECVF_Scalability
    );

static TAutoConsoleVariable<int32> CVarMobileMSAA(
    TEXT("r.MobileMSAA"),
    1,
    TEXT("Use MSAA instead of Temporal AA on mobile:\n")
    TEXT("1: Use Temporal AA (MSAA disabled)\n")
    TEXT("2: Use 2x MSAA (Temporal AA disabled)\n")
    TEXT("4: Use 4x MSAA (Temporal AA disabled)\n")
    TEXT("8: Use 8x MSAA (Temporal AA disabled)"),
    ECVF_RenderThreadSafe | ECVF_Scalability
    );

我希望有个如你一般的人
如山间清爽的风
如古城温暖的光
从清晨到夜晚
由山野到书房
只要最后是你
就好
——张嘉佳 《从你的全世界路过》