Anti-aliasing Part 1: Supersampling – If it was a perfect world

Most people can’t stand the sight of aliasing, the staircase effect most noticeable on the edges of objects (or polygons to be more precise). It’s even worse when movement is involved, as the “jaggies” often appear to “crawl.” The aliasing effect is easily described by the following image (note, all images in this post are clickable thumbnails):

A pixel must be only one colour (or no colour at all). To determine the colour of a pixel, a sample is taken from the centre of the pixel, and whatever the colour is at that point, the whole pixel becomes. Full screen anti-aliasing (hereafter called AA) is an evolving method of dealing with this problem. One of the earliest methods for performing AA was supersampling. This is a brute force method for applying AA to the entire screen.

In simple terms, supersampling takes all screen space coordinates (which are generated for a specific screen resolution) and up-samples them, usually by at least a factor of 2. This means that for a frame displayed at 1680×1050 and upsampled by a factor of 2, the up-sampled version would be rendered at 3360×2100 in the off-screen buffer, and for every pixel of the original frame we now have four; double in each direction.

Now that there’s a high-resolution frame to work with, we need to down-sample it again to fit the screen. The colours of each of the four pixels are averaged (where the sample is taken in each pixel is determined by on of several methods, which are beyond the scope of this post), and this average colour is used to fill a single pixel in the down-sampled frame, which is now the same size as the original; equal to the screen resolution. Going back to the image above, rather than being either black or white, a pixel could be a shade of grey, which “smooths” the edge.

Unfortunately, it’s not a perfect world. The biggest disadvantage with supersampling is that it is a memory hog and it is computationally intensive, as you will soon see. But enough with the theory for now, lets see what supersampling can do! First, it is important to know the configuration of the test system, so here it is:

Intel Core i7 920 @ stock (but undervolted!)

NVIDIA GTX 275 @ stock

MSI X58 Pro-E

3x2GB G.Skill DDR3-1333

ForceWare drivers v191.03

OCZ Vertex 30GB (thanks EnJoY! :D)

Western Digital Caviar Black 640GB

Half-Life 2: Lost Coast (for the test application)

First, let’s have a picture with no anti-aliasing:

No AA

Well that’s just plain ugly. Just look at the fence. Now we will apply supersampling to see what effect it has on the image. Take note of the framerate with each successive increase in AA by looking at the information in the bottom right (ignore everything but the framerate).

1×2 SSAA

Here we have 1×2 Supersampling AA (SSAA). It is not much use as it only affects horizontal edges, not vertical. Since the fence is mostly vertical edges there is not a great deal of difference. The tall rock in the background is also unaffected by this type of SSAA. Also note that the open gate looks almost identical to the previous image. Let’s move on to 2×1.

2×1 SSAA

Now that’s alot better. The fence is much improved, and so are other vertical edges. The vertical bars in open gate are significantly more defined than the previous two images. Unfortunately, this method does not affect horizontal edges, so the shipwreck on the left looks worse than the previous image, and only slightly better than with no AA at all. Both 1×2 and 2×1 SSAA have a negligible effect on framerate as both are over 120FPS still.

2×2 SSAA

Now we’re getting the best of both worlds. Both horizontal and vertical edges are being smoothed (compare the tall rock with the previous two images, and notice that all of it is now smoothed instead of only the top or sides), and the shipwreck looks far better than before. We’re starting to see the impact SSAA can have on framerate now, as we’re down to 88FPS. While that’s still high, it’s a 40% drop over the framerate with no AA.

3×3 SSAA

At 3×3 the image is most improved in the areas of the fence at a sharp angle to the camera, as well as the open gate. Whether this is worth the additional 50% performance drop over 2×2, and 70% over no AA, is up to you. Now on to the holy grail of anti-aliasing.

4×4 SSAA

While having the best image quality, the differences are getting very difficult to point out now. The fence is certainly improved, but little else has changed compared to 3×3. The most notable exception is the framerate, which is in unplayable territory. Of course, since the resolution of the frame in the off-screen buffer is now 16x higher than the screen resolution, that is to be expected. Remember that this game is based on the Source engine, so it is not that taxing on the system. On newer games, the framerate would likely drop to unplayable with the lower SSAA settings even. But it would look nice

That brings me to the end of this post on Supersampling Anti-aliasing. Check back soon for the next article on Multisampling.