Expand description
§bevy-sculpter
SDF-based voxel sculpting and Surface Nets meshing for Bevy.
This crate provides tools for creating and manipulating volumetric data using signed distance fields (SDFs), with automatic mesh generation via the Surface Nets algorithm.
§Quick Start
use bevy::prelude::*;
use bevy_sculpter::prelude::*;
use chunky_bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(ChunkyPlugin::default())
.add_plugins(SurfaceNetsPlugin::default())
.insert_resource(DensityFieldMeshSize(vec3(10., 10., 10.)))
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
let mut field = DensityField::new();
bevy_sculpter::helpers::fill_centered_sphere(&mut field, 12.0);
commands.spawn((
Chunk,
ChunkPos(ivec3(0, 0, 0)),
field,
GenerateMesh,
));
}§Features
DensityField: SDF-based volumetric storage with raycasting and nearest-point queriesSurfaceNetsPlugin: Automatic mesh generation with seamless chunk boundarieshelpers: Sculpting brushes (smooth, hard, blur, flatten)neighbor: Generic neighbor data structures for seamless chunk boundaries
§Stability
This crate is under active development. Breaking changes may occur between minor versions until 1.0 is released.
Re-exports§
pub use crate::mesher::DensityFieldMeshSize;pub use crate::neighbor::NeighborFace;pub use crate::neighbor::NeighborSlice;pub use crate::prelude::DensityField;pub use crate::prelude::GenerateMesh;pub use crate::prelude::NeighborDensityFields;
Modules§
- density_
field - Density field storage and SDF operations. Density field storage and operations for SDF-based volumetric data.
- field
- Generic field trait for 3D voxel data storage.
- helpers
- Sculpting brush functions for modifying density fields. Sculpting brush functions for modifying density fields.
- mesher
- Surface Nets mesh generation. Surface Nets mesh generation from density fields.
- neighbor
- Neighbor chunk data for seamless boundaries. Neighbor chunk data for seamless mesh boundaries.
- prelude
- Common imports for working with bevy-sculpter.
Structs§
- Chunk
Manager - Resource for managing all chunks in the world.
- Chunk
Pos - The position of a chunk in chunk-space coordinates.
- Surface
Nets Plugin - Plugin that enables automatic Surface Nets mesh generation for chunks with density fields.
Constants§
- DENSITY_
FIELD_ SIZE - Size of the density field grid per chunk (32×32×32 voxels).
- FIELD_
VOLUME - Total number of voxels per chunk.
- NULL_
VERTEX - Sentinel value indicating no vertex exists at a position.