The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
save and load spatial mapping data in same place
hello, I want to save and load spatial mapping data in same place.
I want to scan the room in advance. and people using my app need not scan for load and track hololens.
this is scenario.
1. scan the room
2. save the spatial mapping data of room.
3. make hologram scene with mapping data in unity editor.
4. my app has the data (at local or server).
5. another hololens download my app.
6. another hololens load the spatial mapping data of room. hologram scene I made also loaded in the room.
question:
In tutorial(Holograms 230 spatial mapping), we can save spatial mapping data. but it is only obj file. I think that obj file haven't raw data for space tracking.
then how i save the space data for tracking?
and is it possible that I put the data into my app?
When I play the app, can i load space data and holograms I made?
thank you!
Best Answers
-
Optionsstepan_stulov ✭✭✭
Hey, @kgil
then how i save the space data for tracking?
Tracking doesn't run against the reconstructed spatial mapping data, it runs against other raw sensory data. You can save the spatial mapping mesh but it will be useless since it's not what anchors need. There is also no practical way to substitute the data to make the HoloLens "think" it finds itself in a different room. The process is hidden and inaccessible except the reconstructed spatial mesh which is not the original data anymore.
and is it possible that I put the data into my app?
You can put the spatial mapping mesh to your own app, but as said above, you won't be able to run any spatial anchoring against it.
The closest to what you want, assuming your development room is different from the user's room, is to either make your scenario room-agnostic or make it only based on very few anchors whose positions you can deduce from user's original position/gaze or you can always ask the user to assist you placing key anchors of your scenario herself.
There is also the WorldAnchorTransferBatch that you can pass around and that is in essence a package of serialized World Acchors, but they are, again, useless in a different room.
Another explanations here:
https://forums.hololens.com/discussion/comment/14281#Comment_14281
Building the future of holographic navigation. We're hiring.
5 -
Optionsstepan_stulov ✭✭✭
Although, I and user are using same room, user can't track with shared worldAnchor because hololens don't know where world Anchor position is. Is that Right?
No, that is not right. You can pack that one (or more) world anchors into a WolrdAnchorTransferBatch and transfer it onto another HoloLens via network or simply via Fire Explorer in the Device Portal. On another HoloLens you will read the anchors from the batch and they WILL work in the same room.
This mechanism, in fact, is at the heart of HoloToolkit's sharing feature. It simply sends one anchor in form of a transfer batch to other clients so they all "agree" on the same coordinate system.
Building the future of holographic navigation. We're hiring.
5 -
Optionsstepan_stulov ✭✭✭
Hey, @kgil
To save a transfer batch you need to do these two steps:
- Serialize transfer batch into an array of bytes using WorldAnchorTransferBatch.ExportAsync(). Bare in mind that this process is asynchronous and gives you the resulting bytes in pieces. So you need to carefully stitch them together into the final byte array yourself.
- Save the bytes into a file. The easiest way on HoloLens is to use UnityEngine.Windows.File.WriteAllBytes().
To then later load the batch and take anchors out of it you need to reverse the process:
- Load the transfer batch bytes from the file using UnityEngine.Windows.File.ReadAllBytes().
- Convert those bytes into a transfer batch with WorldAnchorTransferBatch.ImportAsync(). Bare in mind that this importing may sometimes fail with correct data for no apparent reason and you need to retry a few more times. This is a known unreliability of transfer batch serialization.
- Finally pull the anchors by their ids from the batch using WorldAnchorTransferBatch.LockObject().
In between of these instructions you can then pass the file from one HoloLens to another either using File Explorer of the Device Portal or send it via network.
Building the future of holographic navigation. We're hiring.
1 -
OptionsMattFedoCSG ✭✭
Im not sure if this is what you are looking for, but I was able to save almost everything that the Hololens captured into a series of files and then rebuild the entire scene back in a different platforms app. In this case the app runs on iOS and Android and rebuilds and views all the hololens data including the spatial meshes, anchors and so on. Here are a few screen grabs. If you want to know how I did it, PM me.
4
Answers
Hey, @kgil
Tracking doesn't run against the reconstructed spatial mapping data, it runs against other raw sensory data. You can save the spatial mapping mesh but it will be useless since it's not what anchors need. There is also no practical way to substitute the data to make the HoloLens "think" it finds itself in a different room. The process is hidden and inaccessible except the reconstructed spatial mesh which is not the original data anymore.
You can put the spatial mapping mesh to your own app, but as said above, you won't be able to run any spatial anchoring against it.
The closest to what you want, assuming your development room is different from the user's room, is to either make your scenario room-agnostic or make it only based on very few anchors whose positions you can deduce from user's original position/gaze or you can always ask the user to assist you placing key anchors of your scenario herself.
There is also the WorldAnchorTransferBatch that you can pass around and that is in essence a package of serialized World Acchors, but they are, again, useless in a different room.
Another explanations here:
https://forums.hololens.com/discussion/6993/how-does-space-spatial-information-influence-in-app-spatial-meshes
https://forums.hololens.com/discussion/comment/14281#Comment_14281
Building the future of holographic navigation. We're hiring.
hello, @stepan_stulov ! Thank you for your explanation.
I understand that I can't save space data(point cloud or feature point)
Hololens only tracks space in real time with data made in real time.
Although, I and user are using same room, user can't track with shared worldAnchor because hololens don't know where world Anchor position is. Is that Right?
thank you again!
@kgil
No, that is not right. You can pack that one (or more) world anchors into a WolrdAnchorTransferBatch and transfer it onto another HoloLens via network or simply via Fire Explorer in the Device Portal. On another HoloLens you will read the anchors from the batch and they WILL work in the same room.
This mechanism, in fact, is at the heart of HoloToolkit's sharing feature. It simply sends one anchor in form of a transfer batch to other clients so they all "agree" on the same coordinate system.
Building the future of holographic navigation. We're hiring.
@stepan_stulov thank you! I think that WolrdAnchorTransferBatch is what I looking for!
I tried saving the world anchor in my device for getting it via File Explorer in the Device Portal. But I don't know...
how I save world anchor at local storage?
I really appreciate your kindness!
Hey, @kgil
To save a transfer batch you need to do these two steps:
To then later load the batch and take anchors out of it you need to reverse the process:
In between of these instructions you can then pass the file from one HoloLens to another either using File Explorer of the Device Portal or send it via network.
Building the future of holographic navigation. We're hiring.
Im not sure if this is what you are looking for, but I was able to save almost everything that the Hololens captured into a series of files and then rebuild the entire scene back in a different platforms app. In this case the app runs on iOS and Android and rebuilds and views all the hololens data including the spatial meshes, anchors and so on. Here are a few screen grabs. If you want to know how I did it, PM me.
@stepan_stulov , you are so kind.
Thanks to the detailed explanation, I finally saved and loaded world anchor!
@MattFedoCSG
Thank you for response. I wonder how you connect hologram(box trail) with real environment in unity editor.
I sent the message. thank you!
The project is currently under wraps, but basically you save absolutely everything that the HoloLens sees and tracks, then rebuild the entire thing in another project. Once finished, you can port the second app to any device. iOS, Android, Windows, OSX, anything. More demos will be coming in the near future.
@MattFedoCSG , I expect your next demo. thank you!