Saturday 14 May 2016

Augmented Reality in Unity3d with ARToolKit(Open Source)

What is Augmented Reality?
     Augmented reality (AR) is a live direct or indirect view of a physical, real-world environment whose elements are augmented (or supplemented) by computer-generated sensory input such as sound, video, graphics or GPS data. It is related to a more general concept called mediated reality, in which a view of reality is modified (possibly even diminished rather than augmented) by a computer.

AR Today

The most common definition of AR to date is a digital overlay on top of the real world, consisting of computer graphics, text, video, and audio, which is interactive in real time. This is experienced through a smartphone, tablet, computer, or AR eyewear equipped with software and a camera.



ARToolKit(Open Source)

ARToolKit is an open-source computer tracking library for creation of strong augmented reality applications that overlay virtual imagery on the real world. 

  • major platform support enables a wide range of applications Compiled SDKs for iOS, Android, Linux, Windows and Mac OS X all ready to download and use.
  • Includes OpenGL ES2.x support, integration with GPS and compass, and automatic camera calibration utilities.
  • ARToolKit includes stereo and optical see-through support, is integrated with a range of smart glasses, and allows easy calibration for new devices.     



Unity 3D Engine

Unity is a cross-platform game engine developed by Unity Technologies and used to develop video games for PC, consoles, mobile devices and websites.

Guidelines for developing AR apps in ARToolkit with Unity,

Step 1:
From below link you can able to download ARToolKit Installation file and Tools for unity3d,
http://artoolkit.org/download-artoolkit-sdk

Step 2:
After Installing ARToolKit, Create own marker for tracking(NFT) via command prompt
  1. Select image which you need to track and then go to command prompt--> choose a path C:\Program Files (x86)\ARToolKit5\bin in your system.(Note:Its for latest version of ARToolKit). copy this text and paste like (cd C:\Program Files (x86)\ARToolKit5\bin)



       2. Now, type genTexData.exe and give space and add your marker image path. For example, I am giving some image to generate NFT marker.


3. We need to provide extraction level for tracking features. It is default = 2, I given 4. And then,
Need to provide extraction level for initializing features to 3. And enter the DPI resolution for specified image.(Given 300);



4. After given DPI resolution for image, the set files will be generate accordingly.

5. After creating set files add those files into unity editor --> StreamingAssets
6. Check Display Feature Set for specified image in cmd dispFeatureSet.exe. It is using to find out the feature points on image.

Step 3:
  1. In unity3d editor, Import ARToolKit Package and then create new scene File-->New Scene--> save scene name to SampleScene.
  2. Remove MainCamera and Add Empty gameobject, rename it to ARToolKit and Add script (ARController and ARMarker).
  3. Find video configuration field and Add -device=WinMF this media foundation using for tracking marker at runtime.
  4. Find ARMarker script(same gameobject) and change Type to NFT. And NFT dataset name should be mention in what you had in streamingassets. The name should be same as in StreamingAssets.