Rasterization
4.1 Display
An image is a 2D array of pixel colors. Display hardware converts these values into visible light.
Cathode Ray Tube (CRT): An electron beam is emitted, accelerated, focused, and deflected onto a phosphor-coated screen. Beam intensity controls brightness. Applications include oscilloscopes and traditional televisions.
Raster Scan: The beam sweeps across the screen line by line while its intensity is modulated. Interlaced scanning alternates odd and even lines in successive fields.
Frame Buffer: Memory storing the color of each pixel. For analog CRT displays, DACs (Digital-to-Analog Converters) convert digital RGB values into analog signals.
Flat-Panel Displays:
| Technology | Principle |
|---|---|
| LCD | Liquid crystals change light polarization; polarizers control how much backlight passes through. Partial rotation produces intermediate brightness levels. |
| OLED | Organic light-emitting materials produce their own light. |
| LED array | Individually controlled LEDs form an image. |
| E-Ink | Electric fields move charged black and white particles to change the visible color. |
4.2 Rasterizing a triangle
Triangles: Fundamental Shape Primitives:
- Guaranteed to be planar
- Well-defined interior
- Well-defined method for interpolating values at vertices over triangle
Rasterization = Sampling A 2D Indicator Function: Sample If Each Pixel Center Is Inside Triangle.
Incremental Triangle Traversal: Visit candidate pixel centers and update edge-function values using additions instead of recomputing them at every pixel. For each triangle edge:
\[ \begin{aligned} E(x,y) &= Ax + By + C, \\ E(x+1,y) &= E(x,y) + A, \\ E(x,y+1) &= E(x,y) + B. \end{aligned} \]
Compute the three edge functions at the starting pixel, then update them as traversal proceeds. Their signs determine coverage, using a consistent vertex winding and boundary rule.
Hierarchical Rasterization: Test blocks of pixels before testing individual samples.
- Fully outside: Skip the entire block.
- Fully inside: Mark all samples as covered; color and depth still need to be computed.
- Partially intersecting: Subdivide into smaller blocks until individual pixel tests are needed.
For example, subdivide a \(4\times4\) block into \(2\times2\) blocks, then individual pixels. Incremental edge-function updates can be used within the remaining blocks.
4.3 Antialiasing
Aliasing: Sampling a continuous signal at discrete intervals can produce artifacts. In rasterization, aliasing appears as jagged edges on diagonal lines.