Integrating SolAR pipelines in Unity Engine gives opportunities to developers of
AR services to get access to fully configurable SolAR-based solutions to design AR applications.
SolAR has now a Plugin for Unity
Download the last version of Unity Hub. The hub gives you the possibility to get access to different versions of Unity.
Our current version (our tests are based on) is 2019.4.15f1
Interface to create a new Unity project
|It’s recommended that you use a 3D project set-up.|
All documentation for Unity is available here : https://docs.unity3d.com/2019.4/Documentation/Manual/
|If you are new to Unity, check online tutorials to help you.|
For users who want to simply design AR services: Choose a pipeline, configure it in the inspector, and experience AR at run-time.
Easy to use, understandable for everyone.
click on SolARUnityPackage.unitypackage
the file is downloaded, all you have left to do is to import it into Unity
This package provides user with the minimum requirements to load a SolAR pipeline in Unity and includes three pipelines (Fiducial marker, natural image marker, and a SLAM).
The plugin version will add the following hierarchy in the Assets folder of your unity project:
Plugins: Host the binaries of the SolAR Framework, of the the pipeline manager that will handle the load of SolAR pipelines as well as the relative third parties (boost and xpcf).
Materials: Materials used to display the video stream of the camera in the background.
Objects: Some 3D objects to augment the scene.
Prefabs: All the prefabs required to simply use SolAR in Unity.
Scenes: Sample scenes for simply testing the SolAR plugin.
Scripts: UI-related scripts for the demo.
Editor: scripts to control the pipeline manager appearance in the Inspector and customize build process for various platforms.
Pipelines: The xml configuration files for the different SolAR pipelines. It is mandatory to put these pipeline configuration file in or under this folder.
Scripts: various script to be able to use SolAR pipelines in Unity.
Swig: C# wrapper classes to expose SolAR native API, generated from C++ with SWIG.
Android: contains a file that lists all assets. Used by Android build to install app properly.
CameraCalibration: Some camera calibration files used by the pipelines handling their own camera.
FBOW: vocabulary files used by the SLAM pipeline.
Markers: files describing the markers. You can edit these files to provide the exact size of the markers defined in meters, or create them to add new markers.
The SolAR plugin for Unity is a simple interface to load any SolAR pipelines assembled by the SolAR pipeline assemblers and use them to design AR services with Unity.
To load a SolAR pipeline in Unity, simply drag and drop the SolARPipelineLoader prefab (in SolAR/Prefabs/novice) in your scene hierarchy. The SolARPipelineLoader has the following parameters:
Camera: is the virtual camera whose position and orientation will be automatically updated at runtime according to the camera pose computed by the SolAR pipeline.
Use Unity Webcam: Check it if you want to replace the camera used by the pipeline by a Unity camera. If checked, you will be able to select a camera among those available on your computer. For a better experience, you can set the intrinsic parameters of the camera. For that, you will need to calibrate it (see Camera Calibration).
Custom_Canvas: For video see-through AR, the system has to display the video stream of the camera on background. If unchecked, a Canvas with the video stream of the selected camera will be automatically created when the application will start. If you want to manage your canvas by yourself, you can check this option and drag and drop your canvas and its material.
Select Pipeline Folder: A button to select the folder where the available SolAR pipelines are stored in your Unity project. These pipelines must be stored anywhere under the folder Assets/SolAR/Pipelines/.
Set your SolARPipelineLoader by dragging and dropping your main camera from your scene hierarchy to the Camera parameter in the SolARPipelineLoader inspector.
Then you can put any object in your scene hierarchy to visualize it in augmentation (you can drag and drop the SolAR can available in the SolAR objects). The camera will automatically move relatively to the coordinate system of your marker (positionned in the center of the marker, x-axis pointing to the left, y-axis pointing to the top, z-axis pointing backward), so place your object in (0,0,0) if you want it to be positionned in the center of your marker.
For each object with a renderer, add the TAG SolARObject to make it disappear when the pose provided by the pipeline is wrong.
Simply load the sample scene Assets/SolAR/Demos/Scenes/NoviceVersion.
Now you can choose a SolAR pipeline among the fiducial, the natural image or the SLAM:
Select the SolARPipelineLoader object in your scene hierachy.
Select the PipelineFiducialMarker in the drop-down menu under the button Select Pipelines Folder.
You will see a list of parameters relative to the different components of the selected pipeline. A tooltip provides user with information relative to each parameter when he move the pointer over the parameter (only if the configuration file of the pipeline defines descriptions for the configuration parameters).
Finally, you can print the following fiducial marker, play the application, and present the marker in front of the camera. That’s it, you should visualize the SolAR robot appearing on your fiducial marker.
Now, stop the application, select the SolARPipelineLoader object in your scene hierarchy, and select the PipelineNaturalImageMarker. Print the following image marker, and play the application. Changing pipeline is as simple as that !