Function fast_surface_nets::surface_nets[][src]

pub fn surface_nets<T, S>(
    sdf: &[T],
    shape: &S,
    min: [u32; 3],
    max: [u32; 3],
    output: &mut SurfaceNetsBuffer
) where
    T: SignedDistance,
    S: Shape<u32, 3>, 
Expand description

The Naive Surface Nets smooth voxel meshing algorithm.

Extracts an isosurface mesh from the signed distance field sdf. Each value in the field determines how close that point is to the isosurface. Negative values are considered “interior” of the surface volume, and positive values are considered “exterior.” These lattice points will be considered corners of unit cubes. For each unit cube, at most one isosurface vertex will be estimated, as below, where p is a positive corner value, n is a negative corner value, s is an isosurface vertex, and | or - are mesh polygons connecting the vertices.

p   p   p   p
  s---s
p | n | p   p
  s   s---s
p | n   n | p
  s---s---s
p   p   p   p

The set of corners sampled is exactly the set of points in [min, max]. sdf must contain all of those points.

Note that the scheme illustrated above implies that chunks must be padded with a 1-voxel border copied from neighboring voxels in order to connect seamlessly.