Case study · Graphics systems
A voxel world that runs on the GPU.
A from-scratch DirectX 12 engine that streams an infinite editable world, generates terrain on the GPU, and keeps your edits alive as the world moves.
- Stack
- C++20 · DirectX 12 · HLSL · DXC · CMake / Ninja · vcpkg · Dear ImGui
- Status
- Active graphics tech demo · MIT
- Role
- Solo — engine, renderer, shaders, streaming, physics, capture harness
- Platform
- Windows 10 / 11 · DirectX 12 GPU
01 The problem
Voxel worlds stress every part of a renderer at once. The world is larger than memory, the camera moves faster than generation, and the player expects to change geometry that is being streamed underneath them. A dense buffer solves this by holding a moving window and hoping the window is enough. It is simple, and it stops being simple the moment the window boundary is visible.
Venpod takes the harder route. The unit of streaming is a stable world-space brick, not a position in a moving buffer. That costs explicit residency planning, an asynchronous upload path and a real page-table protocol. It buys a world that stays still while the renderer moves.
The CPU decides what exists. The GPU is told what may be drawn.
02 The approach
The frame loop is a sequence of ownership decisions. The planner selects bricks for the camera, movement, brush, feedback, collision and near-ownership holes. Bricks are generated on the GPU and edited overlays are replayed. Uploads are staged under frame and byte budgets. The near field is rasterized from extracted quads; mid and far layers fill the rest. Readbacks for raycast, miss feedback, ownership, brush and physics return on a later frame.
- PlanInput and camera drive a sparse residency planner that scores near bricks, brush intent, collision, feedback and ownership holes.
- GenerateDeterministic 16×16×16 bricks are produced on the GPU from world-space terrain fields, with persistent edit overlays replayed on top.
- PublishBrick payloads and occupancy copies are queued, then the GPU page-table entry is released only when both frame and fence readiness are satisfied.
- RenderExtracted sparse quads cover the near field with depth and stencil; a shader fills the remaining pixels with mid clipmaps, a far sparse voxel octree, sky and controlled fallback.
- SimulateLocal dirty-region physics runs on the CPU by default; GPU proposal paths are accepted only after CPU validation.
- DiagnoseA Dear ImGui overlay and scripted capture and regression harnesses record residency, ownership and pixel coverage.
03 Publication order
The CPU brick pool is the authority; the GPU page table is a delayed visibility snapshot. A publish carries the entry index, brick coordinate, physical page, generation, residency class, ready frame and ready fence. It is withheld until frame and fence readiness agree, stale pending publishes are dropped, and a newer generation can replace an older entry in a reused slot.
That is the mechanism that keeps streaming from rendering garbage. Every resource transition, descriptor, allocator, fence and command-list lifetime is explicit — there is no render graph and no engine to hide a synchronisation bug.
- EntryPage-table slot being replaced
- BrickWorld-space coordinate of the 16³ payload
- PagePhysical page the payload landed in
- GenerationMonotonic id; a newer generation evicts an older occupant
- ResidencyClass the planner assigned the brick
- ReadyFrame and fence the publish may not precede
04 Rendering
The near field is rasterized from extracted sparse quads. A full-resolution terrain LOD mesh runs as an always-present floor, so every distance band renders real stepped voxel geometry with distance-capped quad sizes, slope-aware refinement and resident-aware LOD suppression. Mid and far layers — clipmaps and an asynchronous sparse voxel octree — fill whatever the quads do not cover.
At 200+ units per second the streamer can fall briefly behind the camera. The engine answers with an analytic fill instead of holes, and a CPU-fed streamed-radius guard stops un-streamed terrain from appearing as false water or sky.
05 Editing
Terrain is generated, evicted and regenerated, so an edit cannot live in the generated data. Venpod stores edits as a sparse per-brick overlay and replays them over regenerated terrain. That is what makes the world persistent without pinning the whole region in memory — brush changes survive eviction, reload, and a save between runs.
Painting works during traversal: a traversal brush handoff finishes line-of-sight painting as a ramp near the player's feet, so bridges, ramps, stairs and platforms persist as the render window moves. Sand- and water-style materials flow and settle in local dirty regions; GPU raycast, brush feedback and physics packets exist as guarded apply paths and commit only when their header and sentinel records report zero missing residents, no overflow and no duplicate edit coordinates.
06 Evidence
The media above is captured from the engine through its own DX12 capture path, not mocked. A scripted regression gate runs flight scenarios and checks ownership and pixel coverage against the runtime log; democapture.ps1 records video and full-resolution stills, and sparse_regression.ps1 is the gate. The build and launch path is documented and scripted through setup.ps1 and rebrun.ps1.
- Sparse brick
- 16³
- Dense chunk
- 64³ · 1 MB
- Terrain range
- Y −332 … 664
- Far cliffs
- ~5 km, stepped
- Flight
- 200+ u/s
Frame rate is deliberately absent here. The repository records a measured fidelity and frame-time trade at distance, and publishing a number would imply a benchmark the project does not claim.
07 Limits
Venpod is a graphics programming tech demo, not a packaged game engine. The limits are part of the design record.
- Legacy path retained. The sparse renderer is the active path; dense legacy stays for regression comparison and public fallback.
- Guarded hybrid. GPU brush feedback and physics proposal application are diagnostics with CPU sparse authority underneath, not a replacement for it.
- Coarser distance by design. Cliffs beyond about 5 km render as stepped geometry — a measured fidelity and frame-time trade, not an oversight.
- Extreme flight outruns streaming. Above roughly 200 units per second the streamer can lag the camera; un-streamed terrain falls back to an analytic fill rather than holes.
- Review suites stay out of git. Curated demo media ships in the repository; the broader capture suites are generated on demand.