Signed Distance Field on distributed memory machine

149 views
Skip to first unread message

Giampaolo Cetraro

unread,
Oct 23, 2020, 1:50:27 PM10/23/20
to OpenVDB Forum

Hi guys,
First of all congratulations for all your work, I've been playing with OpenVDB for the last few months and I'm really enjoying it as it's a very beautiful piece of code.

I'm at a stage where I would like to calculate a Signed Distance Field across few nodes on a HPC cluster using OpenMPI and I have a couple of question for you.

Say I want to calculate the SDF of a closed polygonal mesh (possibly with self intersections) across 2 nodes.


I distribute the surface mesh such as every node deals with an open portion of the initial geometry and calculates the Unsigned Distance Field of his own open portion.
Then I convert all the grids to a binary stream and communicate to the other node.


At this point I would like to be able to rebuild the Signed Distance Field using only the information from the Unsigned Distance Fields, but I don't seem to find a good solution to this.
I've tried different things like levelSetRebuild to an offset isoValue, then csgUnion, and levelSetRebuild to the negative offset isoValue. However it's a bit time consuming, almost same time as if every node calculates the SDF of the whole geometry.

Do you have any suggestion/comment on how to rebuild a SDF from the union of UDFs describing a closed volume? Or should I use a different approach?

Alternatively if on one node I manage to calculate a larger SDF, can I cut it to size using an Unsigned Distance Field?

Giampaolo Cetraro

unread,
Nov 25, 2020, 1:35:36 PM11/25/20
to OpenVDB Forum

Hi guys,

I played a bit with MeshToVolume.h to try to compute the sign/side of a portion of a closed polygonal mesh.

 

As example I have an intersection between a cube and a sphere and I want to calculate the sign/side only of the cube on one node.

 

These are the steps I'm doing at the moment

 

- I compute a coarse (say 2*desired_VoxelSize) SDF of the whole geometry and a UDF of the cube.

- topologyIntersection of the coarse SDF and cube UDF. Set clipped SDF grid to GRID_UNKNOWN


 

- resampleToMatch to desired_voxelSize. 


 

- Use this grid as a maskGrid for a modified version of meshToVolume


 

Now inside MeshToVolume this is what I've modified:

 - voxelization: feed the whole geometry but voxelize only around cube (use resampled SDF as mask)


 - use resampled SDF mask to flip the sign of non intersecting voxels




 - the original ComputeIntersectingVoxelSign can now flip sign of negative intersecting voxels correctly.


 

 - transform values has only to scale values, sign is already correct

 - return the distGrid here because the expandNarrowband would not work on this broken level-set


 

This approach seems to work as expected on this small case: I know which voxel is inside and which is outside and the accuracy is better than the resampleToMatch.



However I would appreciate your feedback as probably you are more aware where things can be improved or can go wrong. I'm happy to share the code if you think it might be of interest to other people.

 

Reply all
Reply to author
Forward
0 new messages