
R&D: Morphological Antialiasing
Written by IntrinsicI've long thought that there must be a way to accomplish a post-rendering antialiasing (removing of jagged edges) on videoframes, and from time to time I have been searching for this, I recently found this research paper by Alexander Reshetov at Intel Labs on MLAA (Morphological Antialiasing), implementations for CPU and GPU are out there and it is pretty neat!
![]() |
![]() |
![]() |
Antialiasing/smoothing of edges might be nice for VJing since output is large scale w/projector, still as mentioned underneath, there is a performance hit on CPU processing with this one, nevertheless I decided to make another FREE FreeFrame 1.0/CPU plugin (see attachment to this article at the bottom) for MLAA processing. I will look into making a GPU version sometime too, and might add an FFGL to the download, sorry to say this one is also PC Only, due to proprietary tech not implemented by me, I've just integrated it into a FreeFrame plugin basically, with some parameter control, ++. I am hoping to add some free releases for Mac too, it will come!

Back to describing the process, in short it is detecting shapes and making semi-intelligent assumptions to whether edges are present that needs to be antialiased (smoothed), this nice article shows the effect on scaled up images: http://www.realtimerendering.com/blog/morphological-antialiasing/
MLAA Processing Results:
Note: There is definitely a substantial performance hit, the CPU plugin reduced framerate in my VJ app here by about 40%, maybe this plugin would be interesting mainly for users of the effect plugins for (pre-)rendering. Here are some screenshots, pure CPU rendered, not from GPU/OpenGL output:

Without processing - intentional pixelated font and logo, and me on webcam!

One pass MLAA processing - On the text it is easy to see results, but all hard-edged areas are processed:

..as you can see here, this is the "Visualize" output, showing which pixels are actually being smoothed.

The last part is processed with the parameter nr. 5 (use full alpha) which makes the MLAA smooth the whole image. I included this parameter since it might be fast and useablle in some cases, where this is what you want, full smoothing (as an alternative to f.ex. gaussian blur).
There are also GPU versions that are said to perform well realtime. One programmed for DirectX9 and DirectX10 can be found here: http://www.iryoku.com/mlaa/
Another article on MLAA here, with an OpenGL / GLSL demo + sourcecode down the page: http://www.geeks3d.com/20101023/tips-what-is-the-morphological-anti-aliasing-mlaa/ ..which perhaps could be made into a FreeFrameGL plugin, something I might look into! Athough newer graphics cards do, as stated in this article, have some hardware implementation of this tech, so for realtime if using OpenGL, a freeframe would only be good for deciding to turn off-on runtime, unless an app implements that control internally, well well..
There are some alternative technologies: Specially for high contrast images, tracing jagged input into vector smoothness, that I wish to look more into too:
Potrace
A tool you might find useful as it is, here is a sample before/after from Peter Selinger using Potrace:
Potrace homepage: http://potrace.sourceforge.net/ and more samples here: http://potrace.sourceforge.net/samples.html ..the project homepage also have links to assorted GUI implementations and more.
Thoughts on using MLAA
I was first thinking this MLAA processing would be a nice optional quality rendering setting for CPU plugins that have issues when processing at lower resolutions, it could give improved results and rendering speed compared to doing your own supersampling since the quality seems close.
It might be too much of a performance hit in realtime VJ use (unless using a fast computer), but with f.ex. ffrend and other apps that do video-editing/rendering, this could be a nice additional parameter to be able to set for these plugins, but it would require a huge job putting it into all plugins where it could be useful..
..so I decided to just release this FREE plugin attached underneath, to do the job. It can also be used as-is for processing any lineart or video where results could improve final output, go ahead and test it :) FYI: This was a tiny procrastination project that I got a bit carried away with, at least another free download came from it :)







