notesonly.in

One notebook for every subject — open it anywhere.

Log in

Rendering Pipeline Basics: Complete Beginner's Guide

The rendering pipeline is the sequence of steps a computer follows to turn 3D data — positions of points in space — into the 2D image you see on screen. Every video game, 3D animation, and CAD program runs this pipeline dozens of times per second. It takes raw geometry, determines what the virtual camera sees, colours each pixel, and writes the result to display memory.

It matters because it is the foundation of all computer graphics. Whether you want to build games, work with OpenGL or WebGL, or simply understand why a graphics card matters, you need this mental model of how triangles become pictures.

Key Concepts

  • Vertex: a single point in 3D space, usually with extra data like colour or texture coordinates. Three vertices make a triangle — the basic building block of 3D models.
  • Shader: a small program that runs on the GPU. The vertex shader processes each vertex; the fragment shader colours each pixel.
  • Rasterization: the step that converts triangles into fragments — the candidate pixels the triangle covers on screen.
  • Fragment: a potential pixel carrying interpolated data (colour, depth) from the triangle's vertices.
  • Framebuffer: the memory holding the final image; the depth buffer alongside it records how far each pixel is, so nearer objects hide farther ones.
  • FPS: frames per second. At 60 FPS, the whole pipeline must finish each frame in under 16.67 milliseconds.

How It Works

  1. Vertex processing: the vertex shader transforms each vertex from model space to screen space using matrices (model, view, projection).
  2. Primitive assembly: vertices are grouped into triangles.
  3. Rasterization: each triangle becomes the fragments (pixels) it covers, with vertex data interpolated across them.
  4. Fragment shading: the fragment shader computes each fragment's final colour — applying lighting, textures, and effects.
  5. Output merging: depth testing discards fragments hidden behind nearer ones, and surviving colours are written to the framebuffer, which the display shows.

Worked Example

A game targets 60 FPS, so each frame gets 1000 ÷ 60 ≈ 16.67 milliseconds. A full-HD screen is 1920 × 1080 = 2,073,600 pixels. If a full-screen effect shades every pixel once, the GPU colours about 2.07 million fragments per frame, or 2,073,600 × 60 ≈ 124 million fragments per second. 1 million triangles × 3 vertices = 3 million vertices through the vertex shader per frame. This is why GPUs have thousands of cores — the pipeline's work is massively parallel, with every vertex and fragment processed independently.

Common Misconceptions

  • "More triangles always mean better graphics." Beyond a point, extra triangles are invisible — smaller than a pixel. Smart games use level-of-detail models, swapping simpler versions for distant objects.
  • "The CPU does the rendering." The CPU prepares data and issues commands, but the heavy parallel work — transforming vertices and shading millions of pixels — runs on the GPU.
  • "Rasterization is the only way to render." It is the standard for real-time graphics, but ray tracing (simulating light rays) produces more realistic images and is increasingly used alongside it in modern games.

Real-World Applications

The rendering pipeline drives every video game, from mobile games to AAA titles, and every 3D animation film's preview rendering. CAD software for engineering, architecture tools, and medical imaging all use it to display 3D data interactively. Web browsers run a version of it through WebGL for 3D product viewers and maps. Understanding the pipeline is the first step toward graphics programming with OpenGL, Vulkan, DirectX, or WebGL.

In short: the pipeline converts 3D triangles into 2D pixels via vertex processing, rasterization, fragment shading, and output merging — massively parallel and timed against the frame budget.