Skip to content

Converts an input mesh to a signed distance field (SDF)

Notifications You must be signed in to change notification settings

pbrubaker/mesh2sdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mesh2SDF

Downloads PyPI

Converts an input mesh to a signed distance field. It can work with arbitrary meshes, even non-watertight meshes from ShapeNet.

mesh2sdf is used in our paper Dual Octree Graph Networks (SIGGRAPH 2022) to generate the training data. Please cite our paper if you find the code useful for your research.

Installation

mesh2sdf depends on pybind11, and C++ compilers are needed to build the code. Supported compilers are listed here.

  • Install via the following command:

    pip install mesh2sdf
  • Alternatively, install from the source code via the following commands.

    git clone https://github.com/wang-ps/mesh2sdf.git
    pip install ./mesh2sdf

Example

After installing mesh2sdf, run the following command to process an input mesh from ShapeNet:

python example/test.py

Example of a mesh from ShapeNet

How does it work?

  • Given an input mesh, we first compute the unsigned distance field with the fast sweeping algorithm implemented by Christopher Batty (SDFGen). Note that the unsigned distance field can always be reliably and accurately computed even though the input mesh is non-watertight.

  • Then we extract the level sets with a small value d with the marching cube algorithm. The extracted level sets are represented with triangle meshes and are guaranteed to be manifold.

  • There exist multiple connected components in the extracted meshes, and we only keep the mesh with the largest bounding box.

  • Compute the signed distance field again with the kept triangle mesh as the final output. In this way, the signed distance field (SDF) is computed for a non-watertight input mesh.

About

Converts an input mesh to a signed distance field (SDF)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.0%
  • Python 7.0%