facebookresearch / iSDF

Real-time Neural Signed Distance Fields for Robot Perception
https://joeaortiz.github.io/iSDF/
MIT License
420 stars 53 forks source link

How to use Habitat simulator to get the stage SDF voxel? #10

Closed ge35tay closed 2 years ago

ge35tay commented 2 years ago

First thanks for your great job! I notice that you use Habitat to get the stage SDF, i am curious how to use Habitat to calculate the SDF? Is there maybe a reference?

joeaortiz commented 2 years ago

We used the generateEuclideanDistanceSDF function in habitat-sim: https://github.com/facebookresearch/habitat-sim/blob/14f7c051a7b4bdaed31b8620a7603b2797e5107f/src/esp/geo/VoxelUtils.cpp#L187.

To run this you need to first build habitat-sim from source (after cloning): python setup.py install --vhacd --bullet --with-cuda

Then we added a key event to the habitat-sim viewer that runs the above fn and saves the output grid of SDF values (you'll also need to modify the parameter mdim to change the voxel size to what you require). I believe you need to convert the scanNet mesh to an obj file before you can open it in the habitat-sim viewer using a command like this: ./build/viewer --enable-physics -- /mnt/sda/ScanNet/scans/scene0000_01/mesh.obj

Last thing to note, is that the sign of this distance field of course cannot be trusted in non-visible regions, so we only evaluate in visible regions.