Anim8or Community

General Category => ASL Scripts => Topic started by: NickE on January 02, 2017, 11:32:25 am

Title: Marching Cubes - Mesh of the Surface from a Collection of Points
Post by: NickE on January 02, 2017, 11:32:25 am
Have you ever had a collection of points and wanted a mesh that corresponded to the surface of those points?

In my never ending quest to bring physics (or to effects that look mostly like physics) to Anim8or through scripting, I was working with smoothed particle hydrodynamics (SPH) to simulate fluids.  Using Anim8or points as particles, I was able to write scripts to simulate the fluid action, but had no real way of rendering just points.  The actual SPH script is still in development.

One popular way to extract a surface mesh from a point cloud is to use a technique called Marching Cubes.

Below is an implementation of the the Marching Cubes Algorithm in ASL.  The documentation for usage is within the script itself.
Title: Re: Marching Cubes - Mesh of the Surface from a Collection of Points
Post by: neirao on January 04, 2017, 02:01:25 pm
i will try... nice if post a "image preview" for help us, hehehehe
Thanks NIcke! :)
Title: Re: Marching Cubes - Mesh of the Surface from a Collection of Points
Post by: Unobtainium on March 20, 2017, 09:47:16 am
Haven't tried this yet but I like what you're doing here. Thanks, NickE. Perhaps somewhere down the road you could have a look at noise removal or smoothing of the point clouds as well (I'm confident there exists numerous techniques for these things). (:
Title: Re: Marching Cubes - Mesh of the Surface from a Collection of Points
Post by: polyGon_tError on April 03, 2020, 06:15:02 am
why you put hexa value in edgeTable array? :|
Title: Re: Marching Cubes - Mesh of the Surface from a Collection of Points
Post by: NickE on April 04, 2020, 09:59:41 am
The edgeTable array represents the possible intersections of the marching cube with the point cloud.  The values of the EdgeTable array tell which edges of the marching cube intersect the isosurface with bits 0 to 11 each representing one edge of a cube.  It is way easier to represent binary in hex than decimal.