3D ACCEL, 1996
When hardware took over the triangle, the pipeline became something you configure rather than write. This era spells out the fixed-function path stage by stage: model, view and projection matrices, rasterisation, shading, texture mapping and the z-buffer.
Graphics track · 27 missions · boss mission, written exam and certificate · free, no signup. Everything below runs in the browser terminal on the SERVBG home page.
What you will do
- put the reference scene on screen as a textured quad
refTwo triangles, four vertices, one texture. Every frame of every 3D game in 1996 was this operation repeated a few thousand times.
- list the 8 cube vertices in object space
vertex listObject space is the model on its own terms. A cube of side 2 centred on the origin knows nothing about the camera yet.
- print the model matrix: object space to world space
model rotateA 4x4 matrix holds rotation in its upper-left 3x3 and translation in its right column, which is the only reason 3D graphics uses 4 numbers for a 3D point.
- print the view matrix: world space to camera space
viewThere is no camera in hardware. Moving the eye to +Z is identical to translating the whole world by -Z, so the view matrix is the inverse of the eye placement.
- print the projection matrix for a 60 degree field of view
proj 60The -1 sitting in row 4 column 3 copies -z into w. The matrix does not divide anything; it loads the divisor that the perspective divide will use.
- combine all three and follow one vertex to a pixel
mvpObject to clip to NDC to viewport. Until the GeForce 256 in October 1999 this multiply ran on the host CPU, per vertex, per frame.
- see the cube as 12 triangles with their winding
triHardware rasterises triangles rather than quads because three points are always planar and always convex, which makes the span endpoints on every scanline just two edges.
- throw away the triangles facing away from the camera
cull onThe signed area of a projected triangle tells you which way it faces. On a closed solid that discards half the triangles before any pixel work, for the cost of one cross product.
- draw the edges only
raster wireWireframe is what a transform pipeline gives you before a rasteriser exists. Every CAD workstation of the 1980s looked like this.
- fill each triangle with a single colour
raster flatA pixel is inside the triangle when all three edge functions agree on sign. Walk the bounding box, test the sign, write the pixel: that is a scanline fill.
- add a diffuse lambert term
light onN dot L is the cosine of the angle between the surface normal and the light direction. Diffuse lighting is one dot product and a clamp, nothing more.
- compute lighting per vertex and interpolate it across the face
raster gouraudHenri Gouraud published this interpolation in 1971. Three dot products per triangle instead of one, and the flat banding disappears.
- upload the reference image as a 64x64 texture
texture refA Voodoo Graphics board held 2 MB of texture memory on a bus separate from its 2 MB frame buffer, and no single texture could exceed 256x256.
- sample the texture per pixel
raster texturedu/w and v/w interpolate linearly across a span and are divided by the interpolated 1/w at each pixel. Skipping that divide is affine mapping, and it is why early textured floors appeared to swim.
- see what happens to intersecting geometry with no depth test
zbuffer offTwo triangles that pass through each other cannot be sorted. Neither one is behind the other, so any per-polygon ordering gets the intersection wrong.
- turn on the per-pixel depth test
zbuffer onOne depth value per pixel, compared and conditionally written. At 640x480 a 16-bit depth buffer is 614,400 bytes, about a third of the 2 MB frame buffer a Voodoo Graphics carried.
- build the 64/32/16/8 chain and pick a level per pixel
mipmap onLance Williams described the mip pyramid in 1983. It costs 33% more texture memory and removes the sparkle you get from point-sampling a texture below its own detail rate.
- sample one texel per pixel
filter nearestOne fetch per pixel is the cheapest thing a texture unit can do, and at two times magnification you see the texel grid directly.
- blend the four nearest texels
filter bilinearFour fetches per pixel instead of one. Texture memory bandwidth, not arithmetic, was the resource 1996 boards ran out of first.
- blend distant pixels toward a fog colour
fog onLinear fog reuses the 1/w the texture stage already interpolated, so it costs almost nothing, and it let a card stop drawing distant geometry without a visible pop.
- read the counters from the last frame
statsPixels shaded is the number that matters. Shading a pixel a nearer triangle later covers is overdraw, and the depth test only prevents it when the nearer triangle arrived first.
- compare this rasteriser with 1996 silicon
benchVoodoo Graphics did roughly 50 million pixels per second, one per clock at 50 MHz, with bilinear filtering and the depth test inside that same clock.
- the four years that settled consumer 3D
cards3dfx shipped Voodoo Graphics in October 1996; id Software released GLQuake in January 1997; the Riva TNT arrived in 1998; the GeForce 256 in October 1999.
- see what hardware transform and lighting actually moved
tnlThe GeForce 256 did not change the shape of the pipeline in October 1999. It moved the line between CPU and chip so that transform and lighting fell on the card side.
- compare Glide, OpenGL 1.1 and Direct3D 5/6
apiGlide was a thin wrapper over one vendor's registers, OpenGL 1.1 a portable state machine, Direct3D 5 the version that replaced execute buffers with DrawPrimitive. All three drove the same fixed pipeline.
- animate the cube and run the whole pipeline every frame
spinA 1996 game loop rebuilt this entire chain of stages every frame at 320x240 and treated 30 frames per second as a good result.
- Boss missionevery stage on at once - textured, gouraud lit, depth tested, culled, mipmapped, bilinear, spinning
renderTransform, cull, rasterise, depth test, sample, shade, fog. Each stage a fixed job with knobs you set and could not rewrite. Breaking that limit is what the shader era is for.
Certificate
This track is certifiable. Clear the boss mission in the terminal, then run EXAM ACCEL3D for the written paper: 20 server-graded questions drawn from our own bank, pass mark 14 of 20. The certificate is issued once both are done, and it carries a verification code.