How to start and stop spatial mapping?

Is it possible to start and stop spatial mapping repeatedly? I am trying to map a really large space but I only want physics interactions between the holograms and the spatial world in a few interspersed spaces. The idea was to start spatial mapping only a few times to scan these particular places instead of the entire space and create a disjointed mesh. I don't want spatial mapping to be running all the time. Also is this a good strategy?

Answers

  • stepan_stulovstepan_stulov ✭✭✭
    edited May 2017

    Hi, @shekit

    TL;DR You cannot.

    On the application level you can only stop feeding of the spatial mapping data from the OS to the app. Aka "Freeze Updates" on the SpatialMappingCollider component.

    On the OS level you can only delete the Space to trigger HoloLens to recreate the mapping altogether.

    Anything else outside of this, like selective mapping, temporarily disabling/enabling is not possible neither on the OS level nor form within your app. You can of course just cover the camera of HoloLens with your hand whenever you choose but that would rather create problems to the scanning mechanisms.

    Perhaps you can explain why you would like partial spatial mesh so there can be alternative concepts brainstormed? What are you trying to achieve?

    See another explanation in the accepted answer in this thread:
    https://forums.hololens.com/discussion/comment/14836#Comment_14836

    UPDATE: See @thebanjomatic 's answer, I think I misunderstood the question.

    Building the future of holographic navigation. We're hiring.

  • @stepan_stulov I think this request is a little different than the linked post. What @shekit is looking for is relatively easy to achieve. While its true that under the covers spatial mapping is always occurring, your application doesn't need to incur the overhead of generating meshes and colliders and rendering the entire spatial map (even with an occlusion shader).

    You don't mention what you are using to develop (direct3d vs unity), so I will answer the question from the perspective of Unity and the HoloToolkit since that is what I know, but the concepts should all transfer over.

    The source of all spatial mapping surfaces within your application is the SpatialMappingObserver. Which has a few different ways to observe changes to the spatial map within a given region. One approach (that won't quite work) is to start and stop the observer so that the surface add/remove/update events don't process except for when you are in the areas you care about.

    The problem you will run into with this approach is that for performance reasons, surfaces that fall outside of the observation bounds will be removed after a certain number of frames. As a result, shortly after starting the observer back up in region #2, the surfaces from region #1 will disappear.

    You can work around the above problem by cloning the surfaces that correspond to the first spatial mapping pass when you stop the observer so that they are owned by your application and not by the spatial mapping components.

    A second (and arguably better) approach is to essentially spawn a SpatialMappingObserver only in the two places where you want the mapping and with appropriate bounds. The HTK currently makes some assumptions about a 1:1 relationship between observers and the SpatialMappingManager, but that should be easy to resolve.

  • thanks @stepan_stulov and @thebanjomatic for the responses! As @thebanjomatic pointed out I basically don't want my application to incur that overhead. Also I am using Unity.

    I previously tried starting and stopping the observer on specific voice commands but found that the observer would not map any new areas unless that area was very close to previously mapped environments. So if I started it in one room, partially mapped the room, stopped it, moved to another room and tried starting it it would not work. However if I went back to room one and activated it to map the remainder of the room it would work. Is this the problem you are describing?

    Also as for the second suggestion, are you saying that I should instantiate a spatial mapping observer for every section I want to map? And the manager would hold the details of each observer that is instantiated?

    Also any estimate of how large of a continuous area can I possibly map?

  • @shekit I have similar issues, were you able to resolve your questions? If so, please share your answer!

  • @thebanjomatic said:
    @stepan_stulov I think this request is a little different than the linked post. What @shekit is looking for is relatively easy to achieve. While its true that under the covers spatial mapping is always occurring, your application doesn't need to incur the overhead of generating meshes and colliders and rendering the entire spatial map (even with an occlusion shader).

    You don't mention what you are using to develop (direct3d vs unity), so I will answer the question from the perspective of Unity and the HoloToolkit since that is what I know, but the concepts should all transfer over.

    The source of all spatial mapping surfaces within your application is the SpatialMappingObserver. Which has a few different ways to observe changes to the spatial map within a given region. One approach (that won't quite work) is to start and stop the observer so that the surface add/remove/update events don't process except for when you are in the areas you care about.

    The problem you will run into with this approach is that for performance reasons, surfaces that fall outside of the observation bounds will be removed after a certain number of frames. As a result, shortly after starting the observer back up in region #2, the surfaces from region #1 will disappear.

    You can work around the above problem by cloning the surfaces that correspond to the first spatial mapping pass when you stop the observer so that they are owned by your application and not by the spatial mapping components.

    A second (and arguably better) approach is to essentially spawn a SpatialMappingObserver only in the two places where you want the mapping and with appropriate bounds. The HTK currently makes some assumptions about a 1:1 relationship between observers and the SpatialMappingManager, but that should be easy to resolve.

    Hello I am trying to map a large space but keep losing earlier spatial map data in the 3D View once I go above 122 volumes. I am looking into the approach regarding using several SpatialMappingObservers (spawning one in the first part of the map that disappears after 122 volumes of data and spawning another one in the second part of the map in order to retrieve a spatial mesh of my whole space). Any hints as to how to spawn several SpatialMappingObservers? I am working in Unity. I am using the HoloToolkit but the documentation of it did not shed light as to how to use more than one SpatialMappingObserver. Any help would be greatly appreciated!

Sign In or Register to comment.