Graphics Reference
In-Depth Information
process. You have almost certainly seen the staircase effect that happens to
lines drawn diagonally across a monitor.
Various techniques can be used to reduce those aliasing effects, and
OpenGL ES 3.0 supports a variant called multisampling. Multisampling
divides every pixel into a set of samples, each of which is treated like a
“mini-pixel” during rasterization. That is, when a geometric primitive
is rendered, it's like rendering into a framebuffer that has many more
pixels than the real display surface. Each sample has its own color, depth,
and stencil value, and those values are preserved until the image is ready
for display. When it's time to compose the final image, the samples are
resolved into the final pixel color. What makes this process special is that
in addition to using every sample's color information, OpenGL ES 3.0 has
even more information about how many samples for a particular pixel
were occupied during rasterization. Each sample for a pixel is assigned a
bit in the sample coverage mask. Using that coverage mask, we can control
how the final pixels are resolved. Every rendering surface created for an
OpenGL ES 3.0 application will be configured for multisampling, even if
only a single sample per pixel is available. Unlike in supersampling, the
fragment shader is executed per pixel rather than per sample.
Multisampling has multiple options that can be turned on and off (using
glEnable and glDisable , respectively) to control the usage of sample
coverage value.
First, you can specify that the sample's alpha value should be used
to determine the coverage value by enabling GL_SAMPLE_ALPHA_TO_
COVERAGE . In this mode, if the geometric primitive covers a sample, the
alpha value of incoming fragment is used to determine an additional
sample coverage mask computed that is bit-wise anded into the coverage
mask that is computed using the samples of the fragment. This newly
computed coverage value replaces the original one generated directly
from the sample coverage calculation. These sample computations are
implementation dependent.
Additionally, you can specify GL_SAMPLE_COVERAGE or GL_SAMPLE_
COVERAGE_INVERT , which uses the fragment's (potentially modified by
previous operations) coverage value or its inverted bits, respectively,
and computes the bit-wise and of that value with one specified
using the glSampleCoverage function. The value specified with
glSampleCoverage is used to generate an implementation-specific
coverage mask, and includes an inversion flag, invert , that inverts
the bits in the generated mask. Using this inversion flag, it becomes
possible to create two transparency masks that don't use entirely
distinct sets of samples.
 
Search WWH ::




Custom Search