The engine
A tour of the WebGPU engine that draws every World, one folder at a time.
View as MarkdownThe engine is written directly on WebGPU, with no framework in between. It started as Tidewater, Daniel Greenheck's ocean and island renderer, and Orbium has grown it with what its games need: grass, wind-blown sand and snow, tracks in the ground, dust, a sky full of far things. It lives in engine/ and knows nothing of the games.
The folders
| Folder | What it does |
|---|---|
gpu/ | The device, buffers and textures, WGSL modules, compute kernels |
render/ | Materials, the mesh renderer, shadows, full-screen passes |
scene/ | Objects, groups, meshes and cameras |
math/ | Vectors, matrices, quaternions, frustums (pure: the server uses it too) |
terrain/ | The island's ground, its level of detail, rocks, the shore field |
ocean/ | The sea: FFT waves, shore waves, surf, foam, caustics |
sky/ | The atmosphere, clouds and the environment light |
post/ | Upscaling, ambient occlusion, haze, motion blur, bloom, the underwater lens |
fx/ | Particles: spray, dust, sand and snow on the wind, marine snow |
vegetation/ | Grass, pushed down by whatever moves through it |
materials/ | The scene's lighting and local lights |
audio/ | The mixer: placed sounds, ambience, the muffle under water |
A frame
Each frame, every system updates on the CPU, then records its GPU work into one command encoder, sent to the GPU in a single submit:
- Simulation, in compute passes: the atmosphere's lookup tables, the ocean's FFT, the surf, caustics, particles, clouds, terrain and grass selection.
- Shadows: cascaded maps of the sun, the far cascades updated less often.
- The scene: opaque meshes and the sky, then everything under the water at half resolution (for refraction), then the water and transparent objects.
- Post: ambient occlusion, haze and light shafts, temporal upscaling, motion blur, lens flare, bloom, exposure, grading and tone mapping.
The graphics presets switch whole systems off and change the resolution and budgets: see requirements.
Procedural, not loaded
There are no model or texture files. The terrain is generated from noise, the rocks are shaped from seeds (RockShape.js), foam and detail textures are generated on the GPU at start. A World costs a few megabytes, most of it sound.
Next
- WebGPU in Orbium: how the engine talks to the GPU.
- The ocean: the first system in depth.