SMAA – Subpixel Morphological Antialiasing integration


Answering the repeated inquiries about my SMAA integration (as seen in The Vanishing of Ethan Carter Redux), I’ve decided to put it on Github for to have a look for themselves. Licensed under MIT, which basically allows you to do whatever you want with it.

I’m not going to try to convince anyone about SMAA’s advantages or disadvantages over Epic’s temporal AA; your mileage may vary. Some information about the algorithm:

Here’s a (not really informative, TBH) comparison screenshot:

It should be noted that SMAA T2x and T+FXAA have considerably less shimmering on when in motion than FXAA, but that can’t be captured in a screenshot.

This is a fork of UE4 that sports the SMAA as a first-class anti-aliasing method citizen (i.e. appears in drop-downs etc.), along with something I’ve called T+FXAA (temporal + FXAA) as a bonus. SMAA is implemented only up to the T2x mode (temporal supersampling); predicated thresholding, S2x (spatial multisampling) and 4x/8x (spatial MS + temporal SS) remain unimplemented. There are branches for engine versions from 4.9 to 4.12.

Disclaimer: the code is offered as-is. Treat it as untested and experimental, I offer no support for it (though pull requests with improvements are welcome).

Contrary to what has been said on the stream, this is not a plugin, but a fork of the entire engine codebase. As of UE 4.12, there is no clean way to attach new nodes to the composition graph from outside the Renderer module, which is what would be required for “pluginization”.


1 Like

First post, and it’s a legendary one!

This is very cool and an often-requested . I’m sure many people will benefit from this.

Just wanted to stop by and say thanks for this, I’m glad this is public now. A lot of projects are going to benefit from this being available to them, and it’ll be interesting to see how it works compared to the TAA already in the engine.

Hopefully Epic can take it to another level and we’ll have it in 4.13 :slight_smile:

Good job!

Awesome! Can’t wait to see some comparisons between Epics Temporal AA and SMAA.

Whoa that sounds awesome!!
Finally, an alternative AA… I’m gonna be testing it very soon, thanks a ton for sharing this!

A proper, sharp AA is probably at the top of my UE4 wishlist right now. Epic really needs to do something about it… the current TAA is just bad.

Finally we have alternative AA, THX!!!

Wow, nice work! I’d love to put this up as a Community Spotlight, but it would really help to have some comparison screenshots to show on the livestream. If you have any, please post them :smiley:

Thanks, but this is just an application of the well-known algorithm by Jimenez et al., I don’t deserve any praise here.

There are comparison screenshots at the beginning of the Eurographics paper:

My fork goes as far as T2x, further modes and predication are not implemented (and would be very difficult to do in a deferred renderer).

I’m also currently updating the fork, as I apparently forgot to include some files and there is currently no temporal jitter. The mess of my backups…

Sounds exciting. I tried downloading the 4.12 branch but have run into some build issues. I’ve successfully built other branches before (VXGI, AHR) but I’m a relative newbie to the process.

I ran Setup.bat successfully.

When I run GenerateProjectFiles.bat I get the following error:

Setting up Unreal Engine 4 project files…
UnrealBuildTool Exception: System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at UnrealBuildTool.UProjectInfo.FillProjectInfo() in c:\Users\User Name\Downloads\UnrealEngine-SMAA-4.12\Engine\Source\Programs\UnrealBuildTool\System\UProjectInfo.cs:line 187
at UnrealBuildTool.UnrealBuildTool.DoPostStartupStuffThatCanAccessConfigs(String] Arguments) in c:\Users\User Name\Downloads\UnrealEngine-SMAA-4.12\Engine\Source\Programs\UnrealBuildTool\System\UnrealBuildTool.cs:line 920
at UnrealBuildTool.UnrealBuildTool.(String] Arguments) in c:\Users\User Name\Downloads\UnrealEngine-SMAA-4.12\Engine\Source\Programs\UnrealBuildTool\System\UnrealBuildTool.cs:line 1447

GenerateProjectFiles ERROR: UnrealBuildTool was unable to generate project files.

Wow! Thanks a ton for implementing this ! Doesn’t matter if it isn’t your own method, integrating it into UE4 is a big deal!! Thanks!! :slight_smile:

I took a small video comparing FXAA, SMAA, T+FXAA and Epics Temporal AA:

The compression unfortunately makes the difference between FXAA, SMAA and T+FXAA very hard to see because they all look very similar. I took the video in 1080p and uploaded it in 1440p to get a higher bitrate out of youtube for less compression loss.

