Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. And always feel free to hit us up on Twitter @MxdRealityDev.


I have a Hololens application written in C++/WinRT that queries spatial surfaces using SpatialSurfaceObserver. For that, the App responds to ObservedSurfacesChanged event and there runs a function that obtains a list of spatial meshes with GetObservedSurfaces. Then, for each entry, a mesh is constructed and rendered.

I'm having issues with calls to GetObservedSurfaces. Measurements show, that it typically runs for 120-140 milliseconds. The first couple of runs after the application starts take almost 500 milliseconds. In itself, this could be acceptable. However, the call seems to block the entire application until it returns, which causes the render loop to drop several frames, ruining user experience. There is no locking that would freeze the application while MyApp::UpdateSpatialMeshes is running. If I replace the call auto surfaces = observer.GetObservedSurfaces(); with a simple one-second-long wait (and comment out everyting depending on surfaces), everything is fine no frame dropping occurs.

Does anyone have an idea why GetObservedSurfaces blocks my app or what I can do to use it more properly?

UPDATE: There are approx. 40 surface meshes in the returned collection, containing ~100k triangles.


winrt::Windows::Foundation::IAsyncAction MyApp::InitSurfaceObserver()
co_await winrt::resume_background();

auto status = co_await SpatialSurfaceObserver::RequestAccessAsync();
if (status == SpatialPerceptionAccessStatus::Allowed)
auto coordSys = m_stationaryReferenceFrame.CoordinateSystem();
m_surfaceObserver = SpatialSurfaceObserver();
m_surfaceObserver.ObservedSurfacesChanged([this](auto&& sender, auto&& args)
UpdateSpatialMeshes(m_surfaceObserver, coordSys); // runs in background

SpatialBoundingBox aabb = { { 0.0f,  0.0f, 0.0f }, { 20.0f, 20.0f, 5.0f } };
auto bounds = SpatialBoundingVolume::FromBox(coordSys, aabb);

// else: complain

winrt::fire_and_forget MyApp::UpdateSpatialMeshes(const SpatialCoordinateSystem& coordSys,
const SpatialSurfaceObserver& observer)
if (coordSys /* AND no other UpdateSpatialMeshes is currently running*/)
SpatialCoordinateSystem scs{ coordSys }; // back up the coordinate system
co_await winrt::resume_background();
auto surfaces = observer.GetObservedSurfaces(); // <<< FREEZES EVERYTHING

for (auto const& pair : surfaces)
  const GUID& id = pair.Key();
  auto surfaceInfo = pair.Value();
  if (!surfaceInfo) continue;
  // TryComputeLatestMeshAsync, then render


Sign In or Register to comment.