When applied to graphics and 2D images we call this supersampling, often abbreviated as SSAA. This results in less of the higher-frequency components leaking into the reconstructed version of the signal, which in the case of an image means a reduction in the appearance of aliasing artifacts. As you’ll recall from the first article, sampling at a higher rate causes the clones of a signal’s spectrum to be further apart. Oversampling is the process of sampling a signal at some rate that’s higher than our intended final output, and then reconstructing and resampling the signal again at the output sample rate. While it’s generally impossible to completely avoid aliasing of an arbitrary signal with infinite frequency, we can still reduce the appearance of aliasing artifacts through a process known as oversampling. We should also note that triangles and lines will inherently have discontinuities, which means that the signal is not bandlimited and thus no sampling rate will be adequate to avoid aliasing in the general case. For instance, since coverage and depth testing is performed at each pixel location in the render target the visibility sampling rate is determined by the X and Y resolution of that render target. Since visibility can be defined as 2D function of X and Y, we can treat it as a signal and define its behavior in terms of concepts from signal processing. Together, coverage and occlusion tells us the visibility of a primitive. One such case is where the pixel shader manually specifies a depth value, since the depth of the primitive isn’t known until the pixel shader runs. GPU’s still support performing the depth test after pixel shading in order to handle certain cases where an early depth test would produce incorrect results. This is done as an optimization, so that occluded pixels can skip pixel shading. One thing to note about the depth test is that while it is often shown as occurring after pixel shading, almost all modern hardware can execute some form of the depth test before shading occurs. If the depth test succeeds, the appropriate pixel in the depth buffer is updated with new closest depth. When a primitive is rasterized, its interpolated depth is compared against the value in the depth buffer to determine whether or not the pixel is occluded. ![]() A z-buffer, or depth buffer, stores the depth of the closest primitive relative to the camera at each pixel location. Occlusion tells us whether a pixel covered by a primitive is also covered by any other triangles, and is handled by z-buffering in GPU’s. The red circles represent sample points covered by the triangle. The blue circles represent a grid of sample points, each located at the center of a pixel. The following image demonstrates this process for a single triangle:Ĭoverage being calculated for a rasterized triangle. In GPU’s, coverage is calculated by testing if the primitive overlaps a single sample point located in the exact center of each pixel 1. Coverage is determined by performing some test to determine if the primitive overlaps a given pixel. This visible set is determined from two things: coverage, and occlusion. These positions are used to determine the set of pixels in the current render target where the triangle will be visible. The rasterization pipeline on a GPU takes as input the vertices of the primitive being rendered, with vertex positions provided in the homogeneous clip space produced by transformation by some projection matrix. Or better yet, read through it and correct my mistakes! Rasterization BasicsĪ modern D3D11-capable GPU features hardware-supported rendering of point, line, and triangle primitives through rasterization. Like the previous article on signal processing, feel free to skip if you’re already an expert. With that in mind I wanted to provide an quick overview of how MSAA works on a GPU, in order to provide the some background material for the following article where we’ll experiment with MSAA resolves. It’s also complicated because really understanding why it works requires at least a basic understanding of signal processing and image resampling. ![]() MSAA can be a bit complicated, due to the fact that it affects nearly the entire rasterization pipeline used in GPU’s. Updated - replaced the MSAA partial coverage image with a new image that illustrates subsamples being written to, as suggested by Simon Trümpler. ![]() Previous article in the series: Applying Sampling Theory to Real-Time Graphics
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |