Saturday, May 28, 2011

Morphological Anti-Aliasing (MLAA) with OpenGL ES 2 & GLSL

Managed to squeeze most of this in on the weekend, just before flying off to the Cayman Islands for some R & R... :)

The Battle Balloons rendering system now features morphological anti-aliasing (MLAA)! It is an anti-aliasing technique that works by finding vertical & horizontal edges and blending them based on the edge's length and end point conditions. The original paper by Alexander Reshetov explains this in more detail. It includes source code, but is apparently too slow for real-time rendering. God of War III is the first title I know to have taken this technique and optimized it to work in real-time (on the PlayStation 3). Jorge Jimenez and friends later published another real-time approach with DirectX/HLSL (officially called Jimenez's MLAA), which I have based my own OpenGL/GLSL implementation on.

This is actually a distraction I succumbed to while working on the level editor. It still has some bugs to iron out, but soon it will be out of the way and I can return to level editor land!

On a related note, I just found out about Timothy Lottes' FXAA technique yesterday at work. This looks even better, but I think I will hold off on implementing that... for now. Too many other things I need to get on with first.

Without MLAA: Lots of ugly, hard edges.

With MLAA: Hard edges blended/blurred together.