Graphics › Drawing it
Rasterization
Turning a triangle of three points into a filled patch of pixels — and blending colour, depth and texture smoothly across it with barycentric coordinates.
From three points to a fill
After the viewport transform a triangle is three pixel positions. Rasterization decides which pixels lie inside it. The classic test: for each candidate pixel, compute its position relative to each edge with a 2D edge function (basically a cross product). If the pixel is on the inside of all three edges, it's covered. GPUs do this for a whole block of pixels at once, in parallel.
Barycentric coordinates: blending across the triangle
Any point inside a triangle ABC can be written as P = αA + βB + γC with α + β + γ = 1 and all three ≥ 0. Those weights (α, β, γ) — the barycentric coordinates — are exactly the “how much of each corner” you need to interpolate anythingper-vertex: colour, texture coords, normals, depth. At a corner one weight is 1 and the others 0; at the centroid all three are ⅓.
Don't interpolate linearly in screen space
attribute / w and 1 / w across the triangle, then divide — perspective-correct interpolation. Skip it and textures swim and warp (the unmistakable PS1 look).Coverage, edges and anti-aliasing
A pixel rarely sits perfectly inside or outside — its little square straddles an edge. Treat that as binary and you get stair-step jaggies. Anti-aliasing estimates the fraction covered: MSAA tests several sample points per pixel and averages; analytic AA computes the exact coverage area; post-process AA (FXAA, TAA) cleans it up afterward. It's all about that fractional edge coverage.
Why depth-test per fragment
Two triangles can cover the same pixel. The interpolated NDC z goes through the depth buffer: keep the nearer fragment, discard the farther. Order-independent — you can submit triangles in any order and the picture comes out right (except for transparency, which still needs back-to-front sorting or special tricks).