Start with a little world
The rover, wheels, arch and ramp have actual vertices and triangles in three dimensions. Turning the camera changes their picture; it does not need to change their stored size.
Drive an original little rover behind an arch, turn the camera, and open one pixel of the actual picture. Discover which triangle wins, where its color comes from, and what changes when you add more samples.
Enable JavaScript to change the conditions and run the interactive experiment.
A computer stores a three-dimensional scene, then calculates a two-dimensional picture from one camera. At each sample, triangles compete to be visible. The winning surface supplies a color. Many samples make a picture; many pictures make motion.
The rover is behind an opaque arch. If the rover is drawn last, must it cover the arch?
Keep-nearest testing compares candidates at each covered sample. Turn it off to see the deliberately broken alternative.
The rover, wheels, arch and ramp have actual vertices and triangles in three dimensions. Turning the camera changes their picture; it does not need to change their stored size.
Geometry is transformed toward the camera’s image. Triangles crossing the view boundary are clipped, sometimes becoming several triangles, before their positions are divided by perspective depth.
A triangle can cover all, part or none of an image square. The first mode checks the square’s center. Shared edges use a consistent ownership rule so neighboring triangles do not leave holes or both claim the same boundary.
Each sample keeps a stored depth. A nearer candidate can replace it. The rest of the rover still exists behind an arch, even when that part does not contribute to this image.
The ramp’s checker belongs to coordinates on the ramp. Perspective-correct interpolation keeps those coordinates tied to the surface as it slopes away. Straight screen blending can distort the checker while leaving the outline unchanged.
The surface direction and light direction affect the model’s matte response. Move only the light: the same triangle can stay visible while its color changes. A dark-facing side is not automatically a cast shadow.
In four-sample mode, each square checks four explicit places. Each can see a different surface. The renderer averages their linear colors and encodes the result for the image.
Moving the rover changes the scene state. The renderer makes another image. A target of 60 pictures per second gives about 16.67 milliseconds between pictures, but that number is not a measurement of this device’s GPU.
This renderer uses a right-handed camera looking along negative Z, an OpenGL-style homogeneous clip volume −w ≤ x,y,z ≤ w, and top-left image coordinates. Near and far distances are 0.5 and 35 authored scene units. Those choices are stated rather than mixed with another API’s conventions.
The implementation clips all six homogeneous planes and linearly carries vertex attributes to newly created intersections. It preserves original triangle IDs and separately numbers generated pieces. Dividing a behind-camera vertex and clamping its image position would give a different, incorrect result.
Image vertices are snapped to 1/256 of a pixel for this teaching rasterizer. Positive-area triangles include an edge when its vertical difference is negative, or when it is horizontal and points right. This stated top-left convention gives a shared sample to exactly one adjacent triangle.
Window depth maps the selected perspective projection into [0,1]. It varies nonlinearly with camera distance. The buffer starts at 1 and uses strict LESS. Equal-depth candidates keep the first submission; a sample exactly on the far plane can fail against the clear depth of 1.
For screen weights λ and clip values w, a surface attribute is Σ(λa/w) divided by Σ(λ/w). Already-projected window depth instead uses the straight weighted sum Σ(λd). Applying perspective correction to that depth again would be a mistake.
A normal is perpendicular to a surface. Under a nonuniform object scaling, inverse-transpose transformation preserves that relationship. Treating it like an ordinary direction can produce plausible-looking but incorrect shading. Interpolated normals are normalized before use.
Linear base color is multiplied by 0.1 + 0.9 max(0, n·l). The constants are authored dimensionless coefficients. Physical Lambertian reflection has a ρ/π BRDF; this simple ambient shortcut does not solve full environmental light transport or cast shadows.
A linear value of 0.5 encodes to about sRGB byte 188, not 128. This renderer averages linear sample colors before applying the piecewise sRGB transfer function once. The ramp’s two original colors are specified directly in linear RGB.
Four-sample mode evaluates coverage, depth and shading at quarter-offset positions. It is supersampling, not a claim to implement hardware MSAA. Four points do not exactly integrate the covered area of every possible edge.
The counters count work actually performed by this software renderer: input and clipped triangles, candidate tests, covered candidates, successful writes and final visible samples. None is a GPU shader-invocation count. Doubling width and height quadruples pixel count, but it does not establish a universal fourfold runtime.
The pixel report and lossless image are calculated by the same rasterizer. Optional wire edges and contrast-expanded depth are inspection overlays, and their differences are labeled. Source screenshots are separate graphics tests; their pixels are not substituted for the original scene.
Modern games may use ray tracing, physically based materials, level-of-detail systems, temporal reconstruction and many other techniques. Our opaque triangle pipeline explains a concrete mechanism without claiming that every game uses only these steps.
Resolution, geometry detail, texture filtering and frame targets change different parts of a rendering system. Diagnose the stage instead of treating every graphics option as the same quality dial.
A model may retain its dimensions while its projection changes dramatically. Engineers, artists and game developers use multiple viewpoints and inspectable geometry to understand that difference.
Freeze the conditions, identify the image location and save the evidence. Our JSON and CSV carry the actual surface candidates and color calculation, making a visual claim inspectable.
Fold two paper scraps so they stand on a table. From one fixed viewpoint, arrange for one to hide part of the other. Mark the positions and predict what a sideways move will reveal.
Keep the cards still. Look from a second marked position and sketch the new visible edges. An optional camera can save the two views locally; there is no need to upload them.
Copy an 8 × 8 grid. Put square corners at (1,1), (7,1), (7,7), (1,7), then split it along the diagonal from (1,1) to (7,7). Mark cell centers. In the six-by-six interior, give centers on and above the diagonal to one triangle and those below to the other.
Count the first grid: 21 centers in one triangle, 15 in the other. Now divide each cell into four and compare the edge detail. More coloring work does not measure how a GPU performs.
In the room, light travels from physical cards to your eye or camera. In our software, stored geometry and chosen equations create an image. Record one thing the paper grid explains and one thing it leaves out.
How can the same objects make a different picture?
Use folded paper, not a craft knife or small loose parts. A no-camera option is complete. This exercise is geometric sampling, not an eye model; do not infer device speed from drawing time.
Its projection onto the image The same geometry can cover fewer image samples from a more distant viewpoint.
No; the nearer candidate at each sample wins Visibility is decided at samples. Equal-depth ties remain a separate special case.
Shading The normal’s alignment with the light changes the matte response without moving the geometry.
The surface attributes need perspective-correct interpolation Coverage and texture-coordinate interpolation can fail independently.
Four times as many image pixels Pixel count is width times height. It is not a GPU stopwatch.
Average to linear 0.5, then encode to about byte 188 sRGB is nonlinear. Average the linear-light values before encoding.
The desired interval, not an actual GPU duration A target is not a measured execution time or a promise about all devices.
Their shared coordinates and edge-ownership rule A consistent rule gives each shared-boundary sample to one triangle. The paper fixture covers 21 + 15 = 36 centers with no overlap.
OpenGL 4.6 Core, §§13.7–13.8, 14.6.1 and 17.3.4. Mechanism reference; this bounded software renderer does not implement every operation.
Khronos · OpenGL 4.6 CoreTriangle rasterization and explicit differences between multisampling and per-sample shading. Our chosen coordinate convention is declared separately.
Microsoft · rasterization rulesThe physical Lambertian BRDF is distinct from the authored normalized ambient/direct response in this lesson.
PBRT authors · diffuse reflectionNormals must retain perpendicularity under nonuniform scaling.
PBRT authors · transforming normalsPiecewise transfer function; bounded nonnegative values. Mixing is done in linear light before encoding.
W3C · CSS Color 4glTF 2.0 §§3.8.4 and 3.9. Color textures differ from non-color data such as normal maps.
Khronos · glTF 2.0Asynchronous GPU query semantics; no such timing is claimed by the lesson’s counters.
Khronos · GPU timer queryBrowser animation-frame scheduling and timestamps. A target frame interval and an observed callback interval are separate quantities.
WHATWG · animation framesEd Mackey / Analytical Graphics. Pinned sample asset commit 90d7ede; CC0 metadata with legacy CC BY 4.0 embedded notice preserved.
Ed Mackey · texture coordinate testlexaknyazev. CC0 original source images; differing camera/background prevents treating them as registered pixel differences.
lexaknyazev · linear interpolation testCatmull and Parke, 1972, presented by the holding institution with creator credit. Linked only; film reuse rights not established.
Computer History Museum · Halftone AnimationUniversity of Utah institutional record and abstract for Catmull’s 1974 dissertation. Full thesis was not exhaustively reviewed.
University of Utah · Catmull dissertationIndependent subject review is pending.
Read the sources and model assumptions