uwphololensmrtk

Hololens 2: Save/export spatial mesh as obj


I need to map out the spatial structure of a building to a high degree of accuracy, export it, and modify it in an editor. The best option that comes to mind for me is the Hololens 2, which has excellent spatial tracking capabilities.

I can partially achieve this most easily through the device portal, where there is a spatial mesh export option in obj format readily available. However, this method is limited to the closest 128 blocks, whereas my mapped out space is much larger than that.

The obvious and recommended method to do this is to utilize the scene understanding SDK provided by Microsoft with mrtk. It even has an example scene where you can save the scene. However, I have found that this scene is actually saved as a bytes file and not in a proper file format. I've attempted to modify it by replacing the "SaveScene" function with an alternative (like this one), but was unable to get an obj file.

Another recommendation was made here, but this does not create a hololens application so I am unsure how it needs to be used.

I am unsure if I am missing a step or detail in the saving process, or if these methods have an error themselves. Alternatively, can the .bytes file become readable and formatted into an obj file? Is there an alternative that I am missing in this process?


Solution

  • The following answer has a script that serves the requested purpose: https://stackoverflow.com/a/77652870/16858784

    It looks like even with scene understanding, I am only able to access a portion of the spatial structure. I assume this is a way to do memory optimization due to hardware limitations, and that accessing the whole spatial structure at one time is not possible. As a workaround, I will instead download each section of the scanned structure separately and merge them in an external editor.