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.
Options

Having a very very very difficult time with spatial mapping (C++)

mlfarrellmlfarrell
edited September 2016 in Questions And Answers

Okay so I'll have to split up the number of problems I have into multiple posts on here. The first priority is the awful rendering performance I'm getting with spatial mapping (30 FPS).

From what I can tell, all the settings I pass to the spatial SpatialSurfaceObserver are simply being ignored. For starters, the most important setting I pass, maxTrianglesPerCubicMeter seems to have no impact whatsoever on reducing the complexity of the supplied meshes, which are killing my performance because they are too high. Second, I've reduced the bounding volume to just 5, 5, 5 and I'm still getting back 50 surfaces some of which aren't even anywhere near the origin! Both of these problems combined are causing massive performance problems when rendering the spatial surfaces which is a huge concern for me since you don't even see these and the baseline performance of my engine is now garbage.

I know I need to frustum cull, but at this point I want to fix the problems at the root before I start doing CPU-level optimization.

Answers

  • Options

    Perfect example of what I mean. I passed 25.0 for triangles per meter. Here's the meshes I'm getting back (num verts, num inds)

    INDS: 1079, 3732
    INDS: 2892, 8496
    INDS: 723, 1386
    INDS: 1265, 4902
    INDS: 6091, 26313
    INDS: 3027, 11151
    INDS: 2085, 8313
    INDS: 4278, 16143
    INDS: 1910, 6792
    INDS: 1000, 3363
    INDS: 676, 1110
    INDS: 1213, 4449
    INDS: 63, 90
    INDS: 2112, 8340
    INDS: 5248, 18519
    INDS: 2638, 7983
    INDS: 3134, 14460
    INDS: 129, 303
    INDS: 4415, 20313
    INDS: 584, 1191
    INDS: 3028, 9546
    INDS: 547, 1206
    INDS: 921, 2835
    INDS: 754, 1458
    FPS: 1
    FPS: 0
    INDS: 2892, 8496
    INDS: 723, 1386
    INDS: 6071, 26427
    INDS: 4278, 16143
    INDS: 1910, 6792
    INDS: 1000, 3363
    INDS: 676, 1110
    INDS: 2112, 8340
    INDS: 5214, 18294
    INDS: 4415, 20313
    INDS: 584, 1191
    INDS: 547, 1206
    INDS: 754, 1458
    FPS: 26
    surface count: 24
    INDS: 2892, 8496
    INDS: 723, 1386
    INDS: 6173, 26877
    INDS: 4278, 16143
    INDS: 1910, 6792
    INDS: 1000, 3363
    INDS: 676, 1110
    INDS: 2112, 8340
    INDS: 5175, 18174
    INDS: 4415, 20313
    INDS: 584, 1191
    INDS: 547, 1206
    INDS: 754, 1458
    FPS: 29
    surface count: 24
    INDS: 2892, 8496
    INDS: 723, 1386
    INDS: 6168, 26835
    INDS: 4278, 16143
    INDS: 1910, 6792
    INDS: 1000, 3363
    INDS: 676, 1110
    INDS: 2112, 8340
    INDS: 5206, 18357
    INDS: 4415, 20313
    FPS: 29
    INDS: 584, 1191
    INDS: 547, 1206
    INDS: 754, 1458
    surface count: 24
    FPS: 30
    surface count: 24
    INDS: 2892, 8496
    INDS: 723, 1386
    INDS: 6122, 26562
    INDS: 4278, 16143
    INDS: 1910, 6792
    INDS: 1000, 3363
    INDS: 676, 1110
    INDS: 2112, 8340
    INDS: 5192, 18258
    INDS: 4415, 20313
    INDS: 584, 1191
    INDS: 547, 1206
    INDS: 754, 1458
    FPS: 29
    
  • Options

    so.. I've tried everything under the sun I can think of. Bottom line, if the hololens SDK doesn't honor the mesh complexity setting, my entire project is at risk. I can't speed up Angle any more than I already have, its generating shaders that are 2-4x as slow as directx equivalents, so I have to get the polycounts down. MS API people, if you read these forums, please make the maxTrianglesPerCubicMeter setting more accurate.

  • Options

    Did you try the async code? I have been using it and it seems to overall respond to the parameter - at least the surfaces look noticeably different at two very different values. I mostly use the default options as well.

    The pSurface is Windows::Perception::Spatial::Surfaces::SpatialSurfaceInfo^

    // --- Options - compute normals
    auto pOptions = ref new SpatialSurfaceMeshOptions();
    pOptions->IncludeVertexNormals = true;
    
    // --- Async update
    auto createMeshTask = create_task(pSurface->TryComputeLatestMeshAsync(1024.0, pOptions));
    auto processMeshTask = createMeshTask.then([this, nSurfaceID, pCoordinateSystem](SpatialSurfaceMesh^ pMesh)
    

    The bounding box is another story. I think the orientation and its placement is not obvious, as in my case it was cutting too much - but it also seemed to work as when I expanded it, it was cutting less (nothing).

  • Options
    mlfarrellmlfarrell
    edited September 2016

    Yep. My code equivalent of what you did is the same. (async). Honestly, I think I just hit the LOD floor for the meshes. My concern now is to figure out how to get ANGLE's OpenGL to render 100,000 faces as fast as DirectX11 can which is a tall order without the use of min16float or multiple constant buffers. That or I'm gonna have to drop into DX11 directly and bypass angle just to render the spatial meshes, which isn't that great.

  • Options

    I also recognized this behavior. Also TryComputeLatestMeshAsync seems to completely ignore the maxTrianglesPerCubicMeter setting. However the Volumes out of your desired bounds can easily be ignored by the bounding volume given per mesh. To generate different amount of triangles within the Volume seems much more complex.

  • Options

    Are you using TryComputeLatestMeshAsync with or without SpatialSurfaceMeshOptions (I am using the one with SpatialSurfaceMeshOptions, had no time to try without SpatialSurfaceMeshOptions yet)

Sign In or Register to comment.