Voxel worlds
Generators, meshers, viewers, LOD and persistent edits.
Terrain or a volumetric world
Ordinary Terrain stores a height surface. Voxel Tools stores values throughout a volume, supporting caves, overhangs, block structures and editable ground. Voxel data and the mesh visible to the player are separate parts of the system.
| World | Main parts |
|---|---|
| Block-based | VoxelTerrain, a block library, matching generator and VoxelMesherBlocky |
| Smooth with LOD | VoxelLodTerrain, density/SDF data and VoxelMesherTransvoxel |
| Prepared geometry without volumetric editing | Meshes and prefabs may be sufficient |
The generator must write the channels required by the mesher. A block library does not replace density data for a smooth surface.
Assemble a minimal world
- Add the appropriate world object:
VoxelTerrainorVoxelLodTerrain. - Assign a compatible generator, mesher and material. Start with a short viewing range.
- Attach
VoxelViewerto an object that follows the player or game camera. - Set the viewer's loading distance and collision requirements. A camera alone does not request voxel chunks.
- Run the scene and allow nearby blocks to generate.
- Move the viewer: new areas should load while distant data is released when no longer needed.
For editor previews, check VoxelViewer.Enabled In Editor. Editor and game viewers may occupy different positions, explaining a different result after running.
Edit data from C#
VoxelBuffer contains voxel values. This example creates a buffer and changes one cell:
using Reckfell;
using var data = new VoxelBuffer();
data.Create(32, 32, 32);
data.SetVoxel(1, 16, 8, 16);To change the visible world, use that terrain's editing tool and geometry update path. Editing a temporary buffer does not automatically place a mesh in the scene. Smooth worlds require density/SDF edits rather than only a block identifier.
Check coordinate space: a player's global position is not a cell coordinate when the world root is translated or scaled.
Persist edits
A generator can reconstruct the original world, but does not necessarily save player edits. Assign a supported stream, use its dirty-block saving operation and wait for writes to finish.
Store game saves outside immutable asset://, normally under user://. Check the stream and channels being saved. If restarting restores the original terrain, ensure reading uses the same stream and directory.
Performance and limits
Start with a small loading range. Measure generation, meshing, physics and rendering separately: few visible triangles do not guarantee cheap generation.
Avoid collisions and dense decoration throughout the distant world. Inspect smooth-world LOD transitions, particularly after editing block boundaries. GPU generation depends on renderer and build; a setting does not imply support on every device.
The installed C# Web distribution has browser-specific constraints. Cooperative voxel task execution and WebGPU changes belong to newer source builds and do not mean the installed Web template is already updated. Check the exact template used by your project.
| Symptom | Check |
|---|---|
| Empty world | Viewer, loading range, generator, mesher and material |
| Visible in editor, absent in game | Game viewer position and active camera |
| Visible blocks without collision | Viewer collision request and physics layers/masks |
| Data edits remain invisible | Channel, coordinate space and world editing/geometry update path |
| Edits disappear | Stream, directory and write completion |
API: VoxelBuffer, VoxelLodTerrain, VoxelViewer.