SpawnDev.VoxelEngine 0.1.0-rc.2

This is a prerelease version of SpawnDev.VoxelEngine.
dotnet add package SpawnDev.VoxelEngine --version 0.1.0-rc.2
                    
NuGet\Install-Package SpawnDev.VoxelEngine -Version 0.1.0-rc.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpawnDev.VoxelEngine" Version="0.1.0-rc.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SpawnDev.VoxelEngine" Version="0.1.0-rc.2" />
                    
Directory.Packages.props
<PackageReference Include="SpawnDev.VoxelEngine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SpawnDev.VoxelEngine --version 0.1.0-rc.2
                    
#r "nuget: SpawnDev.VoxelEngine, 0.1.0-rc.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SpawnDev.VoxelEngine@0.1.0-rc.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SpawnDev.VoxelEngine&version=0.1.0-rc.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=SpawnDev.VoxelEngine&version=0.1.0-rc.2&prerelease
                    
Install as a Cake Tool

SpawnDev.VoxelEngine

NuGet

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.1.0-rc.1 - first release candidate. API is functional and consumed by Lost Spawns + AubsCraft; 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.

Beyond Meshing

  • Terrain carving - TerrainCarveService with sphere/box/cylinder add/remove modes and ITerrainCarve interface. NMS-style sphere terraform shipped in Lost Spawns.
  • Voxel physics - VoxelRaycast.CastWorld (DDA traversal returning RaycastHit with face + adjacent cell), VoxelCollision AABB-vs-world, VoxelSphereQuery, and StructuralIntegrity for cave-in / floating-block detection.
  • Destruction - ExplosionKernels for radial damage propagation on the GPU.
  • SDF mesher - SdfMeshPipeline with Dual Marching Cubes kernels and SDF noise generation for smooth-terrain styles alongside the cubic mesher.
  • Terrain generation - HeightmapTerrainProvider and BiomeAssigner for procedural worlds.
  • VR / WebXR - StereoRenderer, FoveatedRendering, and WebXRHelper for 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

Quick Start

using SpawnDev.BlazorJS;
using SpawnDev.VoxelEngine;
using SpawnDev.VoxelEngine.Carving;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddBlazorJSRuntime();

// 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().BlazorJSRunAsync();
// 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.BlazorJS     (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

  • Plans - Implementation roadmap
  • Research - Optimization techniques and engine comparisons

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.

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

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.0-rc.2 50 4/27/2026
0.1.0-rc.1 57 4/25/2026

Fix unrestorable dep: rc.1 declared SpawnDev.ILGPU 4.9.2-rc.7 which was never published to nuget.org (NU1102 for external consumers). rc.2 pins to the published 4.9.2-rc.24 + replaces the SpawnDev.BlazorJS 3.* wildcard with a pinned 3.5.6.