QR Code Tracking Sample
This sample demonstrates how to detect and track QR codes 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. In order to use this feature, it must be enabled in the OpenXR plugin settings located under Project Settings > Snapdragon Spaces plugin.
How the sample works
By default, when the sample is running and recognizes a QR code, it generates a data panel over the physical target and displays useful information about the QR below.
The user can verify the size of the QR recommended and supported Code Version from the UI panel included in the map.
- Maximum recognition distance decreases with higher QR code versions.
- To ensure recognition from a distance of 1 meter or more, it is recommended to use QR codes with a version number between 1 and 6.
- QR codes can be detected at a viewing angle of up to 45 degrees.
- There is limited support for artistic QR codes. To ensure recognition it is recommend to use the standard black on white rectangular module patterns. Logos are supported but GenAI QR codes are unlikely to work.
- It is recommend to print the QR code on non-reflective paper as this improves detection and decoding of QR codes.
- The QR code size should be measured without including silent regions, using the finder pattern as boundaries.
QR Code AR Manager
The BP_QrCodeTrackingManager blueprint asset (located under SnapdragonSpacesSamples Content > SnapdragonSpaces > Samples > QrCode > Placeable) handles creating and destroying BP_QRCodeDataWidget actors through an event system. It binds events coming from the AR Trackable Notify component to react to AR trackable QR code changes. When the system is detecting QR codes, it invokes the On Add/Update/Remove Tracked Image events and returns a Spaces AR Tracked QR object.
The Spaces AR Tracked QR is a Snapdragon Spaces object used in the plugin to extend the information tracked (as the Raw Data), and derived from AR Tracked QR Code. Unreal Engine allocates it to manage the QR code tracked.
In the sample blueprint, Toggle AR Capture has to be set to ON, if detection should start, and to OFF, if it should stop detecting targets and to destroy all generated AR QR codes. Toggle Spaces Feature can be used as an alternative way for enabling the feature. Additionally, QRCode must be set as the capture type of that node.
QR Code AR Session Config
The system starts using the default D_SpacesSessionConfig asset (located under SnapdragonSpacesSamples Content > SnapdragonSpaces > Common > Core) to detect the QR codes.
The session config file provides five fields: a field for specifying the maximum number of simultaneous images that should be tracked, a field to define the physical size (in meters) of the tracked QR codes, a field to add the minimum and maximum QR version supported.