supersampling

Supersampling is the technique to avoid aliasing problems in computer graphics.

Welcome to the fifth post in the series on aliasing that I am doing and that I am publishing on .com and on . This time we return to a previously discussed topic that is especially interesting.

supersampling

Supersampling is the “simple” brute force technique for avoiding aliasing problems in computer graphics.

To avoid , Nyquist’s theorem tells us that we must sample a signal at at least two times the highest frequency of the source signal. But how do we render a scene at a much higher resolution?

It is clear that we do not want the final image to have a beastly resolution. It is not good to have more pixels than our screen is capable of displaying. So once we have our precious image, at high resolution, free of aliasing, we just have to rescale it to the final size, using a filter to maximize the quality of the image.

Here’s an example, first we render to 64×64 without applying antialiasing techniques, and render to 256×256 (16x supersampling) and reduce it back to 64×64 using Paint.NET’s “Best Quality” filter (If we did this in games on game time, we can use a pixel shader to apply high quality filters):

64×64 without aliasing:

64×64 after applying the described process:

If we enlarge both images we can see the differences:

Because the resolution of all rendering operations has been increased, supersampling fixes many types of aliasing in one fell swoop:

  • Aliasing of vertices of triangles.
  • Geometric aliasing.
  • Texture aliasing.
  • Shadow aliasing.
See also  How to see all services managed by brew services (homebrew) on Mac

In fact, the only aliasing problem that supersampling doesn’t fix is ​​temporary.

The problem with this is the cost. Even when only doubling the horizontal and vertical resolution (doing 4x supersampling), we have to render four times as many pixels. Four times more texture and shadow computation, not to mention increased framebuffer and memory, leaving the GPU performing four times less. And this is just because of 4x supersampling, which is nowhere near avoiding texture, geometry and shadow aliasing.

Do you remember the Nyquist theorem? To avoid aliasing, you have to consider the ratio between the maximum and minimum scale at which:

  • Starting from a texture, such as the one on the side of a building.
  • How far is the player to reach the building?
  • For good graphics, we want the texture to be at a high enough resolution that it maintains detail when recomposed to full scale.
  • Now the player starts moving away from the building.
  • The texture is made smaller, for example, recomposed at a lower frequency.
  • After a while, it will reset to such a small frequency, below the Nyquist limit, that aliasing will occur.
  • SuperSampling to the rescue!
  • We activate a 2x supersamplin, the aliasing disappears.
  • But the player continues to walk away from the building.
  • When the texture reaches half the size at which we would see the aliasing, we return to the same thing.

It is very normal for objects to change in size by a factor of more than 100 as we move through the world. But this would be totally impractical since we would have to increase the rendering resolution by 100x in both width and height, increasing the GPU’s work in the order of 10,000 times more.

See also  Operators and Operands

For this reason supersampling is not widely used, so this series of articles is not over. But it is a starting point to understand other more advanced antialiasing techniques.

A scenario of using supersampling is when we connect the XBOX 360 to a television with standard definition. Most Xbox games render in HD resolutions like 1280×720, leaving the job of scaling the images to the output resolution up to the hardware. That’s supersampling. Thanks to hardware work, those extra pixels are not thrown away, but are used to create a 640×480 non-aliased image.

Another scenario where games use supersampling is when they take screenshots. Internal builds included a special mode that allowed us to render the same scene using different projection matrices, combining literally thousands of 640×480 images to create a 16384*16384 screenshot, which we could download for a healthier resolution in Photoshop. Trick?, can. But it’s the game engine and shadows that are used in the models and textures that Xbox hardware uses. The images are so perfect, they looked good even when printed on a giant poster.

Note: This article is a free translation of Shawn Hargreave’s post.

Loading Facebook Comments ...
Loading Disqus Comments ...