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.
How to use Spatial Understanding in C# and SharpDX project
Hi,
How do I use spatial understanding outside of Unity?
Thanks
Best Answers
-
Optionsthebanjomatic ✭✭✭
@mor_sayag You are going to have to duplicate and adapt some code, but look at the scripts from the unity version of the MixedRealityToolkit. For example, SpatialUnderstandingDll.cs. The key component is that these scripts are largely just wrappers around the native SpatialUnderstanding dll that you should be able to reference from SharpDX.
You can either grab the dll out of the MixedRealityToolkit-Unity project, or build it yourself from here: https://github.com/Microsoft/MixedRealityToolkit (note the lack of -Unity suffix).
Going back to SpatialUnderstandingDll.cs, as mentioned before most of the functionality in that script is just a wrapper around the other DLL using DllImport, and you would need the same in your project. For example:
[DllImport("SpatialUnderstanding")] public static extern void GeneratePlayspace_InitScan( [In] float camPos_X, [In] float camPos_Y, [In] float camPos_Z, [In] float camFwd_X, [In] float camFwd_Y, [In] float camFwd_Z, [In] float camUp_X, [In] float camUp_Y, [In] float camUp_Z, [In] float searchDst, [In] float optimalSize);
And then SpatialUnderstanding.cs contains the "management" of the spatial understanding process and calls into the SpatialUnderstandingDll code.
I would recommend starting by copying those scripts and removing anything that is specific to Unity to make it work smoothly in your project. Some things like how the meshes are built and returned will likely need to be adapted.
5 -
OptionsJimbohalo10 ✭✭✭
There are some more advanced uses of how to use Holograms in Rebuilding the HoloLens scanning effect with RoomAlive Toolkit. The RoomAlive Toolkit code gives an insight how to work code outside of Unity in a Shader built with Shader Toy Online toolkit.
In the RoomAliveToolkit - Pro Cam Calibration/. The code runs inside Visual Studio.
To really complete this you will need a Kinect 2 for Windows adapter and a Kinect 2 for Xbox One.
How about building a Real life Portal; a holographic window using Kinect
Then try HoloLens scanning effect in Unity
The tutorial shows how to put the Shader in Unity.
If you don't want to build Shaders from source, then buy them from the Unity Asset store along with DirectX11 packages of Shaders at HoloLens Shader Pack
These Shaders are optimised for HoloLens development5
Answers
What specifically are you trying to do?
Dwight Goins
CAO & Founder| Independent Architect | Trainer and Consultant | Sr. Enterprise Architect
MVP | MCT | MCSD | MCPD | SharePoint TS | MS Virtual TS |Windows 8 App Store Developer | Linux Gentoo Geek | Raspberry Pi Owner | Micro .Net Developer | Kinect For Windows Device Developer
http://dgoins.wordpress.com
Hi,
All the Spatial pages for Unity and DirectX are here
Control-F in Edge type "Spatial" or "DirectX" and look at the highlighted pages
The best page to start is Spatial mapping
Then follow on with Spatial mapping in DirectX
You can refer back to Spatial mapping in Unity for reference.
Generally its better to build your project using Unity then convert to DirectX
Unreal Engine does not support HoloLens/Spatial Mapping or DirectX
@mor_sayag You are going to have to duplicate and adapt some code, but look at the scripts from the unity version of the MixedRealityToolkit. For example, SpatialUnderstandingDll.cs. The key component is that these scripts are largely just wrappers around the native SpatialUnderstanding dll that you should be able to reference from SharpDX.
You can either grab the dll out of the MixedRealityToolkit-Unity project, or build it yourself from here: https://github.com/Microsoft/MixedRealityToolkit (note the lack of -Unity suffix).
Going back to SpatialUnderstandingDll.cs, as mentioned before most of the functionality in that script is just a wrapper around the other DLL using DllImport, and you would need the same in your project. For example:
And then SpatialUnderstanding.cs contains the "management" of the spatial understanding process and calls into the SpatialUnderstandingDll code.
I would recommend starting by copying those scripts and removing anything that is specific to Unity to make it work smoothly in your project. Some things like how the meshes are built and returned will likely need to be adapted.
There are some more advanced uses of how to use Holograms in Rebuilding the HoloLens scanning effect with RoomAlive Toolkit. The RoomAlive Toolkit code gives an insight how to work code outside of Unity in a Shader built with Shader Toy Online toolkit.
In the RoomAliveToolkit - Pro Cam Calibration/. The code runs inside Visual Studio.
To really complete this you will need a Kinect 2 for Windows adapter and a Kinect 2 for Xbox One.
How about building a Real life Portal; a holographic window using Kinect
Then try HoloLens scanning effect in Unity
The tutorial shows how to put the Shader in Unity.
If you don't want to build Shaders from source, then buy them from the Unity Asset store along with DirectX11 packages of Shaders at HoloLens Shader Pack
These Shaders are optimised for HoloLens development
what I like abut spatial understanding is that the triangles arrangement is better and the size of each surface is limited.
thanks everyone! I'll try your suggestions