Domain: Real-Time Graphics and Game Engine Architecture
Abstract:
This presentation details the architectural design and implementation of a proprietary game engine optimized for high-fidelity, dynamic modification of world geometry using Signed Distance Fields (SDFs). The core challenge addressed is maintaining high performance while allowing real-time, complex geometric edits (union, subtraction, smoothing), which typical brute-force ray marching techniques cannot sustain. Performance is achieved via a novel caching mechanism: the distance function is sparsely evaluated and stored in a GPU-optimized structure called a "brick map," which utilizes 8x8x8 volumetric bricks within a texture atlas, indexed by a dense pointer grid. To facilitate vast, open-world environments, the engine incorporates a multi-resolution Level of Detail (LOD) system inspired by geometry clip maps, resulting in a 10 million-fold reduction in required cache memory for large draw distances. Updates to the geometry are handled incrementally, leveraging an Axis-Aligned Bounding Box (AABB) tree (BVH) shared between the CPU and GPU to localize re-evaluation only to affected cache regions. Physics collision is managed by generating low-resolution triangle meshes via marching cubes on parallel CPU threads, integrating with the Jolt physics engine. The architecture successfully enables advanced gameplay features, including non-destructive dynamic tunneling and kilometer-deep volumetric digging.
Signed Distance Field Game Engine Architecture: Key Implementation Details
0:02 Core Motivation: The engine is based on Signed Distance Fields (SDFs) to facilitate high-fidelity, non-destructive, and real-time modifications to world geometry during gameplay, differentiating it from low-fidelity dynamic geometry approaches.
0:39 SDF Operations: SDFs enable straightforward geometric boolean operations (union, subtraction, intersection), including smoothed blending of shapes.
3:09 Performance Strategy (Caching): To overcome the performance limitations of brute-force SDF ray marching, the engine utilizes caching by evaluating the complex distance function only once on a grid and reusing these values during rendering.
5:40 Distance Approximation: The distance to the surface is approximated at any point via bilinear (in 2D) or trilinear (in 3D) interpolation of the cached distances at the grid points of the surrounding cell. This calculation requires only a single GPU texture fetch.
7:49 Scalability Challenge: Dense caching across a full 3D grid is memory-prohibitive for large scenes (e.g., 1024^3 grid uses 1 GB of memory even at 1 byte per distance).
8:44 Sparse Caching (Brick Map): The solution is sparse caching, focusing only on cells containing the SDF surface (zero-crossing). This is implemented via a brick map: a dense grid of pointers referencing small 8x8x8 cubic "bricks" of cached distance values, which are stored in a large texture atlas.
11:13 Level of Detail (Clip Maps): Large scene support is achieved using a multi-resolution LOD system inspired by geometry clip maps. A nested set of grids, centered on the player, successively double in size, ensuring distance evaluation occurs at a coarser resolution further from the camera. This system yields a 10 million-fold reduction in required memory compared to a full-range dense grid.
13:04 Incremental Regeneration: Fast dynamic updates are supported by incrementally regenerating only the specific world regions that have changed.
13:18 Spatial Tracking: All SDF edits are spatially tracked using an Axis-Aligned Bounding Box (AABB) tree (a BVH structure) shared between the CPU and GPU, which is used to localize SDF evaluation and determine which cached distance bricks need re-evaluation.
14:32 Physics Integration: Collision detection utilizes the Jolt physics engine. The SDF is not used directly for physics; instead, a low-resolution triangle mesh is generated from the SDF via marching cubes on parallel CPU threads to provide low-latency updates to the physics system.
15:41 Terrain Structure: The terrain is a fully 3D volume (not a height field), generated progressively using octaves of noise, and properly interacts with all dynamic SDF edits.
16:36 Dynamic Gameplay Capabilities: The engine supports an effectively unbounded number of dynamic SDF edits, enabling non-destructive mechanics like creating kilometer-deep tunnels, dynamic subtraction volumes ("tunnel gun"), and volumetric stamping of materials (e.g., digging into ore deposits).
18:21 Development Tools: Extensive debug visualizations are integrated to monitor the dynamic AABB tree, brick allocation changes, and LOD transitions, facilitating system debugging and architectural understanding.