Previous | Next --- Slide 54 of 71
Back to Lecture Thumbnails
wxl

What’s the reasoning for the offsets of the subpixels?

motoole2

This is a really good question. There are many different supersampling patterns that can be used for anti-aliasing. Some sampling patterns follow a regular grid. The pattern shown here refers to a stratified sampling technique, where these pixels are divided into four subpixels and the position of samples are randomized within each subpixel. (This particular slide appears to indicate that the layout of these samples is actually fairly regular, and this is a valid sampling pattern. But usually, the samples will be more randomized.)

So what is the reasoning for using random samples over regular samples? As discussed in this GPU gems chapter, the answer is that randomized samples can produce better quality images than regular samples. When using a regular grid of samples, we may have increased our sampling frequency but aliasing still occurs, causing high-frequency structures to manifest as low-frequency signals. The advantage of irregularly (i.e., randomly) sampling a signal is that high-frequency signals tend to appear as unstructured noise, which may be more desirable.

yuanzhec

What are some of the most widely-used anti-aliasing algorithms in practice besides supersampling? Assignment 1 mentioned MLAA. I'm wondering if there are others.

wxl

Wait. So for the supersampling patterns that you mentioned are randomized, that would happen only once per something like a canvas init? Since we just discussed how we want determinism so that something like animations wouldn't get weird "shimmering" artifacts

motoole2

Earlier in the lecture, I spoke about how GPUs follow specific and deterministic rasterization rules to determine how to render triangles, and the importance of creating GPUs and drivers that have predictable behaviors. This is important in edge cases like this one, where the edge of two triangles might overlap a single sample. Randomly choosing the triangle to draw may not be all that desirable.

Designing an anti-aliased procedure that uses "random samples" seems to fly in the face of the above, since it is no longer deterministic nor does it produce consistent behavior. The pattern shown in this slide does appear regular, and looks to be related to the sampling patterns used in Direct3D (see section titled "Multisample Anti-Aliasing Rasterization Rules"). Another way to perform antialiasing is to initialize the sampling pattern to be random across different pixels. This may or may not be desirable for any particular application. But the point is that there are many possible sampling patterns and anti-aliasing procedures to choose from.

In the case of anti-aliasing in OpenGL, the GL specs for multisample functionality appears to provide some flexibility in terms of how to choose the samples, and therefore it appears that different GPUs may not produce the exact same result.

I will note that there are also anti-aliasing procedures that change the position of the samples over time. This blog has a few cool examples of a temporal antialiasing procedure in action.