Taos Engine

Preface

Taos Engine: Building a Modern WebGPU Game Engine

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

Taos Engine Game Engine
Taos Engine Game Engine

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.

TopicWhat we build
WebGPU fundamentalsDevice, queue, buffers, textures, bind groups
Shader authoringWGSL — vertex, fragment, compute
Render graph architectureMulti-pass deferred rendering
PBR lightingDirectional + point + spot, IBL, BRDF
Shadow algorithmsCascade shadow maps, VSM, spot shadows
GPU particle systemsCompute-based spawn/update/compact, billboard rendering
Post-processingBloom, TAA, SSAO, DOF, tone-mapping
Game engine designComponent/entity system, scene graph, input, audio, UI
NetworkingWebSocket transport, message protocol, authoritative server
PhysicsRigid bodies, collision layers, ray casts, character controller
Performance & toolsGPU 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.

BookWhat it covers
Computer Graphics: Past to PresentThe fundamentals of computer graphics
Crafty: Building a Voxel Sandbox GameA full game built on Taos Engine — block voxel terrain, player physics, NPC AI, game UI, weather, audio, multiplayer gameplay, world persistence
Heightmap TerrainContinuous terrain — CDLOD, virtual texturing, GPU-driven indirect drawing
Geospatial StreamingPlanet-scale streaming — 3D Tiles, quantized mesh, screen-space error, floating origin
Sample Deep DivesLong-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.