In my last post about SSS I mentioned having removed MSAA due to unfeasable requirements (Resolves, Memory Bandwith, not being able to use the stencil buffer).
My intention from the beginning was to focus a lot on removing(or at least reducing) this pesky thing called aliasing and it was only natural to think about recent post-processing alternatives.
So the last two days I've worked on implementing SMAA T2X (which stands for Subpixel-Morphological-Anti-Aliasing, T for temporal) and I have to say I'm pretty impressed by the results.
The algorithm consists of 4 passes (3 main passes + temporal resolve / reprojection):
1. Edge Detection (This scans the image for hard edges where there's high frequency changes / abrupt changes in e.g. contrast/luminance)
2. BlendWeightCalculation (This pass calculates which and how much of these parts/edges should be blended together <- this appear to be the main pass that does all the complicated morphological stuff)
3. Neighborhood Blend (The last main pass does the actual blending according to the weights that we've calculated before, it also combines them with the full image again).
4. Temporal Resolve/Reprojection (This last pass is needed for the temporal variant of SMAA which performs a temporal resolve or reprojection which to put it in laymans terms blends the last frame's image and the current frame's image together based on the velocity in screen-space).
For this temporal algorithm to work you have to additonally render your geometry (main pass) with a jittered projection that changes every frame and basically moves the image just a tiny bit in diagonal directions which is then combined in the last SMAA pass (temp resolve).
Now the great thing about SMAA in contrast to MSAA is that it works in a lot of places where MSAA doesn't.
MSAA only works on polygon edges which means the only thing MSAA can improve is "geometry aliasing".
SMAA on the other hand analyzes the entire image for forms of aliasing. This is especially important these days where everyone has switched to physically-based shading (and full HDR rendering) where you can sometimes get astronomical high shaded values (e.g. high glossy specular reflections) that introduces lots of so called "shader aliasing".
Then there's "the other" form of aliasing that is temporal in its nature. Example for this is the infamous carwheel that seems to stand still during motion or even move backwards. Temporal aliasing is when the sensor that captures the image can't take enough samples (pictures) in a certain amount of time so the captured signal (picture) of the wheel will look like it stood still (if sampled at an adequate rate (Nyquist rate)) or even look like its moving backwards (sampled less than Nyquist rate). There's a great article on aliasing in all its "glory" on Matt Pattineo's blog which you can find here:
Conclusion: SMAA T2X on my GPU runs at 1-2ms @720p and improves upon many forms of aliasing and even performs better geometry anti-aliasing in most cases than MSAA does. I'd call this a win.
So here's quick comparison of some screens I took to see the differences between No anti-aliasing and with SMAA T2X active (of course static images can only show so much):