In computer graphics, supersampling is the process of sampling an image at a frequency higher than the target sampling frequency (usually the pixel frequency). The key idea of supersampling is the same as the one in oversampling. However, in supersampling, no analog filtering or quantization is involved.

Supersampling, when combined with filtered decimation (reducing the sampling frequency by 'averaging down'), is a simple and effective method for anti-aliasing when prefiltering (filtering the continuous signal before any sampling) is difficult or impossible.

Aliasing is a pervasive problem in computer graphics. The sharp edges in computer graphics models represent arbitrarily large frequencies. Furthermore, prefiltering in rendering applications is very difficult. Even for simple lighting models prefiltering requires sophisticated analytical filtering algorithms. For ray-tracing, prefiltering is more or less impossible. Supersampling is a simple and effective alternative in these cases.

Essentially, instead of the normal one sample per pixel, multiple samples per pixel are taken. These multiple samples are arranged on a regular grid which is finer than the pixel grid. The multiple samples for a pixel are then averaged to form a single value for that pixel (this is the filtered decimation 1). For most computer graphics applications, 4 samples per pixel is the minimum, 9 is adequate, and 16 is more than enough.

Supersampling is not perfect. Since there is no analog prefilter, no matter how high the supersampling rate, there'll always be some aliasing present in the resulting image. Monte Carlo integration gets around this limitation by sampling in a random pattern rather than on a regular grid. This has the effect of converting visually objectionable aliasing artifacts to less objectionable random noise.


1 See oversampling for a signal processing view of what happens.

What is supersampling?

One of the most undesirable artifacts found in computer generated images is aliasing, where an edge takes on a jagged, pixelated profile. Supersampling is a method of anti-aliasing, which attempts to smooth these edges, slightly blurring the boundary, making the final image more realistic. Although the process is quite computationally expensive, its results can be strikingly effective, and all modern rendering packages will include some form of supersampling.

There are numerous variations of supersampling, a few of which are explained below, but all of them attempt to acheive the same goal, through a very similar method.

How is it done?

The reason aliasing occurs is that although real-world shapes have a smooth, continuous outline, monitors, and especially LCD screens, can only display discrete, distinct points of light, or pixels. These square pixels have a uniform colour, and if anti-aliasing is not used, the entire pixel will be coloured according to only one colour sample, taken at the centre of the pixel:

Actual shape:     Pixelated image:
+-------+           +-------+
|      /|           |       |
|   o /#|           |       |
|    /##|           |       |
+---/###+           +-------+
|  /####|           |#######|
| /#o###|           |#######|
|/######|           |#######|
+-------+           +-------+

Here, we can see that if only one sample is taken per pixel (where the o is), a continous straight line becomes jagged.

Supersampling, on the other hand, measures the colour at several points within each pixel, and combines the results. Although the slant of the line cannot be recreated (as each pixel is uniformly coloured), the balance of colour throughout the pixel can be reproduced much more faithfully.

In the example given above, the bottom pixel is ¾ dark and ¼ light. However, the final pixel values are entirely dark and entirely light, respectively. If supersampling had been used, the bottom pixel might have been shaded dark grey and the top pixel light grey. Without reducing pixel size, this is the best approximation to a sloping line possible.

Types of supersampling

As supersampling has to be applied to every pixel in an image, it is essential that the algorithm used is efficient, and yet effective.

Adaptive supersampling

This techique acknowledges that very few pixels will actually be on a boundary, and hence very few pixels justify the computation required by supersampling.

At first, just a few (maybe four) colour samples are made within the pixel. If the values for these measurements are sufficiently similar, the pixel doesn't require supersampling, and can be immediately shaded with according to the samples already taken.

This method can be used in conjunction with any of the techniques shown below, to improve their performance.


The following are methods to determine where the extra rays should be shot through the pixel.

Grid supersampling

This is the most simple ray placement algorithm. Instead of shooting a ray through the middle of the pixel, the pixel is split into n×n sub-pixels, and a ray shot through the centre of each sub-pixel.

+---------------+
| o   o   o   o | 
|               |
| o   o   o   o | 
|               |
| o   o   o   o | 
|               |
| o   o   o   o | 
+---------------+

This algorithm is very easy to implement, and runs very fast. However, due to the regular nature of the ray placement, aliasing is still noticeable unless n is very large.

Random

As the name suggests, this algorithm selects points in the pixel to shoot rays through at random.

+---------------+
| o   o       oo| 
|         o   o |
|           o   | 
|        o    o |
|    o         o| 
|        o  o   |
|    o o      o | 
+---------------+

Although this prevents the problems associated with regular grids, significant parts of the pixel can be left unsampled, while others are drastically oversampled. This is a waste of resources, and in the worst case is almost comparable to no supersampling at all.

Poisson Disc

This algorithm is in many ways ideal. It uses a randomizing function to shoot rays through the pixel as above, but also checks that no two rays are too close together. This has the effect of distributing the rays throughout the pixel, preventing clumping.

+---------------+
| o   o     o  o| 
|         o     |
|   o       o   | 
|       o     o |
| o             | 
|       o   o   |
|  o  o   o   o | 
+---------------+

Although the results from this method are probably the best, it is a process that must be repeated millions of times in an image, and the computation cost of working out where to place the rays, let alone doing the ray-tracing itself, is too great. The render times are too poor to justify using this algorithm.

Jittered

This is a hybrid of the three algorithms above. Like Poisson disc, it ensures that the rays do not clump together too much, while avoiding a regular pattern and remaining computationally cheap.

The pixel is split into n×n sub-pixels, but instead of firing a ray through the centre of each one, a random point is chosen within each sub-pixel. The example below is 2×2 for clarity.

+---------------+
|       |       | 
|       | o     |
|     o |       | 
|-------+-------|
|       |   o   | 
|   o   |       |
|       |       | 
+---------------+

Although clumping cannot be totally eradicated, only four rays can congregate in any one place. The simplicity of the algorithm ensures it is easy to implement.

Log in or register to write something here or to contact authors.