Rasterization

Also known as: rasterisation

On this page 7

Rasterization is the process of converting geometric primitives, almost always triangles, into the discrete pixels of a raster image by determining which pixels each primitive covers and computing a color for them. It is the foundation of Real-time 3D: games, interactive visualization, WebGL applications and virtual production all depend on it because modern GPUs execute it in dedicated hardware at enormous speed.

In 3D graphics & animation, rasterization is usually contrasted with ray tracing. Rasterization works object by object, projecting each triangle onto the screen, while ray tracing works pixel by pixel, tracing rays into the scene. The British spelling rasterisation describes the same technique.

How rasterization turns triangles into pixels

Rasterization is one stage within the larger graphics pipeline, preceded by geometry processing and followed by per-pixel shading and output merging. Each triangle passes through a fixed sequence of steps before it contributes to the final image.

The table below lists the main stages in the order a GPU performs them.

StageWhat happensProgrammable
Vertex shadingVertices are transformed into clip spaceYes, vertex shader
Clipping and cullingOff-screen and back-facing triangles are removedNo, fixed function
Perspective divideClip coordinates become normalized device coordinatesNo, fixed function
Viewport transformCoordinates are mapped to screen pixelsNo, fixed function
Triangle setup and coveragePixels or samples inside the triangle are foundNo, fixed function
Fragment shadingColor is computed for each covered pixelYes, fragment shader
Depth test and blendingVisibility is resolved and results are mergedConfigurable
Stages around the rasterizer in a GPU pipeline

Coverage is decided with edge functions, simple linear equations that tell on which side of each triangle edge a sample point lies. A sample inside all three edges belongs to the triangle. A strict top-left fill rule settles samples that lie exactly on a shared edge, so that adjacent triangles never draw the same pixel twice or leave a gap.

Interpolation, depth and visibility

Once a pixel is known to be covered, the rasterizer interpolates vertex attributes such as texture coordinates, normals and colors across the triangle using barycentric coordinates. Interpolation must be perspective-correct, dividing by depth, otherwise textures appear to swim and bend on surfaces that recede from the camera.

Rasterization by itself does not know which surface is in front. Visibility is solved by the Z-buffer, a per-pixel depth store: a new fragment is kept only if it is closer than the value already recorded. Limited depth precision causes Z-fighting when two surfaces lie almost at the same depth, a problem reduced by sensible near-plane distances or a reversed depth buffer with floating-point values.

The parameters below have the strongest influence on rasterization quality and cost.

ParameterTypical valuesWhat it affects
Output resolution1080p to 4K per frameNumber of pixels shaded
MSAA sample count1, 2, 4 or 8 samples per pixelEdge smoothness and memory
Depth buffer format24-bit integer or 32-bit floatPrecision and Z-fighting
Triangle countThousands to millions per frameGeometry load and small-triangle cost
OverdrawOne to several layers per pixelWasted fragment shading
Key parameters that shape rasterization results

Rasterization compared with ray tracing

The essential difference is the direction of the question. Rasterization asks which pixels a given triangle covers, while ray tracing asks which surface a given pixel sees. This makes rasterization extremely efficient for primary visibility, but weak at effects that depend on light bouncing between surfaces.

AspectRasterizationRay tracing
Loop orderFor each triangle, find pixelsFor each pixel, find surfaces
Speed on GPUsVery high, mature hardwareLower, accelerated by RT cores
ShadowsApproximated with shadow mappingComputed with shadow rays
ReflectionsScreen space or probe approximationsPhysically traced reflections
Global illuminationBaked or approximatedPath traced, often denoised
Main useReal-time renderingOffline rendering, hybrid real time
Rasterization and ray tracing side by side

Most current engines are hybrid renderers: rasterization produces the G-buffer or primary image, and ray tracing adds selected effects such as reflections or shadows. Pure rasterization remains dominant on mobile devices and in WebGL.

Optimizing rasterization in real-time engines

Performance in a rasterizer depends on avoiding unnecessary work before and after the coverage stage. Many neighboring techniques in real-time 3D exist mainly to feed the rasterizer fewer or cheaper triangles.

  • Frustum culling and occlusion culling discard objects that cannot appear on screen.
  • Backface culling skips triangles facing away from the camera, roughly halving closed-mesh work.
  • Level of detail swaps distant models for lighter versions with fewer triangles.
  • Early depth testing and a depth prepass reject hidden fragments before expensive shading.
  • Deferred shading separates geometry rasterization from lighting to limit lighting cost per pixel.

Mobile GPUs often use tile-based rasterization, dividing the screen into small tiles processed in on-chip memory to save bandwidth. Some modern engines also run software rasterization in compute shaders for very small triangles, where fixed-function hardware becomes inefficient.

Artifacts and limitations of rasterization

Because rasterization samples continuous geometry on a discrete pixel grid, it inherits sampling artifacts. The most visible is aliasing, the stair-step pattern on edges, along with several performance pitfalls that only appear at scale.

ArtifactCauseRemedy
Jagged edgesOne coverage sample per pixelMSAA, FXAA or temporal antialiasing
Z-fightingInsufficient depth precisionReversed float depth, adjusted near plane
Texture shimmeringUndersampled distant texturesMipmapping and anisotropic filtering
Slow tiny triangles2×2 pixel quad shading overheadLevel of detail or software rasterizer
Shadow acneDepth comparison errors in shadow mapsDepth bias and normal offset
Common rasterization artifacts with causes and remedies

A common misconception is that rasterization is obsolete because of ray tracing. In practice, it remains the fastest method for primary visibility and is likely to stay at the core of interactive rendering for years, with ray tracing layered on top where quality justifies the cost.

In simple terms

A computer screen is a grid of tiny colored squares called pixels, while a 3D scene is made of flat triangles floating in space. Rasterization is the step that decides which squares each triangle covers and what color they should be.

Think of laying a stencil shaped like a triangle over graph paper and filling in every square inside its outline. The graphics card does this for millions of triangles, many times per second, and keeps only the nearest one at each square. This speed is why video games can draw detailed worlds instantly.

A practical example

A team developing a racing game for current consoles targets 60 frames per second at 1440p, which leaves about 16.7 milliseconds to render each frame. Profiling shows that a dense forest beside the track sends almost four million triangles to the rasterizer, many of them smaller than a pixel.

The engineers add aggressive level of detail for the trees, enable occlusion culling behind hills and introduce a depth prepass so that hidden leaves are rejected before the fragment shader runs. Overdraw in the forest drops from about five layers to under two. Frame time falls by roughly four milliseconds, and the game holds its 60 frame target without lowering resolution.