I think T+FXAA almost looks 100% same like FXAA. SMAA is sharper than FXAA, it preserves more detail but it also allows more aliasing than FXAA I think (that’s not really visible in the video due to the compression).
Temporal AA looks way different than the first 3, and I think it unfortunately still is the best. It blurs the scene a bit, but it allows no aliasing at all.

I basically did the test in a worst case scenario for AA, a lot of fast moving foliage. Accurate Velocities from Vertex Deformation was enabled of course.

Even at 1440p on a 1440p display, compression kills the comparison video.

Maybe some zoomed in screen shots will be better? Although Temporal AA looks a lot better in motion. I know a lot of people complain about Epics temporal AA’s blurriness, and as an artist, I hate it in screen shots, but I love how it looks in motion. It’s nothing resolution scaling can’t fix for screen shots or captured videos.

Thanks for sharing! Unfortunately, I have build issues in Visual Studio. Setup and GenerateProjectFiles stages completed successfully. Here is the list of errors
Severity Code Description Project File Line Suppression State
Error C2660 ‘FRenderTargetPool::FindFreeElement’: function does not take 3 arguments UE4 E:\UnrealEngine-SMAA-4.12\Engine\Source\Runtime\Renderer\Private\PostProcess\PostProcessSMAA.cpp 851
Error C2660 ‘FRenderTargetPool::FindFreeElement’: function does not take 3 arguments UE4 E:\UnrealEngine-SMAA-4.12\Engine\Source\Runtime\Renderer\Private\PostProcess\PostProcessSMAA.cpp 863
Error C2660 ‘FRenderTargetPool::FindFreeElement’: function does not take 3 arguments UE4 E:\UnrealEngine-SMAA-4.12\Engine\Source\Runtime\Renderer\Private\PostProcess\PostProcessSMAA.cpp 877
Error C2660 ‘FRenderTargetPool::FindFreeElement’: function does not take 3 arguments UE4 E:\UnrealEngine-SMAA-4.12\Engine\Source\Runtime\Renderer\Private\PostProcess\PostProcessSMAA.cpp 889
Error C2660 ‘FRenderTargetPool::FindFreeElement’: function does not take 3 arguments UE4 E:\UnrealEngine-SMAA-4.12\Engine\Source\Runtime\Renderer\Private\PostProcess\PostProcessSMAA.cpp 1107
Error Failed to produce item: E:\UnrealEngine-SMAA-4.12\Engine\Binaries\Win64\UE4Editor-Renderer.dll UE4 e:\UnrealEngine-SMAA-4.12\Engine\Intermediate\ProjectFiles\ERROR 1
Error MSB3075 The command “…\Build\BatchFiles\Build.bat UE4Editor Win64 Development -waitmutex” exited with code 5. Please verify that you have sufficient rights to run this command. UE4 C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets 37


I met this problem.

To #14, i fixed it by adding extra variable “” for the first param in the cpp.
GRenderTargetPool.FindFreeElement(Context.RHICmdList, RenderTargetDesc, EdgePRT, RenderTargetDesc.DebugName);

@thejturner: No idea what that is, never happened to me.
@Yura_s: Yeah, I’ve just noticed and pushed a fix. Go ahead and pull the new commit in. I never really tested it beyond 4.9. Now it should work in 4.11+.
[MENTION=8] [/MENTION]: Apart from the video that created, I’ve also added a zoomed-in comparison in the original post.
[MENTION=24522][/MENTION]: Thanks for making the video, your results are in line with what I had expected. That’s why I was not going to do any convincing and/or preaching. :slight_smile:

Awesome! Thanks so much for that :smiley: This is really great. I don’t know if I can convince you to make a PR for it, but I’m sure our developers would appreciate the contribution. :wink:

Thanks, but I’m not convinced about that. :wink: The code is not up to Epic’s standards, so the PR would need a lot of work that I’m not willing to do, as I don’t see it as providing enough value.

Don’t want to be a killjoy here, but seriously guys, I’m only sharing it because so many people ask. Personally, I think Epic’s TAA is way superior in almost every aspect.

If it is, then how come so many people report bunch of artifacts using TAA ? (maybe they are not using TAA correctly, I don’t know, but just looking at those issues it seems TAA is limited to what environments it can be used with)

In fact, ue taa removes aliasing completely. Some people doesn’t like “soft” look of the level, but it’s rather subjective thing. The problem there is ghosting. If Epics will find some way to remove it completely or reduce to some acceptable level (actually, Doom has great taa, but some amount of ghosting remains), their solution will be really the best in the industry. For now it works pretty bad for levels with contrast noisy/moving environments (contrast asphalt, foliage etc)
It doesn’t seem that Epics will add smaa to the engine. According to this presentation they’ve abandoned it long time ago in favor of temporal aa.