This book explores real-time graphics programming through the lens of Taos Engine, an open-source WebGPU game engine written in TypeScript.

How the book is organized#
This book builds the engine: a reusable WebGPU foundation that is not tied to any particular game. It starts from the WebGPU API, builds up a complete deferred HDR renderer, and then adds the game-engine layer on top — components, input, audio, UI, networking, and physics — before closing with performance and tooling.
| Topic | What we build |
|---|---|
| WebGPU fundamentals | Device, queue, buffers, textures, bind groups |
| Shader authoring | WGSL — vertex, fragment, compute |
| Render graph architecture | Multi-pass deferred rendering |
| PBR lighting | Directional + point + spot, IBL, BRDF |
| Shadow algorithms | Cascade shadow maps, VSM, spot shadows |
| GPU particle systems | Compute-based spawn/update/compact, billboard rendering |
| Post-processing | Bloom, TAA, SSAO, DOF, tone-mapping |
| Game engine design | Component/entity system, scene graph, input, audio, UI |
| Networking | WebSocket transport, message protocol, authoritative server |
| Physics | Rigid bodies, collision layers, ray casts, character controller |
| Performance & tools | GPU timestamps, async compilation, culling, sample framework, asset pipeline |
Companion books#
Games built on the engine, and subsystems big enough to deserve their own treatment, live in companion books. Each one assumes this book as background and links back into it wherever it builds on an engine system.
| Book | What it covers |
|---|---|
| Computer Graphics: Past to Present | The fundamentals of computer graphics |
| Crafty: Building a Voxel Sandbox Game | A full game built on Taos Engine — block voxel terrain, player physics, NPC AI, game UI, weather, audio, multiplayer gameplay, world persistence |
| Heightmap Terrain | Continuous terrain — CDLOD, virtual texturing, GPU-driven indirect drawing |
| Geospatial Streaming | Planet-scale streaming — 3D Tiles, quantized mesh, screen-space error, floating origin |
| Sample Deep Dives | Long-form walkthroughs of the larger sample programs |
How to read this book#
The canonical companion is the Taos Engine. Each chapter cross-references the relevant source files — you are encouraged to open them side-by-side.
Code blocks are either annotated excerpts (showing the key logic) or
complete listings (the entire file). Excerpts use // ── ... ── markers
to indicate elided boilerplate.
class Chunk {
readonly cx: number; // Chunk X index
readonly cz: number; // Chunk Z index
readonly blocks: Uint8Array; // 16 × 256 × 16 = 65,536 blocks
getBlock(x: number, y: number, z: number): BlockType;
setBlock(x: number, y: number, z: number, type: BlockType): void;
}The Taos Engine philosophy#
No black boxes. The renderer and the engine core are built from scratch — they import only the WebGPU API and the standard library. A few subsystems deliberately lean on established libraries where rewriting them would teach little: rigid-body physics runs on the Jolt engine compiled to WebAssembly, and mesh and texture compression use their reference decoders. Wherever we use a third-party library, we explain why, and how it fits behind a Taos Engine interface.