ARToolKit 6: A Fast & Modern Open Source AR SDK
DAQRI company announces a new milestone in the project augmented reality tools open source ARToolKit. The Americans started to open beta ARToolKit 6 on Linux, Android, iOS, macOS, and Unity. New updates abound functional part and distributed Apache v2.0 license so that developers can create their own applications with minimal licensing restrictions.
Research Lab DAQRI added in a new engine resolver visual images, which can work without a connection to the network and tracker tracking methods combining such as P3P and optical flow for a more reliable reading key.
The system recognizes and track supports multiple images based on detection initialization at speeds of tens of milliseconds. Calibration, identification, and tracking of fully autonomous kept up to hundreds of detected images; working dynamic loading and saving individual images or sets.
ARTOOlkit For Unity:
ARToolKit for Unity brings the full functionality of ARToolKit into the Unity3D visual development environment. It consists of a set of Unity script components which integrate seamlessly with your Unity project, native plugins which implement the underlying core functionality, and a set of examples and accompanying resources that act as starting points.
System Requirements (Development & Deployment)
- Mac OS X min. Sierra (version 10.12.3) or Windows 10
- X-Code min. Version 8.2.1
- Android Studio v2.1 and later with Android NDK r12b and later
- Unity3D Version 5.5.X, the free, Personal Edition, is sufficient for a start: ( Unity3D IDE be installed on a macOS X, Support for ARToolKit6 for Unity3D IDE on Windows 10 is under test and is forthcoming)
- The Unity3D plugin of ARToolKit6: ARUnity6.unitypackage
Development Requirements / Supported Target Platforms:
- iOS v7.0 and later (armv7, armv7s, arm64)
- Android v4.0.3 and later (armeabi-v7a, x86)
- MacOS v10.7 and later (x86_64)
- Linux v2.6 and later (x86_64)
Let’s Start Developing an application using ARToolKit + Unity
As a quick start with Unity3D and ARToolKit6, we are using one of the example scenes shipped with the ARUnity6.unitypackage. This Tutorial describes how to create and demonstrate augment reality application using the Unity3D IDE and the ARToolKit6 for Unity SDK.
For the first tutorial, we’re going start from scratch and create an application that recognizes an image exposed to the computer’s/Mobile’s camera, tracks the image and augments a 3D model in the video feed over the tracked image.
Prerequisite (Tools Needed):
As discussed earlier Support for ARToolKit6 for Unity and the Unity3D IDE on Windows 10 is under test and is forthcoming. “MacOS Unity3D IDE” is recommended.
- If you intend to build and deploy on Android, you’ll need to install Android SDK, which must include the NDK, Android Studio or Android command-line tools (for example, the Android ADB).
- If you intend to build and deploy on iOS you’ll need to install XCode.
Here in this tutorial, we are targeting Android as a deployment Platform, We will be using ARToolkit-6 AR SDK and Unity 3D engine and Android SDK for this tutorial. Make sure you have downloaded the following before proceeding further.
- Unity Engine (Version 5.6.1P1 I’m using now)
- ARToolkit 6.0.2 Beta SDK for Unity( ARToolkit-Unity 6.0.2-Development)
- ARToolkit 6.0.2 Beta for macOS (Camera Calibration and ImageTarget Manager for OS-X)
- Android SDK & Android Studio (Optional)
- Java Development Kit (JDK)
Step by Step Implementation
1. Setup a Simple Unity Project:
- Unity is a powerful and widely used game engine. Let’s start by creating a new Unity3D project by the name of “ARToolKit6_ImageTarget”. (Disable Unity Analytics for now)
- Start Unity and enter a project name, browse to a location, enable the 3D radio button and click ‘Create Project’ button.
2. Download ARToolkit 6 Beta SDK Unity Extension and ARToolkit 6 Beta SDK for macOS:
Go to “http://artoolkit.org/download.html” and download ARToolkit 6 Beta SDK for Unity ( ARToolkit-Unity 6.0.2-Development) Unity Extension and ARToolkit 6 Beta for macOS (Camera Calibration and ImageTarget Manager for OS-X)
3. Install ARToolkit 6 macOS Beta SDK on your Mac machine:
- Open download folder and run “ARToolKit for macOS v6.0.2.dmg” on your Mac Machine.
- Once make sure that “ARToolKit for macOS “ properly get installed on your MacBook.
- Now navigate to “/Applications/artoolkit6/SDK/Applications/” through your Finder and open “ARToolKit6 Image Database Utility”
- “ARToolKit6 Image Database Utility” is an offline utility provided by ARToolkit-6 which help us to create/manage ImageTarget Database.
4. Import the ARToolKit Unity packages inside Unity Project:
- Import the ARToolKit Unity Extension/ARToolKit SDK (ARUnity6-6.0.2-dev.unitypackage) which we just downloaded in Prerequisites section.
- This can be done by importing custom UnityPackage, here I stored it inside ARToolKit_SDK folder in my machine.
- To import a new custom package:
- Choose Assets > Import Package > Custom Package… to bring up File Explorer (Windows) or Finder (Mac).
- Select the package you want from Explorer or Finder, and the Import Unity Package dialog box displays, with all the items in the package pre-checked, ready to install.
- Select Import and Unity puts the contents of the package into the Assets folder, which you can access from your Project View.
- If any “API Update” related dialog box appears, just click on “I Made a Backup” and go ahead.
5. Open Unity-Scene “2DTrackerTest” from ARToolkit inside Unity Project:
- Open Scene ‘2DTrackerTest’ inside Project window
- Project >> Test Scene >>2DTrackerTest.unity
- Then you are now able to see some game objects “ARToolkit“, “ISceneRoot“, “Marker scene 0” etc. inside Hierarchy window
- Delete “Marker scene 0”, “Marker scene 2”, “Marker scene 3” from Hierarchy window as shown in fig. below.
6. Import 3D model (Spider) from Unity Assets Store:
Now the fun part begins!!! let’s download 3D model with some animations for our augmented reality. For this tutorial, we choose oneGreen Spider from Unity Asset Store (free).
- You can open the Asset Store window by selecting ‘Window > Asset Store’ from the main menu. On your first visit, you will be prompted to create a free user account which you will use to access the Store subsequently.
- Navigate to: ‘Window > Asse Store’ OR Select ‘Asset Sore Tab’
- In Asset Store window search for the keyword “Spider Green” and download the same, as shown in the screenshot below.
7. Add 3D model (Spider) Inside ImageTarget in Unity Scene
Afterward, we introduce our 3D model (downloaded from Asset Store) into parent ImageTarget, to do this:
- Expand ‘Spider Green’ folder inside Unity Project window
- For the 3D Spider to appear over ImageTarget/Marker, it needs to be made a child of “Marker scene1” (can be done by just dragging the SPIDER prefab in the Hierarchy panel).
- Then, whenever the ImageTarget is detected by a mobile device’s camera, all the children of the target will also appear together.
- Simply Drag & Drop SPIDER prefab inside ‘Marker scene 1’ in Hierarchy window.
- Delete all ‘Cylinder’ and ‘Cone’ GameObjects from Hierarchy window as shown in fig. below.
- Setup Spider Prefab: For ‘Spider’ 3d model maintain the Position, Rotation & Scale properties (mostly default)
- Position: X=0, Y=0, Z=0
- Rotation: X=-99.9, Y=0, Z=0
- Scale: X=0.03, Y=0.03, Z=0.03
NOTE: This AR app will work on ImageTarget/Marker_Image even with a black and white image of the stones because the feature points will still remain (they usually depend on other factors like gradient, etc. instead of color).
You can download Marker Image ARToolKit_Marker_Alterra.jpg From Github. The target image is required that your computer’s camera will recognize and track while demonstrating ARToolKit6 Augmented Realty example applications.
8. Android Deployment Setup to Run App on Device:
We are almost done. Let’s save the scene: File >> Save Scene and move towards deployment step.
The last step is to build the project for Android. We need to go to “File >> Build Settings”. We need to add the current scene by selecting “Add Open Scene”. Then, we need to select a platform (Android) and then select “Switch Platform“. Here, we will have multiple options:
- Export Project: This will allow us to export the current Unity project to Android Studio so it can be edited and used to add more elements.
- Development Build: Enabling this will enable Profiler functionality and also make the Autoconnect Profiler and Script Debugging options available.
Unity provides a number of settings when building for Android devices – select from the menu (File > Build Settings… > Player Settings…) to see/modify the current settings.
Before pressing the Build And Run, we need to make some more changes in the “Player Settings” options in the Inspector panel.
- The Company Name needs to be changed; e.g. to “ARReverie”.
- Need to change the “Package Name” under “Identification” say, to “com.arreverie.artoolkitdemo”.
Now, we can proceed to “Build and Run”. Other changes like Minimum API Level etc. can be made as per additional requirements. We will need to connect an Android mobile device via USB and enable USB debugging.
NOTE: We will also need to have an Android developer environment set up before we can test our Unity games on the device. This involves downloading and installing the Android SDK with the different Android platforms and adding our physical device to our system (this is done a bit differently depending on whether we are developing on Windows or Mac).
If you get stuck at any point or want to view the source code, you can find it on Github. You can click on the link below to download respective content:
You can click on the link below to download respective content:
Do you have any questions about this tutorial? Do you have any suggestions for a new AR tutorial? Let me know in the comments section below.
Best of luck 🙂