Working with Nreal Devices

EasyAR and Nreal SDK

Most EasyAR features and Nreal features are not overlapped. So EasyAR do not delegate Nreal functionalities in most cases. When you need to use some Nreal features like gesture recognition, you need to follow the way Nreal officially offers, and learn usages and application scope of these features from Nreal official.

To EasyAR, Nreal SDK offers motion tracking capability on their devices, and this is the only feature EasyAR take use of from Nreal. Please read Motion Tracking and EasyAR Features for the relationship between EasyAR and motion tracking, and which EasyAR features can be used when motion tracking is available.

To Nreal, it does not use EasyAR to make devices to work. EasyAR adds more possibilities to Nreal in some scenarios.

Nreal SDK Versions Supported by EasyAR

The Plugin support Nreal SDK 1.6.0 or later.

A future Nreal SDK release may also be supported if its interfaces used by EasyAR did not change. For small changes in those interfaces, you can modify NrealFrameSource script before an update is released by EasyAR.

Nreal support is implemented as EasyAR Sense custom camera. Personal edition users can use EasyAR for 100 seconds per run when custom camera is chosen in runtime. There is no limitation when using a paid license for EasyAR Sense.

Import Nreal SDK

Get unitypackage file of Nreal SDK from Nreal, and use Unity > Assets > Import Package to import Nreal SDK.

../_images/image_g5_7.png

Make sure Nreal demo works correctly

If this is the first time using Nreal SDK in present project, make sure to use Nreal SDK demo first without EasyAR. Nreal demo require some special project settings, please follow official documents.

Before using EasyAR, make sure RGBCamera and a few other related demo from Nreal can run normally. EasyAR require input from RGBCamera. Many other demos does not use RGBCamera, so Nreal itself or these samples can work and display contents is not enough to say the device or project is ready for EasyAR.

Tips: EasyAR sample put a canvas in front of camera which will show up if the Nreal SDK is correctly configured. If you see nothing when running EasyAR samples, it is quite possible the Nreal SDK is not correctly configured and the Nreal demo will fail to run reasonablely. You need to fix all errors showed by nreal menu NRSDK > Project Tips in some versions of Nreal SDK.

Import EasyAR Sense Unity Plugin

Use Unity’s Package Manager window to install the plugin from a local tarball file.

../_images/image_s0_1.png

Choose the com.easyar.sense-*.tgz file in the popup dialogue.

Import EasyAR Sense Unity Plugin Nreal Extension

Use Unity’s Package Manager window to install the plugin from a local tarball file.

../_images/image_g5_6.png

Choose the com.easyar.sense.ext.nreal-*.tgz file in the popup dialogue.

Import and Use Samples

Please read How to use Mega Unity development samples (in Chinese) when using EasyAR Mega. The following sample description is for the cases not using Mega.

The samples are distributed within the plugin package. You can import samples into your project using Unity’s Package Manager window.

../_images/image_g5_8.png

To be noteiced, these samples are inside EasyAR Sense Unity Plugin Nreal Extension package instead of EasyAR Sense Unity Plugin pacage.

Please make sure that Nreal can work correctly follow official instructions before use EasyAR samples.

The sample usages are the same with other EasyAR samples except above description. You can reference How to Use Samples for details.

Sample Introduction

Please read Mega Unity development samples instruction when using EasyAR Mega.

SpatialMap_Building sample demonstrates a very simple scenario to make SpatialMap work under Nreal.

ImageTracking_InWorld sample demonstrates how to use EasyAR Motion Fusion to enhance image tracking when using Nreal.

Add EasyAR Support in Nreal Scene

Prepare a Usable Nreal Scene

In the next section, a usable Nreal scene is required. Create a scene usable on Nreal according to Nreal documents or its demos. You can also use its demo directly.

Add EasyAR Components in the Scene

Add EasyAR AR Session in the scene. AR Session can be created from some AR Session presets using EasyAR Sense > Ext: Nreal > * GameObject menu.

../_images/image_g5_1.png

You can also assemble AR Session by yourself if necessary. Make sure the assembled AR Session has NrealFrameSource in it.

To use EasyAR on Nreal, NrealFrameSource must be selected as frame source in the AR Session after Session start.

This could usually be done by set ARComponentPicker.FrameSource to FirstAvailableActiveChild and make sure NrealFrameSource is the first frame source in transform order,

../_images/image_g5_2.png

Or set ARComponentPicker.FrameSource to Specify and specify the frame source to NrealFrameSource .

../_images/image_g5_3.png

Then add targets or maps in the scene, for example, if you want to build Sparse SpatialMap, you need to create SparseSpatialMapController by EasyAR Sense > SpatialMap > Map : Sparse SpatialMap

../_images/image_g5_9.png

Finally, a simple scene for sparse spatial map building on Nreal could look like this,

../_images/image_g5_5.png

Scenes can be different according to features in use from both Nreal SDK and EasyAR Sense Unity Plugin.

Add Nreal Support in EasyAR Scene

Prepare a Usable EasyAR Scene

In the next section, a usable EasyAR scene is required. You can reference How to Use Samples to use a sample, or create a new scene reference Start from Zero.

Delete Main Camera

There is already a camera inside Nreal objects, so you need to delete camera in the scene in most cases.

../_images/image_g5_10.png

You can also judge if the deletion is needed according to your needs in some advanced usages.

Add EasyAR Components for Nreal support in the Scene

Add NrealFrameSource in AR Session. Select AR Session (EasyAR) or Frame Source Group, and add using EasyAR Sense > Ext: Nreal > Frame Source : Nreal.

../_images/image_g5_11.png

Moge NrealFrameSource to be the first,

../_images/image_g5_12.png

In some advanced usages, you can also move it to where you want, or change the order in scripts.

To use EasyAR on Nreal, NrealFrameSource must be selected as frame source in the AR Session after Session start.

This could usually be done by set ARComponentPicker.FrameSource to FirstAvailableActiveChild and make sure NrealFrameSource is the first frame source in transform order,

../_images/image_g5_2.png

Or set ARComponentPicker.FrameSource to Specify and specify the frame source to NrealFrameSource .

../_images/image_g5_3.png

Add Nreal Components in the Scene

You can follow Nreal documents to add Nreal components in the scene.

In most of the cases, you need to add a NRCameraRig prefab (follow Nreal official instructions if there are any conflicts).

../_images/image_g5_13.png

Finally, a simple scene for sparse spatial map building on Nreal could look like this,

../_images/image_g5_5.png

Scenes can be different according to features in use from both Nreal SDK and EasyAR Sense Unity Plugin.

Before run on a device, make sure to read Nreal official instructions for how to configure and run a scene containing Nreal SDK.