#marching-cubes #terrain #terrain-generation #bevy #chunks

bevy_cube_marcher

A shader-based marching cubes implementation for Bevy

3 releases

Uses new Rust 2024

new 0.4.2 Apr 10, 2026
0.4.1 Mar 4, 2026
0.4.0 Mar 3, 2026

#1621 in Game dev

MIT/Apache

89KB
1.5K SLoC

Rust 1K SLoC // 0.0% comments WebGPU Shader Language 400 SLoC // 0.1% comments

A shader-based marching cubes implementation for Bevy.

To get started, add the MarchingCubesPlugin to your app.

The plugin takes a type argument similar to a Bevy material, ChunkComputeShader. The ShaderRef provided by this type is a wgsl compute shader that takes a coordinate and returns the density of the chunk's mass at that point, generally with positive values representing being inside the mass and negative values being in air, although the threshold can be configured with ChunkGeneratorSettings. See this example asset for more details.

The plugin also takes a type argument implementing GpuExtraBufferCache, defining additional buffers to be used in the density sampler. This example uses this to determine the final position of a Point Of Interest based on terrain generation.

ChunkGeneratorSettings must be inserted.

ChunkMaterial must be inserted.

An entity must also be given ChunkLoader to start generating any chunks.


bevy_cube_marcher

Crates.io Docs

A shader-based marching cubes implementation for Bevy.

Getting started

Check the docs, examples, and example assets!

Bevy compatibility

bevy bevy_cube_marcher
0.18 0.4

Dependencies

~60–99MB
~1.5M SLoC