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.
Adding SpatialMapping from a blank project
If I create a brand new Unity project, how do I get the spatial mapping object into my project? All the tutorials have them pre-loaded as assets in the sample download you use as a starting point.
I generally have been finding the doc a little lacking because it starts out with a bunch of predefined assets, rather than a blank project.
Best Answers
-
OptionsJackson mod
This is a two-step process:
- First add the required capability: in "Edit > Project Settings > Player" under "Publishing Settings" scroll to the bottom and check the "SpatialPerception" checkbox in the "Capabilities" box.
a. If you have already built your Visual Studio solution, you will need to add this capability in the generated solution, or delete it and rebuild in Unity.
- Create an empty GameObject in your scene and add this script to it:
https://github.com/Microsoft/HolographicAcademy/blob/Holograms-101/Origami/Assets/Holograms/Support/Spatial Mapping/SpatialMapping.cs
a. Set the DrawMaterial to be what you want to display the surfaces as. We include a Wireframe material here, but you can use your own material:
https://github.com/Microsoft/HolographicAcademy/tree/Holograms-101/Origami/Assets/Resourcesb. Check the "Draw Visual Meshes" checkbox if you want to render the spatial mapping data.
5 -
OptionsJackson mod
Alternatively, pull the holotoolkit and add it to your new Unity project:
https://github.com/Microsoft/HoloToolkit-UnityAdd the SpatialMapping prefab to your scene:
https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/Prefabs/SpatialMappingYou will still need to add the SpatialPerception capability to your project.
1
Answers
This is a two-step process:
a. If you have already built your Visual Studio solution, you will need to add this capability in the generated solution, or delete it and rebuild in Unity.
https://github.com/Microsoft/HolographicAcademy/blob/Holograms-101/Origami/Assets/Holograms/Support/Spatial Mapping/SpatialMapping.cs
a. Set the DrawMaterial to be what you want to display the surfaces as. We include a Wireframe material here, but you can use your own material:
https://github.com/Microsoft/HolographicAcademy/tree/Holograms-101/Origami/Assets/Resources
b. Check the "Draw Visual Meshes" checkbox if you want to render the spatial mapping data.
Alternatively, pull the holotoolkit and add it to your new Unity project:
https://github.com/Microsoft/HoloToolkit-Unity
Add the SpatialMapping prefab to your scene:
https://github.com/Microsoft/HoloToolkit-Unity/tree/master/Assets/HoloToolkit/Prefabs/SpatialMapping
You will still need to add the SpatialPerception capability to your project.
Thanks Jackson. Ended up using the toolkit too.
Wrt to the wireframe rendering, it is as if the wireframe lines are partially occluded, so it looks somewhat like "dashes" and I don't see the entire triangle for a lot of the meshes. Is there a way to make the rendering "prettier" ?
When I start a new project - I do not have the capability of spatialpercetion under Edit>Project Settings> Player... It is not there... any idea why not?
Are you using the correct version of Unity and have you installed the Holographic extension?
https://developer.microsoft.com/en-us/windows/holographic/install_the_tools
I am using the beta version of Unity 4.5, that is from the install the tools link.. I did not have an older version installed.
@ss62 note there's two things you need to install for Unity. Unity and the UWP Runtime add-on
As I was looking for this addon, I found https://developer.microsoft.com/en-us/windows/holographic/recommended_settings_for_unity, which aslo mentions what you are talking about...** Are these capabilities only available when you are publishing to the windows store?** as the directions indicate to do... I was just publishing to my PC, as I do not yet have a store developer account. ** Also where would I get this addon, please ??** Haven't found it yet. Sorry.
The name is misleading. What you're building is a "Windows Store app", regardless of whether you are going to publish it in the store or not (but it's the only kind that can go into the store). The link is under "Install the tools" link I shared above, and click the unity link in there.
Btw this thread has gone completely off topic. It's better to create a new thread, rather than hijacking an existing thread dealing with something completely different.