Digital Foundry: The Future of Anti-Aliasing
Cutting edges.
FXAA is already gathering plenty of support, with earlier versions of the technique having been implemented in Crysis 2 and Duke Nukem Forever, both on PC. Indie developer Keith Judge, who previously worked on games including Burnout titles Revenge and Paradise, and the Xbox 360 Fable titles, is currently implementing FXAA into his debut, so far unannounced PC title. He's really impressed with the technique's impact on his game.
"The main reason I prefer it over MSAA is that it makes deferred rendering simpler, even though MSAA can achieve better quality with enough samples, especially on long nearly horizontal/vertical edges," he says.
"I'm using DX11 which - in theory - fixed those issues as you can gather individual MSAA colour/depth samples within the shader when lighting, but I want to support as wide a range of hardware as possible using the DX11 feature levels system (for example, my DX10 GeForce 8800, which can't do that) so MSAA is out. I might have used MLAA, but the quality isn't as good - there's a lot of aliasing with sub-pixel features, especially in motion as you've noticed on some of your PS3 tech analyses."
What MLAA and FXAA have in common is that they are post-process filters. They only look at the image being processed as a flat, 2D framebuffer – the final image you see beamed to the HDTV (though generally speaking, processing before the HUD is added is a very good idea). It is the key to the speed and resource-light advantages of both techniques - and good for us, because we can simply apply the filters to pre-existing video captures to demonstrate before and after comparisons. However, in-game it can cause artifacts too, and actually emphasises sub-pixel edges for the reasons Alex Fry mentioned earlier. The cityscapes in Killzone 3 and Shift 2, and the MotorStorm Apocalypse intro, are good examples of the issues you simply wouldn't get with a traditional multi-sampling approach.
"Common to all anti-aliasing filters out there, if you are working at final display resolution (1x), pixel-popping is going to happen sooner or later," explains Team Jimenez.
"You can try attenuating or eliminating 'spurious' pixels, but we think that this is not the optimum solution since it doesn't tackle the root of the problem: sub-sampling. As we said before, we're really conservative with the image, so we avoid introducing additional steps that don't always work, and so they can negatively affect temporal coherence."
As you'll see in our test footage, the difference between FXAA and Jimenez MLAA is quite remarkable. Both smooth the jaggies, but Jimenez MLAA appears to apply a much lighter touch to the overall image quality than what we've seen in other implementations. If you want to retain pin-sharp quality but benefit from superb edge-smoothing, the MLAA solution does indeed look fantastic. For its part, FXAA can perform wonders with "noisy", high-frequency images. Need for Speed: Hot Pursuit and Enslaved in particular fare very well indeed, giving that "filmic" look Timothy Lottes describes to the entire scene.
What we have in this case are two very different solutions, perhaps suited to different aesthetic looks. However, as Lottes says, FXAA console is considerably less resource-intensive, operating at around 1ms on Xbox 360, while Jimenez MLAA is currently at 2.4ms (earlier estimates at the 1.3ms range proved to be inaccurate) though the team reckons that this can be brought down with further optimisation efforts.
However, the fact that the post-process filters are simply addressing a final, rendered image will always present some disadvantages. This is perhaps most dramatically demonstrated by checking out this video of the Far Cry 2 benchmarking run on PC. Here we've run Jimenez MLAA and FXAA console through the base "no AA" video, then re-run the tests with increasingly higher MSAA levels. Note the amount of vegetation in the scene: a mass of sub-pixel detailing that becomes progressively better filtered the higher the level of multi-sampled anti-aliasing. This kind of processing simply can't be match by any real-time post processing filter. The test itself may be considered rather extreme, but it does demonstrate how multi-sampling makes a big difference.
"We think the next step involves hybrid approaches combining MSAA (with low sample counts) with filter-based anti-aliasing techniques," says the Jimenez MLAA team.
"This would allow having a good trade-off between sub-pixel features, smooth gradients and low processing time."
Timothy Lottes has been doing some experiments of his own involving super-sampling working in concert with FXAA. Super-sampling is pretty much the best form of anti-aliasing you can get: rendering an image internally at a much higher resolution then downscaling to the output framebuffer: the higher the internal resolution, the better the downscaled result. According to Lottes, the resolution needn't be that much higher if FXAA is introduced into the equation.
"Applying FXAA before downscaling and averaging samples increases the quality of super-sampling, and with FXAA, fractional super-sampling works quite well: even when rendering only 1.7 times the number of pixels," he explains.
"This enables the common deferred shading based game engine to transparently scale pixel quality along with GPU performance without going through the complexity of adding the variable rate shading required with hardware multi-sampling to maintain performance. An exciting real-world application would be for a game to limit itself to 60Hz on the PC but use the left-over GPU processing power to increase pixel quality using dynamic fractional super-sampling with FXAA."