276 V 3D Engine Design
A 3 × 3 block of pixels. After rasterization. After rasterization.
MSAA disabled. 4x MSAA.
Figure 3.1. A 3 × 3 region of pixels.
however, the hardware has access to the neighboring samples as well as coverage
information. The standard resolve operation will blend the color value of every
sample in a pixel using a simple box ﬁlter.
The performance win in multisampling is not necessarily in memory (a mul-
tisampled surface at 4x MSAA can be four times the size), but in performance.
Ideally (unlike supersampling), there is no need to execute the pixel shader more
than once per pixel.
When multisampling is disabled, any pixel center inside a triangle is drawn.
This is shown in Figure 3.1. When multisampling is enabled, if one or more
samples are covered by the triangle, then the pixel shader is executed once and
the resultant color is replicated for all covered pixels. In Direct3D 10.1 and above,
a pixel shader can also run at sample rate; however, this feature is orthogonal to
adaptive edge AA.
As shown in Figure 3.1, the 4x MSAA sample pattern in the upper left pixel
shows three out of four samples that are covered (e.g., an edge pixel). A simple
box ﬁlter resolve will calculate the ﬁnal pixel color as
3 × red + 1 × blue
Although the box ﬁlter is suﬃcient in many cases, it is not a panacea: the
box ﬁlter resolve utilizes no information about neighboring samples to determine
an even closer estimate of the actual slope of the primitive edge being rendered.
With additional information, an even better antialiasing ﬁlter can be constructed.
3.1.2 Directionally Adaptive Edge Multisampling
As demonstrated in Equation (3.1), a simple box ﬁlter only averages the samples
available to it in each individual pixel. This limitation is especially noticeable
at steep edges or low-frequency data, in which the gradual changes in gradient
between adjacent pixels can be lost. In the example of one red and one blue tri-