Hello everyone.

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 do you disable the Spatial Mesh?

I'm using spatial mapping to place holograms onto tables and the floor, and since the holograms have part of their mesh below the surface, it's getting clipped by the spatial mesh. Is there a good way to disable the spatial mesh (or at least its renderer) after the holograms have been placed? I've tried disabling the SpatialMappingObserver and SpatialMappingManager scripts, but that doesn't seem to work.

Answers

  • ahillierahillier mod
    edited June 2016

    Turn off 'Draw Visual Meshes' to stop rendering the spatial mapping mesh.

    SpatialMappingManager.Instance.DrawVisualMeshes = false;

    You can also disable the gameObject that has the SpatialMapping components attached to it, but this will disable your spatial mesh colliders as well.

    SpatialMappingManager.Instance.gameObject.SetActive(false);

  • @Zefalcon, depending on where the origin of your model is (center point, at the bottom, etc), you may see the model extend below the mesh. Also, unless you find planes and replace the raw spatial mesh with, say, a cube or quad you may see some occlusion.

    You may wish to have your object hover a small distance above the actual surface to mitigate some of what you are seeing.

    Thanks!
    David

  • @ahillier Neither of those seem to do the trick in the emulator; I'll test on the actual Lens in just a bit.

    @DavidKlineMS I have my hologram floating a bit, but since it changes size based on the size of the surface plane its placed on, raising it much more would make most of the model difficult to see.

  • Update: Tried setting draw visual meshes to false and turning off the manager. Neither worked. If it helps, I'm using a combination of the Holotoolkit scripts and the ones from the Holo-Academy, since I couldn't get the spatial mesh to work with just the ones from the kit.

  • @Zefalcon,
    Are you using the Plane Finding feature of the HoloToolkit? If so, turning off DrawVisibleMeshes will not change the objects used for the planes. The planes will be child objects of a runtime created SurfacePlanes GameObject.

    Thanks!
    David

  • @DavidKlineMS Yes I am. I have the planes being turned off once the hologram is placed by grabbing the ActivePlanes from SurfaceMeshesToPlanes.

  • I had same question. How can I turn on/off visual meshes on the fly? I tried disabling it in the code but the meshes already drawn were staying there. Is there a way to clear this visuals?

  • SpatialMapping.Instance.SetMappingEnabled(false) seems to do the trick !

  • You may also want to disable the Spatial Mapping Observer as well, if you're looking to improve performance overall.

    Stephen Hodgson
    Microsoft HoloLens Agency Readiness Program
    Virtual Solutions Developer at Saab
    HoloToolkit-Unity Moderator

Sign In or Register to comment.