AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb
Wrong distance sign computation in close-by geometric configurations
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 774
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 34
Description
I found what I think is a bug in openVDB 7.2.
I created a minimum working example that you will find at the end of this post.
## Bug description
The MWE converts into a vdb grid the meshes of two spheres of radius 1 centered in (-1-epsilon/2,0,0) and (1+epsilon/2,0,0), so that they are separated by exactly epsilon=0.1 along x.
Now, when reading the interpolated value of the grid at the origin, the expected result is 0.05, as is lies exactly midway between both spheres.
But if I trace this value against voxel size, here is what i get :

It starts ok, but then around 0.062, it suddenly flips sign before stepping down (at about 0.072) and proceeding to continuously decrease.
The expected sampling issue where samples merely miss the gap should not arise before the voxel size gets greater than the gap itself, so 0.1.
Below that, I would also expect some variation of the value (based on the relative location of the sample in the gap), but not a wrong sign entirely.
Here is a meshed iso-surface at 0 with a voxel size of 0.07:

As expected from the above, the negative value at the origin translates into this point belonging to the inside of the resulting object, and hence merging both spheres whereas they should be separated.
## Minimum Working example
Here is the MWE (code + mesh file):
[project.zip](https://github.com/AcademySoftwareFoundation/openvdb/files/5723597/project.zip)
Contributor guide
Research direction
Build and inspect the project.zip minimum working example, then reproduce the interpolated value at the origin while varying voxel size for the two separated spheres. Compare the sign and zero-isosurface behavior with the expected positive midpoint value and separation; done means the value does not incorrectly become negative below the 0.1 gap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100