ArticleslgStudy

computer science

Supersampling

Supersampling is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Supersampling rather than just read about it. In short: Supersampling or supersampling anti-aliasing (SSAA) is a spatial anti-aliasing method, i.e. a method used to remove aliasing (jagged and pixelated edges, colloquially known as "jaggies") from images rendered in computer games or other computer programs that generate imagery. Aliasing occurs because unlike real-world objects, which have continuous smooth curves and lines, a computer screen shows the viewer a large nu…

Supersampling — main illustration
Supersampling — illustration

Key takeaways

  • Supersampling belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Supersampling to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Supersampling from memory before moving on to harder problems.

Reference excerpt

Supersampling or supersampling anti-aliasing (SSAA) is a spatial anti-aliasing method, i.e. a method used to remove aliasing (jagged and pixelated edges, colloquially known as "jaggies") from images rendered in computer games or other computer programs that generate imagery. Aliasing occurs because unlike real-world objects, which have continuous smooth curves and lines, a computer screen shows the viewer a large number of small squares. These pixels all have the same size, and each one has a single color. A line can only be shown as a collection of pixels, and therefore appears jagged unless it is perfectly horizontal or vertical. The aim of supersampling is to reduce this effect. Color samples are taken at several instances inside the pixel (not just at the center as normal)—hence the term "supersampling"—and an average color value is calculated. This can for example be achieved by rendering the image at a much higher resolution than the one being displayed, then shrinking it to the desired size, using the extra pixels for calculation, with the result being a downsampled image with smoother transitions from one line of pixels to another along the edges of objects, but each pixel could also be supersampled using other strategies (see the Supersampling patterns section). The number of samples determines the quality of the output.

Motivation Aliasing is manifested in the case of 2D images as moiré pattern and pixelated edges, colloquially known as "jaggies". Common signal processing and image processing knowledge suggests that to achieve perfect elimination of aliasing, proper spatial sampling at the Nyquist rate (or higher) after applying a 2D Anti-aliasing filter is required. As this approach would require a forward and inverse fourier transformation, computationally less demanding approximations like supersampling were developed to avoid domain switches by staying in the spatial domain ("image domain").

Method

Computational cost and adaptive supersampling Supersampling is computationally expensive because it requires much greater video card memory and memory bandwidth, since the amount of buffer used is several times larger. A way around this problem is to use a technique known as adaptive supersampling, where only pixels at the edges of objects are supersampled. Initially only a few samples are taken within each pixel. If these values are very similar, only these samples are used to determine the color. If not, more are used. The result of this method is that a higher number of samples are calculated only where necessary, thus improving performance.

Supersampling patterns When taking samples within a pixel, the sample positions have to be determined in some way. Although the number of ways in which this can be done is infinite, there are a few ways which are commonly used.

Grid The simplest algorithm. The pixel is split into several sub-pixels, and a sample is taken from the center of each. It is fast and easy to implement. Although, due to the regular nature of sampling, aliasing can still occur if a low number of sub-pixels is used.

Random Also known as stochastic sampling, it avoids the regularity of grid supersampling. However, due to the irregularity of the pattern, samples end up being unnecessary in some areas of the pixel and lacking in others.

Poisson disk

The Poisson disk sampling algorithm places the samples randomly, but then checks that any two are not too close. The end result is an even but random distribution of samples. The naive "dart throwing" algorithm is extremely slow for large data sets, which once limited its applications for real-time rendering. However, many fast algorithms now exist to generate Poisson disk noise, even those with variable density. The Delone set provides a mathematical description of such sampling.

Jittered A modification of the grid algorithm to approximate the Poisson disk. A pixel is split into several sub-pixels, but a sample is not taken from the center of each, but from a random point within the sub-pixel. Congregation can still occur, but to a lesser degree.

Rotated grid A 2×2 grid layout is used but the sample pattern is rotated to avoid samples aligning on the horizontal or vertical axis, greatly improving antialiasing quality for the most commonly encountered cases. For an optimal pattern, the rotation angle is arctan (⁠1/2⁠) (about 26.6°) and the square is stretched by a factor of ⁠√5/2⁠, making it also a 4-queens solution.

See also Oversampling Multisample anti-aliasing Quincunx Graphics card Graphics processing unit Ray tracing (graphics) Framebuffer Game engine Image scaling 2×SaI Deep Learning Super Sampling

References

External links "High-Resolution Antialiasing (HRAA)". Technical Brief: High-Resolution Antialiasing through Multisampling. Retrieved 22 April 2017. "What is supersampling (antialiasing technique)?". Hardware Knowledgebase. Archived from the original on 2006-03-25. Retrieved 1 May 2006. Getreuer, Pascal (2011). "Image Interpolation with Contour Stencils". Image Processing on Line. 1: 70–82. doi:10.5201/ipol.2011.g_iics. Retrieved 21 October 2010.

Illustrations

Supersampling: Calculating the end color value
Calculating the end color value
Supersampling: Comparison of a rendered scene without (left side) and with supersampling anti-aliasing applied (right) (Not applying AA is analogous to a nearest-neighbor interpolation.)
Comparison of a rendered scene without (left side) and with supersampling anti-aliasing applied (right) (Not applying AA is analogous to a nearest-neighbor interpolation.)
Supersampling illustration
Supersampling illustration
Supersampling illustration

Worked examples

Example 1 — a first encounter with Supersampling

Start with the simplest possible case. Write down what Supersampling claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Supersampling before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Supersampling ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Supersampling

In research
Supersampling appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Supersampling in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Supersampling is common in secondary-school and first-year university syllabi. It links to neighbouring topics Anti-aliasing algorithms, Image processing, so understanding it makes those chapters shorter.
In everyday life
Look for Supersampling outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Supersampling in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Supersampling means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Supersampling out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Supersampling in simple terms?

Supersampling or supersampling anti-aliasing (SSAA) is a spatial anti-aliasing method, i.e. a method used to remove aliasing (jagged and pixelated edges, colloquially known as "jaggies") from images rendered in computer games or other computer programs that generate imagery. Aliasing occurs because…

Why does Supersampling matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Supersampling?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Supersampling.

Tags

  • Anti-aliasing algorithms
  • Image processing

Keep exploring