'depth' sign_method generates less negative sdf value
Closed this issue · 5 comments
Hello, thans for your great job. When I try to generate some points near surface only, negative sdf values was much less than positive(1:10.6). And I plot all sdf values of these points as the follow image(Y axis is sdf value). There is a strange area from -0.001 to 0, which contains little points. Any solution for this?
And my test code is
points, sdfs = mesh_to_sdf.sample_sdf_near_surface(mesh, sign_method='depth', number_of_points=1000000)
Thanks!
This issue could perhaps be alleviated with bilinear interpolation in this function.
Sorry for late reply. @pbsds
I checked the code and found that these points are generated by adding the gaussian noise to surface points. Therefore, these near points should be 1:1 on each side of the surface in theroy instead of 1:10 as I posted.
Furthermore, interpolation maybe a valid solution, but how can i make sure points localed betewwn -0.001 and 0 are not wrongly counted to a positive interval?
Thans a lot!
The surface points are pertubed with noise, the distance is is calculated with a nearest neighboring surface point search, then the sign is determined with a depth check.
The depth check is done from 50 random camera perspectives. If the point is visible from at least one of these camera then it is counted as being on the outside. With great artistic skill i mocked together a diagram, of a step-line (nearest neighbor) and a linearly interpolated line:
The blue circle is from this camera perspective erroneously counted as being on the outside, while the red one is counted as being on the inside. The red one will likely be be put on the outside from a different perspective, but the blue one is where the issue lies.
Perhaps bilinear interpolation might not be the best balance either. Bicubic is yet an another option to experiment with.
edit: interpreted -> interpolated
Thanks for your great diagram ^v^!
As I understand, the step line means the depth I got here whitch is not the real depth of the surface point corresponding to current query point. Am I right?
I believe so. The .astype(int)
is where the rounding happens.