Rasterization is the process of converting geometric descriptions of shapes into samples on a regular grid, usually the pixel grid of a digital image. In computer graphics, it determines which image samples are covered by primitives such as triangles, lines, or curves and supplies information needed to compute their appearance. Rasterization is used in both two-dimensional drawing and three-dimensional rendering. It is especially important in real-time graphics, where specialized hardware can process large numbers of primitives efficiently.
Scope and terminology
A raster image represents visual information as a rectangular array of pixels. By contrast, vector graphics describe images through geometric objects, such as paths, curves, and filled regions. Rasterizing a vector image produces a pixel-based representation at a chosen resolution.
In three-dimensional graphics, rasterization usually has a narrower meaning: converting projected geometric primitives into fragments. A fragment is a candidate contribution to an output pixel or its samples, together with associated information such as depth and interpolated attributes. It is not necessarily a final pixel: it may be rejected, combined with existing values, or contribute to only some samples within a pixel.
The term scan conversion emphasizes determining which locations on a raster belong to a shape. It is often used interchangeably with rasterization, particularly for line drawing and polygon filling.
Rasterization is distinct from the broader process of rendering, which also includes visibility determination, material evaluation, lighting, and image composition. It is likewise distinct from image processing, which generally operates on images that are already sampled.
Rasterization in the graphics pipeline
A conventional three-dimensional rasterization pipeline proceeds through several stages. Their exact organization varies among graphics systems, and implementations can combine or reorder some operations while preserving the required results.
Geometry transformation and clipping
Vertices are transformed from object coordinates into camera and projection coordinates. These transformations commonly use a matrix representation and homogeneous coordinates.
Primitives are clipped against the viewing region before rasterization. Clipping prevents geometry outside the view from producing unwanted samples and handles primitives crossing the boundaries of the visible volume. Perspective division and viewport mapping then place the surviving geometry in screen coordinates.
Curved surfaces and complex models are often approximated by triangles. Triangles are particularly convenient because they are planar, have simple boundaries, and support efficient interpolation.
Coverage determination
The rasterizer determines which sample positions are covered by each projected primitive. With one sample per pixel, a common approach is to test a designated position, often the pixel center. Multisample methods use several coverage positions within each pixel.
A pixel can therefore be partly intersected by a primitive without its single sample being covered. This difference between geometric area and discrete sample coverage is central to understanding rasterization artifacts.
Attribute interpolation and shading
Attributes associated with vertices—such as texture coordinates, colors, and surface normals—are interpolated across the primitive. A fragment shader uses these values, together with material and lighting data, to compute output values.
Although shading and rasterization are closely associated in practical rendering, they perform different tasks. Rasterization establishes coverage and interpolation; shading determines appearance.
Visibility tests and output
Fragments may undergo depth and stencil tests, and shader execution may discard some fragments. Passing values are written to a framebuffer, potentially after blending with existing values.
A depth buffer stores depth information so that, for ordinary opaque rendering, nearer surfaces can replace farther ones. Some hardware can reject hidden fragments before expensive shading, provided doing so preserves the program’s behavior.
Core algorithms
Rasterization combines geometric tests with incremental computation. Efficient algorithms avoid repeating a complete geometric calculation at every pixel.
Lines and curves
A line-drawing algorithm selects grid positions that approximate a continuous line. Bresenham’s line algorithm uses incremental error updates and integer arithmetic, making it important historically and useful in software implementations.
Curves can be rasterized directly or subdivided into simpler segments. Two-dimensional drawing systems often flatten curves into line segments and then apply stroke or fill rules. The subdivision tolerance affects both processing cost and approximation accuracy.
Triangle edge functions
Triangle coverage is commonly tested with edge functions. For a directed edge from to , one possible edge function is
Its sign identifies which side of the edge contains the point . For a consistently oriented triangle, a point lies inside when it satisfies the corresponding condition for all three edges, subject to the chosen boundary convention.
Because an edge function is linear in and , its value can be updated by adding constants when moving between neighboring samples. This supports efficient incremental evaluation and block-based processing.
Shared edges require a consistent ownership rule. Otherwise, adjacent triangles might both include a boundary sample or both exclude it. A common convention is the top-left rule, which includes selected boundary edges and excludes their complementary edges. The precise definition depends on the graphics system’s coordinate conventions.
Barycentric interpolation
A point inside a triangle can be expressed using barycentric coordinates:
These weights can interpolate vertex attributes. For an attribute that varies linearly over the projected triangle, ordinary interpolation gives
Perspective projection requires additional care. Ordinary screen-space interpolation of attributes such as texture coordinates generally produces distortion. If is the homogeneous clip-coordinate component at vertex , perspective-correct interpolation is
Graphics interfaces also allow attributes to be constant across a primitive or interpolated without perspective correction when appropriate.
Polygon filling
General polygons may be filled by processing intersections with successive scan lines. Their interiors can be defined using an even–odd rule or a nonzero winding rule, which can produce different results for self-intersecting paths.
Another approach decomposes polygons into triangles before rasterization. This shifts much of the complexity into a preliminary computational geometry problem and lets the rasterizer operate on a uniform primitive type.
Sampling, aliasing, and antialiasing
Rasterization converts continuous geometric boundaries into discrete samples. When small features or rapid image variations are insufficiently sampled, aliasing can appear as jagged edges, disappearing details, moiré patterns, or flickering during motion.
Antialiasing methods reduce these artifacts by estimating coverage or filtering information over an area rather than relying only on an isolated point sample.
Important approaches include:
- Supersampling: rendering more samples than the final image requires, then filtering them into output pixels. It can reduce both edge and shading aliasing, but increases cost.
- Multisample antialiasing: maintaining multiple coverage and depth samples per pixel while allowing some shading work to be shared. It primarily improves geometric edge quality and does not automatically remove aliasing within shaded surfaces.
- Analytic coverage: calculating or approximating the fraction of a pixel covered by a shape. This is especially useful for text, lines, and two-dimensional paths.
- Temporal methods: combining information across frames, often with changing sample positions and motion estimates. These can improve stability but may introduce ghosting or loss of detail.
Texture mapping introduces a related sampling problem: even a smooth geometric boundary may contain texture detail too fine for the output resolution. Texture filtering and prefiltered image levels address this separately from primitive coverage.
Hardware implementation and performance
Modern graphics processing units include specialized rasterization hardware alongside programmable shading units. Their high throughput depends on regular geometric tests, spatial locality, and extensive parallel computing.
Rasterizers commonly process small blocks of samples, allowing entire blocks to be accepted or rejected through geometric bounds. Many GPUs also group rendering work into screen-space tiles, although tile organization and memory handling differ among architectures.
Performance is not determined by triangle count alone. Important limits include:
- Geometry throughput: the rate at which primitives can be transformed, assembled, and set up.
- Sample throughput: the rate at which coverage, depth, and output operations can be processed.
- Shading cost: the amount of computation performed for fragments.
- Memory bandwidth: the cost of fetching textures and accessing rendering buffers.
- Overdraw: repeated processing of geometry that covers the same screen locations.
Very small triangles may be inefficient because setup costs remain even when few samples are covered. Large overlapping primitives can instead create substantial fragment work. Early depth rejection and hierarchical depth testing can reduce some unnecessary processing.
Relationship to ray tracing
Rasterization and ray tracing organize visibility calculations differently. Rasterization typically projects primitives onto the image and determines their covered samples. Ray tracing typically starts with rays associated with image samples and finds their intersections with scene geometry.
Rasterization is highly efficient for primary visibility in many real-time applications. Its basic coverage operation, however, does not by itself calculate shadows, reflections, refractions, or indirect illumination. Rasterization-based renderers obtain these effects through additional techniques, such as shadow maps, auxiliary scene renders, precomputed lighting, or screen-space approximations.
Ray tracing can query visibility in arbitrary directions more directly, but requires intersection calculations and usually acceleration structures. Neither method alone specifies the complete lighting model or guarantees photorealistic output.
Hybrid renderers combine them—for example, rasterizing directly visible surfaces while tracing rays for selected reflections or shadows.
Development and applications
Rasterization developed alongside raster displays, digital plotters, and image output devices. Early work emphasized economical line drawing and polygon filling on machines with limited arithmetic and memory resources. As interactive three-dimensional graphics expanded, triangle-based pipelines and dedicated hardware became increasingly important. Programmable shaders later made surface appearance much more flexible without eliminating rasterization’s role in coverage determination.
Its principal applications include:
- Interactive three-dimensional graphics: games, simulation, virtual reality, and model viewers.
- User interfaces and vector drawing: converting paths, icons, and scalable graphics into display pixels.
- Text rendering: converting glyph outlines into pixel coverage at a chosen size and resolution.
- Document output and printing: converting page descriptions into device-resolution raster data.
- Mapping and visualization: turning geometric features and scientific models into sampled images.
Rasterization normally produces a resolution-dependent result. Enlarging that result cannot recover geometric detail absent from its samples, whereas rerasterizing the original geometry at a higher resolution can preserve sharper boundaries.
Limitations and specialized variants
Finite sample density can miss thin geometry and subpixel details. Numerical precision also affects edge classification, clipping, and depth comparisons. Nearly coincident surfaces can produce z-fighting, in which limited depth precision causes unstable visibility.
Transparency requires additional treatment because the ordinary depth-buffer approach retains only the nearest accepted depth. Conventional alpha blending generally depends on processing order; more advanced methods store, approximate, or reorganize multiple contributions.
Conservative rasterization changes the coverage criterion so that, in an overestimating form, a pixel can be reported whenever a primitive intersects its area rather than only when selected sample positions are covered. This is useful for geometric queries and voxelization, but its coverage results are not equivalent to ordinary display rasterization.
Differentiable rasterization supports optimization involving rendered images by providing gradients or approximations to them. Visibility changes and hard coverage decisions are discontinuous, so these systems commonly use softened coverage models or specialized gradient estimators. Their behavior therefore depends on more than the standard rasterization rules used for display rendering.