VoxelMeshOptimizer 1.2.0

dotnet add package VoxelMeshOptimizer --version 1.2.0
                    
NuGet\Install-Package VoxelMeshOptimizer -Version 1.2.0
                    
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="VoxelMeshOptimizer" Version="1.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VoxelMeshOptimizer" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="VoxelMeshOptimizer" />
                    
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 VoxelMeshOptimizer --version 1.2.0
                    
#r "nuget: VoxelMeshOptimizer, 1.2.0"
                    
#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 VoxelMeshOptimizer@1.2.0
                    
#: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=VoxelMeshOptimizer&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=VoxelMeshOptimizer&version=1.2.0
                    
Install as a Cake Tool

Voxel Mesh Optimization Library

VoxelMeshOptimizer turns voxel chunks into compact meshes. It removes hidden faces and merges quads so that a whole chunk can be rendered with a minimal triangle count.

Install

dotnet add package VoxelMeshOptimizer

Quick start

Basic usage

using VoxelMeshOptimizer.Core;
using VoxelMeshOptimizer.Core.OptimizationAlgorithms.DisjointSet;
using VoxelMeshOptimizer.Toolkit;

var chunk = new ExampleChunk(PerlinNoiseChunkGen.CreatePerlinLandscape(50, 123));
var optimizer = new DisjointSetMeshOptimizer(new ExampleMesh());
Mesh mesh = optimizer.Optimize(chunk);
File.WriteAllText("chunk.obj", ObjExporter.MeshToObjString(mesh));

Multithreaded usage (Tasks-based)

Multithreading usage

using VoxelMeshOptimizer.Core;
using VoxelMeshOptimizer.Core.OptimizationAlgorithms.DisjointSet;
using VoxelMeshOptimizer.Toolkit;

// Initialization of the TaskManager
using CancellationTokenSource cts = new();
// Decomposition of the types : 
// - Int3 pos : Position of the chunks, usefull when generating a bunch of chunks and you need to remember where to put them
// - Func<Int3, Chunk> gen : Funciton to generate the Chunk's data
// - (Chunk chunk, Mesh mesh) : Result of a task, the initial chunk and its mesh
TaskManager<(Int3 pos, Func<Int3, Chunk> gen), (Chunk chunk, Mesh mesh)> manager =  new(
    workerCount: Environment.ProcessorCount, // TODO : set to 1 if you want one worker
    processor: (job, ct) => // TODO : What one job actually do
    {
        (Int3 pos, Func<Int3, Chunk> gen) = job;
        Chunk chunk = gen(pos);

        DisjointSetMeshOptimizer optimizer = new(new Mesh([]));
        Mesh mesh = optimizer.Optimize(chunk);

        return ValueTask.FromResult((chunk, mesh));
    }
);


// Creating chunks
int iterations = 3;
Int3 chunkPos = new() { x = 0, y = 0, z = 0 };
for (int i = 0; i < iterations; i++)
{
    _ = manager.Enqueue((chunkPos,
        p => new Chunk(PerlinNoiseChunkGen.CreatePerlinLandscape(size: 16, seed: 123))));
}

for (int i = 0; i < iterations; i++)
{
    if (manager.TryDequeueCompleted(out TaskManager<(Int3 pos, Func<Int3, Chunk> gen), (Chunk chunk, Mesh mesh)>.Completion r))
    {
        if (r.Error) {
            // An issue occured during the process
            // TODO : Handle the error
        }
        
        // TODO : Do what you like with the chunk
    }
    else
    {
        // TODO : Continue program's work and come back later
    }
    
}

// Destroy manager and prevent leaks
await manager.DisposeAsync();

General Workflow

  1. Build or load a Chunk<Voxel>.
  2. DisjointSetMeshOptimizer uses VoxelOcclusionOptimizer and a 2‑D union‑find to merge faces.
  3. Export the resulting mesh or feed it to your engine.

See the GitHub repository for examples, benchmarks and complete documentation.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
1.2.0 109 2/4/2026
1.1.0 157 8/22/2025
1.0.0 159 8/22/2025