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.
using Spatial Mapping to recognize a pre-scanned space
The Holograms app will recognize the space you are in if it has previously been scanned and cached. Is there any way to replicate this behavior with a mesh that has been scanned, downloaded and made a part of the Unity project for my app?
I need to be able to position objects in a pre-determined and scanned location but I can;t be sure where the user will be exactly when the app is launched.
Thanks
Best Answer
-
ahillier mod
@Plus2019,
The 'Holograms' app differs slightly from your intended flow. In the 'Holograms' app, the user first places the holograms in the real world. The locations are then remembered using spatial anchors (or 'world anchors' in Unity). As long as the map is not cleared on the device, or the environment drastically changed, then they will re-appear in the same location every time. This behavior should be achievable in your app, and I would suggest starting with this flow.Using Unity to pre-place objects will be a bit more challenging, as the center of the world (0,0,0) can change every time that the user starts your application, so you can't place objects in reference to the camera. Instead, you'll need to place them in reference to the spatial mapping data. You might be able to compare your saved mesh with the live mesh data to figure out alignment, or manually align the saved mesh and then use a spatial anchor to remember its location so that during future deploys, it will automatically align itself. You may also consider using some sort of tags (like April tags) in your environment that can be used for room alignment.
I hope this helps,
~Angela7
Answers
Hi @Plus2019, check out this info regarding the Emulator:
https://developer.microsoft.com/en-us/windows/holographic/using_the_hololens_emulator
Room tab
The emulator simulates world input in the form of the spatial mapping mesh from simulated "rooms". This tab lets you pick which room to load instead of the default room.
Simulated rooms are useful for testing your app in multiple environments. Several rooms are shipped with the emulator and once you install the emulation, you will find them in %ProgramFiles(x86)%\Program Files (x86)\Microsoft XDE\10.0.11082.0\Plugins\Rooms. All of these rooms were captured in real environments using a HoloLens:
DefaultRoom.xef - A small living room with a TV, coffee table, and two sofas. Loaded by default when you start the emulator.
Bedroom1.xef - A small bedroom with a desk.
Bedroom2.xef - A bedroom with a queen size bed, dresser, nightstands, and walk-in closet.
GreatRoom.xef - A large open space great room with living room, dining table, and kitchen.
LivingRoom.xef - A living room with a fireplace, sofa, armchairs, and a coffee table with a vase.
You can also record your own rooms to use in the emulator using the Simulation page of the Windows Device Portal on your HoloLens.
On the emulator, you will only see holograms that you render and you will not see the simulated room behind the holograms. This is in contrast to the real HoloLens where you see both blended together. If you want to see the simulated room in the HoloLens emulator, you will need to update your app to render the spatial mapping mesh in the scene.
Also, here is another link that can help you automate your testing:
https://developer.microsoft.com/en-us/windows/holographic/using_the_hololens_emulator
Hope that helps for your case.
hi Jason, thanks for your answer.
Unfortunately I need this behavior in the final app, not just the simulator.
The idea is that this app will only be used in a specific interior location, once I have pre-scanned this space I would load this mesh into Unity and place all my holograms. When the user launches the app it will check to see if the space that the user is in matches that of the pre mapped space. If this is the case it will load the holograms and/or start a process within the app. The existing "Holograms" app has a similar behavior and I'm trying to find out how to replicate this.
Thanks again for your help.
@Plus2019,
The 'Holograms' app differs slightly from your intended flow. In the 'Holograms' app, the user first places the holograms in the real world. The locations are then remembered using spatial anchors (or 'world anchors' in Unity). As long as the map is not cleared on the device, or the environment drastically changed, then they will re-appear in the same location every time. This behavior should be achievable in your app, and I would suggest starting with this flow.
Using Unity to pre-place objects will be a bit more challenging, as the center of the world (0,0,0) can change every time that the user starts your application, so you can't place objects in reference to the camera. Instead, you'll need to place them in reference to the spatial mapping data. You might be able to compare your saved mesh with the live mesh data to figure out alignment, or manually align the saved mesh and then use a spatial anchor to remember its location so that during future deploys, it will automatically align itself. You may also consider using some sort of tags (like April tags) in your environment that can be used for room alignment.
I hope this helps,
~Angela
@Plus2019,
As Angela mentions, spatial anchors (world anchors, in Unity) are likely your best bet here. Since you mention pre-scanning the space, you can place your holograms in relation to one or more anchors and save their locations. The next time your application starts, the holograms will be where you left them.
There are a few key benefits to this approach:
1. If you need to move to a new space, you can rescan/reposition your holograms without needing to modify your application.
2. If the holograms need to be moved within the space, you will not need to rebuild your application.
3. If you desire, in the future, you can scan your space with an additional HoloLens (or several) and share the locations of the holograms. Then multiple users can see and interact with the same holograms together.
See the Holograms 240 materials for an excellent example of using anchors to position holograms and share them with multiple users. This is the content we taught at //build 2016.
Thanks!
David
This is an old post, but do worldAnchors reset when the version of my application is updated?
Is there any way to convert a FBX 3D scan of a room into a Hololens readable space so the device can recognize my 3D scan (done with another device than an Hololens) as a pre-scanned space by the Hololens ?
So I can place Holograms in Unity considering my FBX scan and when the app is run on the device, it automatically set those Hologram in the correct position in my real world.
@irsath
can you achieve that ? Please help I have same scenario as like your
Tanks in advanced...
Thanks
Ankit Sangani
@Plus2019 I know it has been 3 years now (bloody internet remembers everything
)
Do you mind sharing what solution you came up with in the end?