W3C home > Mailing lists > Public > www-svg@w3.org > October 2011

Towards Better Anti-aliasing

From: Mike Bostock <mbostock@cs.stanford.edu>
Date: Fri, 28 Oct 2011 11:20:49 -0700
Message-ID: <CAM36=qottztd8UfaDgCpB6K4b_aAmObtAhvqmLXXNj48NdMEcQ@mail.gmail.com>
To: www-svg@w3.org
At SVG Open I raised the issue that current anti-aliasing
implementations are woefully inadequate and lead to a variety of
visual artifacts. The general issue is that these implementations
anti-alias each shape individually against a canvas, rather than using
some form of full-scene anti-aliasing, such as supersampling or
multisampling [1].

Here's an example where subpixel rects completely fill a region, but
because each rect is anti-aliased individually, the background bleeds


This is also apparent in Polymaps when displaying tiles at non-integer
zoom levels because the tiles are at subpixel positions:


Notice the horizontal and vertical lines where the background bleeds
through. The effect is a bit more apparent on Firefox than on Chrome.
In fact, Firefox shows this artifact even at integer zoom levels,
because the containing SVG itself uses subpixel positioning! If you
change the width of the window, you'll see the vertical lines flicker
based on whether the window is an even or odd number of pixels wide.

Another case is multiple thin coincident shapes. The shapes are
anti-aliased separately, each time blending the new shape against the
current accumulation; eventually, this causes the opacity of any pixel
that touches any part of the lines to reach opacity 1, which is
equivalent to having no anti-aliasing at all! Here are 400 coincident,
opaque diagonal lines. They should appear identical to one opaque
diagonal line:


Also notice the jaggies on the blue edges coming out of the NodeSprite
and related classes:


I've attached an image which magnifies the artifact.

I filed a bug against WebKit requesting this in early 2010:


I think it would be reasonable to omit this feature in software
implementations, but as we move increasingly to GPU-based rendering
this feature would greatly improve rendering quality for complex
images. The only SVG implementation I am aware that uses full-scene
antialiasing is Anti-Grain Geometry:



[1] http://en.wikipedia.org/wiki/Multisample_anti-aliasing

(image/png attachment: jaggies.png)

Received on Monday, 31 October 2011 16:16:53 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:32 UTC