Graphics Reference
In-Depth Information
6. The following sequence of screenshots shows the comparison of the final render
and G-Buffer contents between aliased and anti-aliased MSAA x4:
Comparison between aliased (top) and anti-aliased (bottom) from left: light pass, diffuse/albedo, normals, depth
How it works…
As discussed in the Implementing a screen-aligned quad renderer recipe, the
SV_SampleIndex input system-value semantic causes a pixel shader to be run for each
sample instead of for each pixel (for example, four times for 4xMSAA). This works great for a
screen-aligned quad as, by definition, we know that when rendered it will fully cover all samples
and, therefore, all samples are required. However, when rendering our light volumes or other
smaller regions, we are potentially wasting time calculating the lighting for a sample that isn't
even covered by the current fragment. This is where we can use the pixel shader SV_Coverage
input semantic to determine if the current sample index is covered or not. Each bit of the
coverage value indicates whether that sample is covered by the fragment, for example,
a coverage value of 1 indicates that only the first sample is covered whereas a value of 3
indicates that both, the first and second samples are covered as shown in the following diagram:
 
Search WWH ::




Custom Search