#Hololens – Spatial Understanding vs Spatial Mapping, and a step-by-step on how to use it

Hi !

HoloToolkit has 2 main assets to perform a Spatial Mapping scan in an environment with the Hololens.

  • Spatial Mapping
  • Spatial Understanding

Spatial Mapping is the asset that we use by default and is the one which allows us to have basic control over the scan process performed by the Hololens. For example, once we add this element to an Unity3D project and we enable the drawing of the Mesh, we can see in real time the scan of the environment where while we are using it.

Spatial Understanding allows us to go one step further and perform more complex tasks. For example:

  • Define the start and end time for the scan process. This is really useful for example, when we need to perform an initial scan and then we know that the environment will not change. If we disable the scan in real time, we give more resources to Hololens to be used on other tasks
  • Perform simple queries on different elements in our point of view. For example, to search for flat surfaces in a wall or in the floor to position holograms.
  • Perform more complex queries, to search for items such as a chair, a guitar, etc. I have not used this feature yet, but I have it in in my to do list for when I need it.

Important: Whenever we use Spatial Understanding, we must have added the Spatial Mapping prefab, if we don’t do this we find see some very funny errors.

Personally I think that the 2 best ways to learn about how Spatial Understanding are as follows

  • Read Jeff Evertt article Case study – Expanding the spatial mapping capabilities of HoloLens, he comments on how they created this asset for specific scenarios that where nor contemplated in the original HoloToolkit Spatial Mapping.
  • Review the sample Scene located in “HoloToolkit-Unity/Assets/HoloToolkit-Examples/SpatialUnderstanding/SpatialUnderstanding-FeatureOverview/Scenes/“.
    It uses Spatial Understanding to perform an initial scan of the atmosphere and then present some options of simple queries.

If you also want it to use in a local project, the next tutorial may help you. The end result is an App that shows in real time a HUD with the status of the scan and at the end disable the visualization of the Mesh.

Easy steps.

  1. Create a 3D project in Unity3D
  2. Import HoloToolkit package
  3. Configure project to
    1. Support HoloLens projects (UWP, VR, etc)
    2. enable Spatial Mapping feature
  4. Clean Scene elements
  5. Add
    1. Hololens Camera
    2. Cursor With Feedback
    3. Input Manager
    4. Spatial Mapping
    5. Spatial Understanding
    6. FPS Display
  6. Add Empty element
    1. Rename to CodeManagers
    2. Add new C# Script named “GameStartScanner.cs”

The final project may seems similar to this one

Clipboard02

You can download the complete source code from GitHub (link).

The script for the new class is below, and it is best to check a couple of interesting notes about the same

  • MinAreaForComplete, MinHorizAreaForComplete, MinWallAreaForComplete properties defined the minimum area to be scanned to give the process how valid
  • In the Start() function starts the Scan process with operation SpatialUnderstanding.Instance.RequestBeginScanning (); and we also subscribe to us to state changes
  • The DoesScanMeetMinBarForCompletion property is that is responsible for validating if the scan process is finished
  • In the Update 2 major operations are performed
    • The status of the scan process is displayed in a FPS Text
    • If the minimal elements, it has been found we finished the scan process, and disable visual scan process

Sample Code

Greetings @ Toronto

El Bruno

References

Advertisements

6 thoughts on “#Hololens – Spatial Understanding vs Spatial Mapping, and a step-by-step on how to use it

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s