Rasterisation

In computer graphics, **rasterisation** (British English) or **rasterization** (American English) is the task of taking an image in a vector graphics format (shapes) and turning it into a raster image. It can then be shown on different screens like a computer display, or video display. It can also be put into a bitmap file format. Rasterization can also be the task of drawing 3D models.

## Where the word comes from

The term "rasterisation" comes .

### Lines

Bresenham's line algorithm can be used to rasterize lines.

### Circles

The Midpoint circle algorithm can be used to rasterize circles.

## 3D images

Rasterization is often used to render 3D models. Unlike things like ray tracing, rasterization is very fast and is used in most realtime 3D engines because of the speed. But, rasterization is the task of figuring out where the shapes in the scene go onto the screen's pixels; it does not say how to figure out the color of the pixels. The color of each pixel is figured out by a pixel shader.

Rasterizing 3D models onto a 2D plane for a computer screen ("screen space") is usually done by fixed (not programmable) function in the graphics pipeline. This is because there is usually no reason to use a different technique to rasterize. It is also because having a system used for doing only this task is very efficient.

### Triangle rasterization

Polygons usually make up digital 3D models. Before rasterization, each polygon is usually made out of triangles. Because of this, rasterization is usually used on triangles.

One thing that is usually needed for rasterization is that two triangles next to each other leave no holes (non-rasterized pixels) between them, so that the rasterized area is completely filled. Also, no pixels should be rasterized more than once. This is needed so that it does not matter what order the triangles are in. Also, rasterizing a pixel more than once wastes time unnecessarily.

**Rasterization rules** are made to make sure that those rules are true. One of those rules are called the **top-left rule**, which means that a pixel is rasterized only if

1. its center is inside the triangle. Or
1. its center is on the triangle _top_ or _left_ edge.

A _top_ edge is an edge that is horizontal and is above other edges, and a _left_ edge is a non-horizontal edge that is on the left side of the triangle.

This rule is used by libraries like Direct3D and many different types of OpenGL (even though OpenGL does not need the rules like this, and only needs a consistent rule).

## Quality

The quality of rasterization can be better by anti-aliasing, which makes "smooth" edges. Sub-pixel precision is one way to do it. It thinks about the positions on a smaller scale than pixels. It can still do something even if the endpoints of a primitive are all on the same pixel, which can make the primitive move smoother. Old hardware, like the PlayStation 1, did not have sub-pixel precision in 3D rasterization.

## Related pages

- Raster image processor for 2D rasterization in printing systems
- Vector graphics for the source art
- Raster graphics for the result

## Other websites

- Michael Abrash’s articles on computer graphics
- Microsoft’s DirectX API.aspx)
- OpenGL API
- Matrices (including transformation matrices) from MathWorld
- Rasterization, a Practical Implementation