<OpenGL> Rasterization & Antialiasing
I. Rasterization
1. Definition
Rasterization is the process by which a primitive is converted to a two-dimensional image. Each point of this image contains such information as color and depth. Thus, rasterizing a primitive consists of two parts. The first is to determine which squares of an integer grid in window coordinates are occupied by the primitive. The second is assigning a color and a depth value to each such square. The results of this process are passed on to the next stage of the GL (per-fragment operations), which uses the information to update the appropriate locations in the framebuffer. Figure 3.1 diagrams the rasterization process.

2. Rasterization with point
The rasterization of points is controlled with
void PointSize ( float size ) ;
size specifies the width or diameter of a point. The default value is 1.0. A value less than or equal to zero results in the errorINVALID_VALUE.
Point antialiasing is enabled or disabled by calling Enable or Disable with the symbolic constant POINT_SMOOTH. The default state is for point antialiasing to be disabled.
3. Rasterization with line segment
A line segment results from a line strip Begin / End object, a line loop, or a series of separate line segments. Line segment rasterization is controlled by several variables. Line width, which may be set by calling
void LineWidth ( float width );
with an appropriate positive floating-point width, controls the width of rasterized line segments. The default width is
. Values less than or equal to
generate the error INVALID_VALUE.
Antialiasing is controlled with Enable and Disable using the symbolic constant LINE_SMOOTH. Finally, line segments may be stippled. Stippling is controlled by a GL command that sets a stipple pattern (see below).
Method 1: Digital Differential Analyzer (DDA)
Method 2: Bresenham line algorithm (Only support lines with both endpoints on integer points of pixel grid.)
Antialiasing: Wu's algorithm
4. Rasterization with triangles
Method: Triangle scan conversion
Use Bresenham line algorithm to find the boundary of the three edges
II. Antialiasing (AA)
i. Two basic concepts
1. Pre-filtering
• Treat each pixel as an area
• Compute relative (approximate) area ratio and mix the colors
2. Post-filtering
• Combine multiple samples per pixel
• Note: we need more samples per pixels, so more renderings
ii. Common AA methods
1. No AA: no antialiasing
2. SSAA: Supersampling (render higher resolution then downsample)
3. MSAA: Multisampling (easy but hardware dependent)
4. FXAA: Fast Approximate (fastest, find and only smooth the edges; on Graphic Cards)
5. TXAA: specifically to reduce Temporal aliasing
ps. Each has pros and cons.

浙公网安备 33010602011771号