Integrate SolAR pipelines in Unity Engine give 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 actual version (our test are based on) is 2018.2.16f1
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/2018.4/Documentation/Manual/
|If you are a Unity newbie, check tutos online 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 Assets
click on SolARPlugin_win.unitypackage
This package provides user with the minimum requirements to load a SolAR pipeline in Unity.
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).
SolARPlugin: Scripts for Editor inspector dedicated to the -SolARPipelineLoader_, and a build script to deploy the solution on various platforms
Prefabs: All the prefabs required to simply use SolAR in Unity.
Materials: Materials used to display the video stream of the camera in the background.
SolARPlugin: SolARPipelineLoader script
SolARPlugin: The c# scripts required by the SolARPipelineLoader automatically generated from SolAR C++ classes thanks to SWIG.
Shaders: Shaders used to display the video stream of the camera in the background.
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) 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 yor 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.
It is time now to download pipeline samples to test the SolAR plugin in Unity !
Download the SolAR package with samples:
click on Assets
click on SolARSamples_win.unitypackage
The samples will add or fill in the following folders in the Assets folder of your unity project:
Plugins : Host the binaries of the pipelines, their modules, and the third parties of the modules.
Objects : Some 3D objects to augment the scene.
Pipelines: The xml configuration files for the different SolAR pipelines. It is mandatory to put these pipeline configuration file in or under this folder.
Scenes: Sample scenes for simply testing the SolAR plugin.
Scripts: Specific scripts required for the sample.
CameraCalibration: Some camera calibration files used by the pipelines handling their own camera.
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.
Now you can load SolAR pipelines and choose one:
Select the SolARPipelineLoader object in your scene hierachy.
Click on the Select Pipelines Folder button in the inspector frame.
Select the folder /Assets/SolAR/Pipelines
Select the PipelineFiducialMarker.
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).
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.|
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 a virtual can 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 !