This articleneeds additional citations forverification.(September 2018) |
Incomputer graphics,rasterisation(British English) orrasterization(American English) is the task of taking animagedescribed in avector graphicsformat (shapes) and converting it into araster image(a series ofpixels,dots or lines, which, when displayed together, create the image which was represented via shapes).[1][2]The rasterized image may then be displayed on acomputer display,video displayorprinter,or stored in abitmapfile format. Rasterization may refer to the technique of drawing3D models,or to the conversion of 2Drendering primitives,such aspolygonsandline segments,into a rasterized format.
Etymology
editThe term "rasterisation" comes fromGermanRaster'grid, pattern, schema' andLatinrāstrum'scraper, rake'.[3][4]
2D images
editLine primitives
editBresenham's line algorithmis an example of an algorithm used to rasterize lines.
Circle primitives
editAlgorithms such asMidpoint circle algorithmare used to render circle onto a pixelated canvas.
3D images
editRasterization is one of the typical techniques of rendering 3D models. Compared with other rendering techniques such asray tracing,rasterization is extremely fast and therefore used in most realtime 3D engines. However, rasterization is simply the process of computing the mapping from scene geometry to pixels and does not prescribe a particular way to compute the color of those pixels. The specific color of each pixel is assigned by apixel shader(which in modernGPUsis completelyprogrammable). Shading may take into account physical effects such as light position, their approximations or purely artistic intent.
The process of rasterizing 3D models onto a 2D plane for display on acomputer screen( "screen space") is often carried out by fixed function (non-programmable) hardware within thegraphics pipeline.This is because there is no motivation for modifying the techniques for rasterization used at render time[5]and a special-purpose system allows for high efficiency.
Triangle rasterization
editPolygonsare a common representation of digital 3D models. Before rasterization, individual polygons are typically broken down into triangles; therefore, a typical problem to solve in 3D rasterization is rasterization of a triangle. Properties that are usually required from triangle rasterization algorithms are that rasterizing two adjacent triangles (i.e. those that share an edge)
- leaves no holes (non-rasterized pixels) between the triangles, so that the rasterized area is completely filled (just as the surface of adjacent triangles). And
- no pixel is rasterized more than once, i.e. the rasterized triangles don't overlap. This is to guarantee that the result doesn't depend on the order in which the triangles are rasterized. Overdrawing pixels can also mean wasting computing power on pixels that would be overwritten.
This leads to establishingrasterization rulesto guarantee the above conditions. One set of such rules is called atop-left rule,which states that a pixel is rasterized if and only if
- its center lies completely inside the triangle. Or
- its center lies exactly on the triangle edge (or multiple edges in case of corners) that is (or, in case of corners, all are) eithertoporleftedge.
Atopedge is an edge that is exactly horizontal and lies above other edges, and aleftedge is a non-horizontal edge that is on the left side of the triangle.
This rule is implemented e.g. byDirect3D[6]and manyOpenGLimplementations (even though the specification doesn't define it and only requires a consistent rule[7]).
Quality
editThe quality of rasterization can be improved byantialiasing,which creates "smooth" edges.Sub-pixel precisionis a method which takes into account positions on a finer scale than the pixel grid and can produce different results even if the endpoints of a primitive fall into same pixel coordinates, producing smoother movement animations. Simple or older hardware, such asPlayStation 1,lacked sub-pixel precision in 3D rasterization.[8]
See also
edit- Font rasterization
- Sub-pixel resolution
- Image tracing
- Hidden-surface determination
- Bresenham's line algorithmfor a typical method in rasterization
- Scanline renderingfor line-by-line rasterization
- Rendering (computer graphics)for more general information
- Graphics pipelinefor rasterization in commodity graphics hardware
- Raster image processorfor 2D rasterization in printing systems
- Vector graphicsfor the source art
- Raster graphicsfor the result
- Raster to vectorfor conversion in the opposite direction
- Triangulated irregular network,a vector source for topography data, often rasterized as a (raster)digital elevation model.
- Display list
- Spatial anti-aliasing
References
edit- ^Michael F. Worboys (30 October 1995).GIS: A Computer Science Perspective.CRC Press. pp. 232–.ISBN978-0-7484-0065-2.
- ^Kang-Tsung Chang (27 August 2007).Programming ArcObjects with VBA: A Task-Oriented Approach, Second Edition.CRC Press. pp. 91–.ISBN978-1-4200-0918-7.
- ^Harper, Douglas."raster".Online Etymology Dictionary.
- ^rastrum.Charlton T. Lewis and Charles Short.A Latin DictionaryonPerseus Project.
- ^"Rasterization: a Practical Implementation".www.scratchapixel.com.Retrieved2023-10-06.
- ^"Rasterization Rules (Direct3D 9)".Microsoft Docs.Retrieved19 April2020.
- ^OpenGL 4.6(PDF).p. 478.
- ^"PlayStation rasterization issues".Libretro.4 October 2016.Retrieved19 April2020.