Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDF computation approximation/inaccuracies due to nearest-vertex strategy #14

Open
nmwsharp opened this issue Sep 10, 2024 · 2 comments

Comments

@nmwsharp
Copy link

Hi, thanks a bunch for releasing this useful library!

It looks like this library computes SDF by treating a meshes's vertex set as a point cloud, finding the nearest vertex, then searching the faces adjacent to that vertex as candidates for the nearest surface point to define the distance.

However, this strategy is not guaranteed to work in general (even disregarding numerical inaccuracies): the nearest point on a mesh may lie on a face which is not adjacent to the nearest vertex. This leads to an inaccurately computed SDF, and the difference can be significant on meshes with irregular tessellation. This turned out to be a significant source of error in some SDF fitting experiments (see image below).

pysdf_approx

If this understanding is correct, could we add a note in the intro or the Reliability section of the README or something, to let users know that it is approximate? Right now it's only mentioned very briefly in the benchmark section. It's totally fine to offer this strategy, but it would be good to make it clear, and indicate that the difference from the true SDF may be significant on some meshes.

@ASMDlab
Copy link

ASMDlab commented Sep 25, 2024

Hello, do you have a source for your picture? Can you provide the title of the paper? I am looking for open source C++ code that calculates SDF values more accurately. Thank you very much!

@nmwsharp
Copy link
Author

nmwsharp commented Sep 25, 2024

@ASMDlab this was just a small experiment. For the "ground truth" SDF on the right I used libigl https://github.com/libigl/libigl/blob/main/include/igl/signed_distance.h, which is actually a C++ library under the hood (along with python bindings to a subset of its features). It contains many useful geometry processing algorithms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants