Home

Awesome

FindSurface-RealityKit-visionOS

CurvSurf FindSurfaceâ„¢ demo app for visionOS (Swift)

Overview

This demo app demonstrates a basic usage of FindSurface-visionOS package to search vertex points (provided by ARKit as meshes) for geometry shapes.

Requirements

This demo app runs on an Apple Vision Pro device only, and requires you permissions to track your hands and to scan your environment (world sensing) to operate as intended.

How to use

After starting the app, the floating panels (below) will appear on your right side, and you will see wireframe meshes that approximately describe your environments. Performing a spatial tap (tapping your thumb and index finger together) with staring at a location on the meshes will invoke FindSurface, with an indicator (blue disk) appearing on the surface you've gazed.

panels

Controls window for parameters

This panels provide you ways to control the app's behavior and information about geometries you've found. With the panels, you can perform the following actions:

For detailed explanations of the parameters, please refer to FindSurface.

For the recommended preset of the parameters, please refer to Optimal Parameter Set for Apple Vision Pro. In this app, the preset values are already set as the defaults (See AppStorage.swift file.)

Voice Control Supports (experimental)

Thanks to Apple's built-in accessibility supports in visionOS, it is possible to interact with some of UIs using voice commands.

Using the voice control for this app is experimental. It may not work as intended because we haven't complete the implementations for this feature.

In order to enable this feature, follow the instructions below:

  1. Go Settings in Apps screen.
  2. Tap Accessibility, Physical and Motor, and Voice Control.
  3. Enable Voice Control.
  4. Enable Play Sound if you want to get sound feedbacks when the system reacts to voice commands.

Here is what you can do with voice commands in the app:

You can see the names of UI controls that you can interact with using voice commands by saying "Show names". It will display the accessibility names of the views. Not all views having the names can interact using voice commands (i.e., Lat.Ext. and Rad.Exp..) Say "Hide names" if you don't want to see the names.

Results window

Whenever you invoke FindSurface and it succeeds, the information about the resulting geometry will be displayed in this window and in a small info panel floating near the geometry.

For simplicity, the information consists of numbers only, of which meaning can be interpreted as follows:

You can remove geometries separately by clicking the trash can button in the corner of the info panel.

App Scanning Boundary

This app limits the scanning range to a radius of 5 meters from the origin, which is the ground location where the app starts.

During our tests, we found that there can be performance issues when RealityKit has to render an excessive number of mesh entities. FindSurface can detect and measure shapes without rendering the meshes as long as it gets point clouds as inputs. However, we render them as a visual feedback for users to indicate whether SceneReconstructionProvider has sufficiently scanned the surrounding environment. We think that as the number of the entities increases, RealityKit might have to take excessive time to handle the entities for mesh visualization, leading to stuttering and an unpleasant user experience.

boundary.png

For a smooth experience in our demo app, we exclude MeshAnchor data if the anchor's position is beyond a certain range from the origin. The excluded data is not rendered nor included in FindSurface's input point cloud. When users approaches within 1.5 meters of this boundary, an orange fence of 1 meter height will be visualized. Moreover, if they get within 75 cm, a small warning message appears at the top of their sight (see the image above). These mechanisms are intended to ensure this app's rendering performance and appropriate level of user experiences and NOT related to user safety, despite the term safety being used in the source code.

These specific ranges are defined by several variables, including safetyDistance, at the top of the AppState.swift file. In case you need to bypass this limitation, you can change these values as you want or set them to a very large number to effectively disable this feature.