This thread is about getting user feedback on the new anti-aliasing compositor node. The goal is to agree on the final design from a user’s perspective before moving on to polishing the code.
Anti-Aliasing Node
The node removes distortion artefacts around edges known as aliasing.
Example:
Algorithm
The anti-aliasing node is an implementation of Enhanced Subpixel Morphological Antialiasing (SMAA) by Jimenez et al. [1]. C++ implementation and current integration in Blender was done by Shinsuke Irie [2].
It is a post-processing filter with 3 main steps. First, it finds edges and corners in the input image and classifies them according to patterns (first pass). Second it eliminates edges that are usually not perceived by the eye and therefore avoid unwanted artefacts. This step is called local contrast adaptation (second pass). Finally, anti-aliasing is achieved by blending pixels in borders detected in first step using precomputed textures (third pass).
Node interface
-
Edge detection, (find discontinuities in image based on):
- Luma
- Color (typically RGB)
- Value (also called Depth in earlier versions)
-
Threshold
Describes edge detection sensitivity across the whole image.
Example threshold 0.5 vs 0.05:
-
Local contrast adaptation factor
The human eye does not perceive all edges equally. For instance it tends to mask low contrast edges in the presence of much higher contrasts in the surrounding area. Therefore applying anti-aliasing to unperceived edges will produce artefacts.
This parameter quantifies the difference between low contrast and high contrast (neighbouring) edges.
Example 1 vs 5 (notice that only edges around eyes are affected, where neighbouring edges of higher contrast exist):
-
Corner detection
Detect corners to help preserve the original shape -
Corner rounding
Example of no corner detection vs maximum corner preservation
-
Value
This serves as an alternative input for RGB or luma, e.g. depth pass from a render to help detect edges.
Edges output gives intermediate result of edge detection. It’s only there for debug purposes and will be removed later
Proposed changes
Simplify interface as follows:
The authors of the original paper argue it is best to choose luma for edge detection, because this information is always available (unlike depth or object id) and because the underlying idea of morphological anti-aliasing assumes edges are color discontinuities. Also, I could reproduce same results from luma and RGB by choosing different threshold. So edge detection was set to luma by default and other options were removed.
Corner detection is now off it corner rounding is set to 0, otherwise use the value.
Feedback is welcome!
Please let me know what you think of the interface, especially of the simplified version. It would be nice to have the node tried out by compositing artists. Windows, Linux and macOS builds are available here
Implementation notes
This is a continuation of D2411. Patch is not ready for review. Defining node design/usability is more important now
[1] Jorge Jimenez and Jose I. Echevarria and Tiago Sousa and Diego Gutierrez 2012, Enhanced Subpixel Morphological Antialiasing, in Computer Graphics Forum (Proc. EUROGRAPHICS 2012). https://www.iryoku.com/smaa/
[2] https://github.com/iRi-E/smaa-cpp