# Plane Detection Sample

This sample demonstrates how to visualize tracked planes found in the real world. For basic information about custom trackable object updates and what Unreal Engine's AR Trackable Notify component does, please refer to the Unreal Engine documentation (opens new window).

# How the sample works

By default, when the sample is opened, it generates simple shapes for the detected planes. When the Use Convex Hull detection option is enabled, the sample generates complex shapes using the convex hull of the detected planes.

It's also possible to display the wireframe of these geometries.

Planes Detection UI

# Plane AR Manager

The BP_PlaneARManager blueprint file (located under SnapdragonSpacesSamples Content > SnapdragonSpaces > Samples > PlaneDetection > Placeable) centralizes the actions of creating and destroying planes as augmented geometries through an event system. This blueprint binds events from the AR Trackable Notify component (opens new window) to react to AR trackable planes changes. The following events are related to plane detection:

  • On Add/Update/Remove Tracked Plane: These events are called when the system is using simple plane geometry.
  • On Add/Update/Remove Tracked Geometry: These events are called when the system is using complex plane geometry.
    • In contrast to the other cases, different types of objects can be registered as UARTrackedGeometry. To verify that it is a convex plane, its object classification should be EARObjectClassification::NotApplicable. Please, use the GetObjectClassification function to make sure. Object classification for convex planes

WARNING

Remember to change the state of ToggleARCapture to restart the detection, selecting ON when the actor behavior begins, and stop the detection, selecting OFF when finished, to destroy all generated AR geometries.

# Complex AR Session Config

When the user enables the convex option, the system starts using the D_ConvexHullSessionConfig asset (located under SnapdragonSpacesSamples Content > SnapdragonSpaces > Samples > PlaneDetection > Core) to detect the complex planes.

The options related to plane detection are:

  • Use Convex Hull Detection
  • Horizontal Plane Detection
  • Vertical Plane Detection

# Feature Settings

Feature settings can be found by clicking the gear icon next to Plane Detection feature in the OpenXR project settings.

  • Use Scene Understanding:
    • Enabling or disabling this setting will have different results in terms of the shape and number of planes detected.
    • Enabling this setting will enable the use of Scene Understanding to detect planes. This makes use of the same technology used by the Spatial Meshing (Experimental) feature.

Differences Between Default and Scene Understanding-based Plane Detection

Metric Default Scene Understanding
Detection Speed and First Detection Normal Fast
False Positives Few false positives Prone to false positives
Plane Accuracy High High
Number of Planes Few Many
Plane Updates and Movement Stable with unlikely updates Dynamic with more plane updates
Plane Orientation Filter Filter options for horizontal and vertical No filter options
Hit Testing As expected against plane Hit test against mesh