marian42 / mesh_to_sdf

Calculate signed distance fields for arbitrary meshes
https://pypi.org/project/mesh-to-sdf/
MIT License
991 stars 107 forks source link

Mesh to SDF transformation fails for thin plate (zero volume) mesh with hole inside it. #9

Closed Haetsal-Lee closed 4 years ago

Haetsal-Lee commented 4 years ago

image image image image I tried the codes in README (scan && normal).

I think the transformation from mesh to SDF fails severely. The last image above is recostructed mesh from SDF.

I saw the issue which says zero volume can cause some issues and it was resolved by disabling back-face culling.

What do you think the reason of problem?

** Update scan/normal: above last image. (this called bubble effect?) scan/depth: only positive values are generated.

marian42 commented 4 years ago

The "sample" method doesn't work with zero volume geometry. The scan based method (with sign_method="depth") should work. Having only positive values is expected, as negative values are for points inside the shape and if the shape has zero volume, there are no points inside the shape.

That being said, for a shape with zero volume the SDF and the (unsigned) distance are the same, so I'm not sure why you'd want to generate SDFs for this model.