Computer Graphics: Past to Present

Changelog

The book will continue to evolve as I find mistakes, make improvements, add new content. I'll try to keep track of the changes here, in case you want to see what's changed.

WebGPU compatibility mode.

On older GPUs and drivers that can't run full WebGPU, the book now asks for WebGPU's compatibility mode, a smaller version of it, and nearly every live figure and code playground runs there too. The few that need full WebGPU show their recording. Chapter 38 also links to the video splat trainer, for training Gaussian splats on your own footage.


Recordings where WebGPU is missing.

In a browser without WebGPU, the live WebGPU demos and code playgrounds from Chapter 16 on used to show only an error. They now show a recording of what the demo or code draws, animated where the demo moves, with a note that it would be interactive in a browser that supports WebGPU.


Neural denoisers.

Chapter 38 has a new part on neural denoisers: what they see, why they predict filter weights instead of pixels, and how they're trained. A live sample path traces a small room at one sample per pixel and trains a tiny denoiser in your browser, scored against a hand-tuned filter on a view it never trained on.


A clear license for the code.

The book's code, including the interactive figures and playgrounds, is now under the MIT No Attribution License (MIT-0): copy it, change it and use it anywhere, with no attribution required. Every chapter's footer says so, and pages saved from a figure's or playground's source carry the notice too. The text of the book remains copyrighted.


Chapter code and example expansions.

A few chapters have been expanded with new code and examples. Their lack of detail had been bothering me, as my goal is to provide enough detail for readers to implement the techniques themselves.
Changes include:

  • Chapter 12: Normals from a height map, and normal mapping with a tangent frame.
  • Chapter 13: The shadow test, mirror reflection, and refraction and Fresnel for glass.
  • Chapter 20: Cascaded shadow maps, including cascade splits, fitting and snapping, and picking and blending cascades in the shader.
  • Chapter 22: Spherical harmonics, light probes, leaks, and DDGI's visibility test.
  • Chapter 24: Gathering a hemisphere for an irradiance map, and box-projected reflection probes.
  • Chapter 25: The bloom mip chain, and the circle of confusion for depth of field.
  • Chapter 27: Evaluating Catmull-Rom and B-spline curves, and turning a Bézier patch into triangles.
  • Chapter 28: FABRIK inverse kinematics, with a new playground, plus blending poses and blend shapes.
  • Chapter 30: Ball collisions, and the advection and pressure steps of a grid fluid.
  • Chapter 31: Temporal antialiasing, including the Halton jitter, jittering in the vertex shader, and the resolve pass that reprojects, clips and blends the history.
  • Chapter 32: ReSTIR, including resampled importance sampling with a reservoir, the weight that keeps it correct, and merging reservoirs across pixels and frames.
  • Chapter 33: Contact shadows, and Hi-Z ray tracing.
  • Chapter 34: Writing and resolving a visibility buffer.
  • Chapter 35: The Henyey-Greenstein phase function, Rayleigh and Mie scattering in the sky, and froxel indexing.
  • Chapter 36: Building a BVH with the surface area heuristic, one à-trous denoising pass, and SVGF's variance-guided weight.
  • Chapter 37: Gerstner waves, FFT butterfly stages, and foam.
  • Chapter 38: Volume rendering a radiance field, and projecting and blending Gaussian splats.


Bindless resources.

Chapter 34 has a new part on bindless resources: why one draw per material holds GPU-driven rendering back, and how a single table of textures fixes it, with a figure that compares the two. It follows WebGPU's resource table proposal, which is still a draft; the part will be updated, with a live sample, once the feature ships.


Virtualized geometry.

Chapter 34 has a new part on cluster hierarchies: how they're built and cut, with a diagram of the hierarchy and a live sample that draws two million triangles' worth of asteroids.


Train a NeRF and Gaussian splats.

Chapter 38 now has two live trainers that learn the same small scene from 24 photographs, a radiance field and a set of Gaussian splats, and score each on a view neither was trained on. Slice through the field, or swirl the splats, to see what each one is made of.


Shadow acne up close.

Chapter 20 now has a small sample of a real, tiny shadow map, where you can change its resolution and compare no bias, constant bias, slope-scaled bias and normal offset as the sun gets lower.


Paint a terrain.

Chapter 37 now has a live sample where you paint grass, dirt, rock and snow onto a terrain's splat map, and toggle the slope rules, height blending and triplanar mapping.


Reflections in 3D.

Chapter 22 now has a live 3D sample that compares a reflection probe, a box-projected probe and screen-space reflections with ray-traced reflections, and shows where SSR's rays fail.


Compare ambient occlusion methods.

Chapter 33 now covers HBAO+, and has a live 3D sample that compares kernel SSAO, HBAO, HBAO+ and GTAO with ray-traced ambient occlusion in the same scene.


Blur the SSAO sample.

The SSAO playground in Chapter 22 now has a blur pass you can turn off to see the raw noise, and the section points ahead to the better methods in Chapter 33.


Book search

I added a search feature to the book. It uses a simple client-side search engine. It doesn't search into sample code.


Expand Lightmaps section.

Chapter 22 section on lightmaps was sparse as I hadn't finished the sample. I finished it and expanded the text. Realtime GI is replacing the need for lightmaps, but they still play an important role, and I thought they needed more attention in the book. Hopefully I caught all the mistakes from my previous draft.


Add section on tiled memory.

Chapter 21 now has a section on tile-based memory, which is how most phone and tablet GPUs work. It explains why they are more power-efficient than desktop GPUs, and how that affects the cost of different rendering techniques.


Clean up the sample code.

The code behind every interactive figure has been rewritten to be easier to read, with one statement per line, clearer names and more comments. The figures themselves work exactly as before.


Update title page hero sample.

Flat shading is a bit boring, so I added a lighting model to the title page hero sample.


Source for the live code.

Live-code playgrounds now have a source button too, which shows the code as a complete page you can save or open in a new tab, including any edits you've made.


Links to sections.

Every section, figure and playground now has a # link, so you can link straight to it.



Expanded the neural field playground

The last section of Chapter 38, "An image stored in a network", was a single paragraph in front of a hundred and forty lines of code. I hadn't finished writing the expanded version, so I've added more details and explanations.


Reworked many-lights sampling figure

I've reworked Chapter 32's interactive many lights sample. It was too hard to see what it was doing before. I added the missing ReSTIR mode, added a denoiser, and used a split screen to show what the unoptimized full render looks like.