SpawnDev.VoxelEngine
0.2.0-rc.4
Prefix Reserved
dotnet add package SpawnDev.VoxelEngine --version 0.2.0-rc.4
NuGet\Install-Package SpawnDev.VoxelEngine -Version 0.2.0-rc.4
<PackageReference Include="SpawnDev.VoxelEngine" Version="0.2.0-rc.4" />
<PackageVersion Include="SpawnDev.VoxelEngine" Version="0.2.0-rc.4" />
<PackageReference Include="SpawnDev.VoxelEngine" />
paket add SpawnDev.VoxelEngine --version 0.2.0-rc.4
#r "nuget: SpawnDev.VoxelEngine, 0.2.0-rc.4"
#:package SpawnDev.VoxelEngine@0.2.0-rc.4
#addin nuget:?package=SpawnDev.VoxelEngine&version=0.2.0-rc.4&prerelease
#tool nuget:?package=SpawnDev.VoxelEngine&version=0.2.0-rc.4&prerelease
SpawnDev.VoxelEngine
High-performance voxel engine built on SpawnDev.ILGPU. GPU-accelerated meshing, culling, LOD, terrain carving, physics, destruction, and VR rendering - from a single C# codebase targeting WebGPU, WebGL, Wasm, CUDA, OpenCL, and CPU.
Status:
0.2.0-rc.3- release candidate. The block renderer and the GPU meshers (BlockRenderPipeline,ColumnMesher,HeightmapMesher) run AubsCraft's 3D viewer in production; the rest of the API is functional and consumed by Lost Spawns. Expect iteration during the RC cycle.
Write voxel engine code in C# and let SpawnDev.ILGPU handle the GPU backend. In the browser, WebGPU compute shaders power the entire pipeline. On desktop, CUDA and OpenCL take over automatically. The same kernels run everywhere.
Features
Core Pipeline
- Binary greedy meshing - GPU compute kernels that merge adjacent voxel faces into larger quads using bitwise operations. 80-90% vertex reduction vs naive meshing. 50-200 microseconds per chunk.
- GPU-driven culling pipeline - Frustum culling, cylindrical fog culling, and Sodium-style graph-based visibility. (Hi-Z occlusion is reserved for v2; graph + frustum handle 95%+ of voxel-world occlusion.)
- Vertex pooling - Fixed-size bucket allocator backed by a single GPU buffer. O(1) alloc/free. Priority eviction by distance and vertex cost.
- Single-buffer indirect draws - All draw commands in one GPUBuffer for Chrome's 300x D3D12 validation optimization.
- Adaptive LOD - Distance-based detail reduction via DelegateSpecialization kernels. One mesh kernel, multiple LOD behaviors, zero overhead.
- Device-adaptive quality - Queries actual GPU limits at init. Draw distance, vertex budget, LOD bias, and streaming rate all derived from hardware. Quest 3S gets appropriate budgets automatically.
- Reversed-Z depth - Zero Z-fighting at any distance with infinite far plane.
- Face masking - 6 orientation groups per chunk mesh. Skip back-facing groups at draw time for 36% reduction.
Textured Blocks
BlockRenderPipeline- textured, tinted, lit, fogged blocks fromPackedQuadbuffers (the Minecraft-style look): opaque, plant (crossed planes, double-sided) and water (alpha blended) passes, alpha cutout, per-face brightness, sun + ambient + fog supplied by the caller, reversed-Z.- A texture atlas read exactly -
BlockTextureAtlasis one 2D texture, a grid of equal tiles; the shader fetches texels itself and wraps inside the tile, so a greedy-merged quad tiles its texture once per block, with no sampler, no seams and no layer limit (an array holds only 256 layers on WebGPU). Animated tiles are a per-tick timeline (SetAnimations). ColumnMesher- a whole block column (all its 16-high sections) meshed on the GPU in a handful of dispatches: class-aware (BlockClass: opaque, see-through leaves/glass, water, plants), exact across column borders, greedy-merged, with one tiny counter readback per column. A column can come straight from a JS typed array (CreateColumnBufferFromJS).- Section placement by instance index - one quad buffer holds many sections; a draw's
firstInstanceselects the section origin, so drawing a section writes no uniform. QuadArena- a few large buffers that hold the quads of hundreds of meshes (ColumnMesher.Arena): a renderer binds a buffer once per pass instead of once per column, which is what a weak CPU spends its frame on. Each list is drawn from its ownFirstQuad.
Beyond Meshing
- Terrain carving -
TerrainCarveServicewith sphere/box/cylinder add/remove modes andITerrainCarveinterface. NMS-style sphere terraform shipped in Lost Spawns. - Voxel physics -
VoxelRaycast.CastWorld(DDA traversal returningRaycastHitwith face + adjacent cell),VoxelCollisionAABB-vs-world,VoxelSphereQuery, andStructuralIntegrityfor cave-in / floating-block detection. - Destruction -
ExplosionKernelsfor radial damage propagation on the GPU. - SDF mesher -
SdfMeshPipelinewith Dual Marching Cubes kernels and SDF noise generation for smooth-terrain styles alongside the cubic mesher. - Terrain generation -
HeightmapTerrainProviderandBiomeAssignerfor procedural worlds. - VR / WebXR -
StereoRenderer,FoveatedRendering, andWebXRHelperfor Quest 3S and other WebXR runtimes. - Caching - Chunk persistence layer for save/load round-trips.
- Cross-platform - Same kernel code runs in browser (WebGPU/WebGL/Wasm) and desktop (CUDA, OpenCL, CPU) from one NuGet package.
Installation
dotnet add package SpawnDev.VoxelEngine --prerelease
Dependencies
- SpawnDev.ILGPU - GPU compute (WebGPU, WebGL, Wasm, CUDA, OpenCL, CPU)
- SpawnDev.SpawnJS - Browser interop for Blazor WebAssembly
Quick Start
using SpawnDev.SpawnJS;
using SpawnDev.VoxelEngine;
using SpawnDev.VoxelEngine.Carving;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddSpawnJSRuntime();
// One-line registration with Lost Spawns defaults (HD realistic, VoxelSize=0.5).
// Use AddVoxelEngineAubsCraft() for blocky Minecraft-style defaults,
// or AddVoxelEngine(cfg => { ... }) to dial in your own values.
builder.Services.AddVoxelEngineLostSpawns();
await builder.Build().SpawnJSRunAsync();
// Inject the services you need:
public class GameLogic
{
public GameLogic(
ChunkManager chunks,
CullingPipeline culling,
IndirectDrawBuffer drawBuffer,
BlockRegistry blocks)
{
// ... use them in your render loop
}
}
Architecture
SpawnDev.VoxelEngine provides the GPU-accelerated infrastructure that voxel games need. It handles the hard parts - meshing, culling, buffer management, LOD, carving, physics, destruction, and adaptive quality - so game code can focus on gameplay.
Your Game Code
|
SpawnDev.VoxelEngine (meshing, culling, LOD, rendering, carving, physics, SDF, VR)
|
SpawnDev.ILGPU (GPU compute - WebGPU, WebGL, Wasm, CUDA, OpenCL, CPU)
|
SpawnDev.SpawnJS (browser interop)
Library Layout
| Directory | Purpose |
|---|---|
Meshing/ |
Binary greedy meshing kernels, face culling, occupancy masks |
Culling/ |
Frustum, fog, Sodium-style graph visibility |
Buffers/ |
Vertex pool (bucket alloc), compaction, indirect draw buffer |
LOD/ |
Super-block reduction, LOD selection, DelegateSpecialization kernels |
Rendering/ |
Indirect draw pipeline, reversed-Z depth, draw command builder |
Adaptive/ |
Device limit queries, quality controller, thermal response, budget |
Carving/ |
Sphere/box/cylinder terraform, NMS-style add/remove modes |
Physics/ |
Voxel raycast (DDA), AABB-vs-world collision, sphere queries, structural integrity |
Destruction/ |
Radial explosion kernels |
SDF/ |
Dual Marching Cubes mesher + SDF noise generation |
Terrain/ |
Heightmap providers, biome assignment |
VR/ |
Stereo rendering, foveated rendering, WebXR helper |
Caching/ |
Chunk persistence layer |
Key ILGPU Features Used
| Feature | Use in VoxelEngine |
|---|---|
| Lambda kernels | Captured scalars (camera pos, time, fog distance) passed to GPU automatically |
| DelegateSpecialization | One mesh kernel, multiple LOD behaviors, compile-time inlined |
| RadixSort | GPU sort for front-to-back draw ordering |
| Scan | Prefix sum for visible chunk compaction |
| CopyFromJS | Zero-copy chunk data transfer from JavaScript workers |
| Sub-word types | Block IDs as Int16 - half the memory vs Int32 |
| Shared memory + barriers | Fast neighborhood loading for face culling |
| GpuMatrix4x4 | View/projection transforms in kernels |
| Atomics | Vertex counters with rollback bounds checking |
Documentation
License
MIT - see LICENSE.txt
Credits
SpawnDev.VoxelEngine is built upon SpawnDev.ILGPU and the excellent ILGPU library. We would like to thank Marcel Koester and the ILGPU contributors for their hard work in providing a high-performance IL-to-GPU compiler for the .NET ecosystem.
- ILGPU Project: https://github.com/m4rs-mt/ILGPU
- ILGPU Authors: Marcel Koester and the ILGPU contributors
The SpawnDev Crew
SpawnDev.VoxelEngine is developed collaboratively by TJ (Todd Tanner / @LostBeard) and a team of AI agents who contribute extensively to research, analysis, architecture design, and code development. This project represents a new model of human-AI collaboration in open source development.
- LostBeard (Todd Tanner) - Captain, library author, keeper of the vision.
- Riker (Claude CLI #1) - First Officer, implementation lead on consuming projects.
- Data (Claude CLI #2) - Operations Officer, deep-library work, test rigor, root-cause analysis. Authored the SpawnDev.VoxelEngine architecture and the optimization masterplan covering binary greedy meshing, GPU-driven culling, adaptive LOD, and Quest 3S adaptive quality.
- Tuvok (Claude CLI #3) - Security/Research Officer, design planning, documentation, code review. Drove the sub-word data type implementation in SpawnDev.ILGPU (v4.9.0) and built the eviction system that proved the architecture.
- Geordi (Claude CLI #4) - Chief Engineer, library internals, GPU kernels, backend work. Designed the 2-worker architecture (JS data worker + Blazor render worker) and built the binary WebSocket + OPFS cache + CopyFromJS data pipeline.
- Gemini (Google AI, in-browser) - Brainstorming partner. TJ's sounding board for cross-checking approaches.
These agents communicate through a shared DevComms system, coordinate tasks autonomously, review each other's work, and produce independent analyses that are compared for convergence - the same methodology used by any high-performing engineering team.
Resources
- SpawnDev.ILGPU - GPU compute for .NET (WebGPU, CUDA, OpenCL, CPU)
- SpawnDev.SpawnJS - Full JS interop for Blazor WebAssembly
- ILGPU Documentation
- WebGPU Specification
- GitHub Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- SpawnDev.ILGPU (>= 5.3.7)
- SpawnDev.SpawnJS.Blazor (>= 3.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.2.0-rc.4 | 24 | 10/15/2026 |
| 0.2.0-rc.3 | 40 | 10/15/2026 |
| 0.2.0-rc.2 | 33 | 10/15/2026 |
| 0.2.0-rc.1 | 37 | 10/15/2026 |
| 0.1.0-rc.2 | 133 | 4/27/2026 |
| 0.1.0-rc.1 | 97 | 4/25/2026 |
0.2.0-rc.3: BlockTextureAtlas (a 2D atlas read exactly, no 256-layer limit; replaces BlockTextureArray), animated tiles (SetAnimations, a per-tick timeline by BlockFrameUniforms.Time), per-face tint masks and FlagDarken in BlockMaterial; see CHANGELOG.md. 0.2.0-rc.2: QuadArena (the quad lists of many meshes in a few shared GPU buffers; ColumnMesher.Arena / HeightmapMesher.Arena, QuadList.FirstQuad), RangeAllocator, BlockRenderPipeline.QuadBufferBinds / PipelineSwitches; see CHANGELOG.md. 0.2.0-rc.1: the renderer a Minecraft-style game needs - BlockRenderPipeline, ColumnMesher (a whole column meshed on the GPU), HeightmapMesher (far tier), the section index inside the quad (one draw per column), BindPass skipping repeats; see CHANGELOG.md. Earlier (0.2.0-local.1): BlockRenderPipeline (textured/tinted/lit/fogged blocks from PackedQuad buffers; opaque, plant and water passes; texture array with repeat so merged quads tile), BlockTextureArray.FromAtlas (GPU-side atlas slicing), BlockMaterial; deps SpawnDev.ILGPU 5.3.7, SpawnJS.Blazor 3.0.4. Earlier: Dig remesh: reuse padded staging + GPU block upload buffer; MeshChunkColumn Y-range/section-list overloads; BlockColumnCarveService + FillKernel; ExplosionKernels byte-column helpers.