Tutorial of NyARToolkit for Unity With Unity-chan

This tutorial describes the basic process of dealing with the 3D model with the NyARToolkit for Unity.

There are 4 steps.

  • Preparlation of the environment
  • Require hardware and data
  • Modify SimpleNFT code.
  • Test program
  • How to make NFT dataset

Preparlation of the environment

There are preparation before development.

  1. Create a new Unity project
  2. Import NyARToolkit for Unity package
  3. Import SDUnityChan package

Create a new Unity project

Create an empty new Unity project. (Require Unity 5.3.4 or later.)



Import NyARToolkit for Unity package

Download NyARToolkit for Unity, and drag and drop it to Unity IDE.


Import SDUnityChan package

Download SDUnityChan, and drag and drop it to Unity IDE.

The project will be following image after 2 packages were imported.



Require hardware and data

A list of required things other than computer.

  1. Webcamera
  2. A paper that is printed Unity licence logo.
  3. Nft dataset that made from Unity licence ligo.


Must be connected a webcam to the computer. It is not nesseccary if your computer has internal camera device.

A paper that is printed Unity licence logo, and the NftDatset

These can also be made from the Unity logo image. Howeber for simplity, please download zip file that containe set the necessary data on this tutorial.

Print UCLlogo180mm.pdf to A4 paper. It is Unity licence logo in 180mm width.

The NftDataset is unitychan.nftdataset. It is contained with same zipfile.

Check “Neft dataset that made from Unity licence logo” paragraph if you want to make a dataset.


Test program

From here is the main.
Modify sample/SimpleNft scine to display Unity-chan on the captured image.


Edit Object tree

Open SimpleNft scene. Next, expand MarkerObject node and delete cube object.


In UnityChan/SD_unitychan/Prefab, drag SD_unitychan_humanoid prefab and drop in MarkerObject. MarkerObject is updated automaticary by marker transform matrix. The objects placed under MarkerObject is displayed on Nft target.


Copy NFT dataset file

NFT data is unitychan.nftdataset that is in the unitychan-demodata.zip.
unitychan.nftdataset is NFT data set file made from 180mm width Unity license logo.
Replaced it if you have your own data.

First, change file extention to .bytes from .nftdataset. It is necessary in order to read binary file by Unity.

Next, drag unitychan.bytes and drop to Asser/Resource directory. It is able to read file from Unity.


Setting for Unity

In NyARToolkit for Unity, the scale unit of Markerobject is treated as 1mm.
In addition, the coordinates is expressed in the XY direction. And the origin is the lower left corner of the image.

Adjust the position and size of the Unity-chan to center of logo.

Remove the SpringManager check because it does not work correctly.



Edit source code

Finally, change two point on sourcecode.
In SimpleNFT directory, open NftCameraBehaviour.cs file.

Change NFT dataset

Change nftdataset name to infinitycat from unitychan. And change the image width to 180[mm] from 160.


Remove Cube related line

Remove a cuble related line.




After complete, press the play button of Unity. Capture Unity logo image into the camera. Since the unity license logo is a little difficult to recognize. Hold the camera so that the entire logo captured.



How to make NFT dataset

You can NFT dataset from general image by tool program.

The tool is NftFileGenerator.jar. It is placed in Data/tool directory.
Open Assert directory by Explorer etc.

wp-image-1764″ src=”http://nyatla.jp/nyartoolkit/wp/wp-content/uploads/12.png” alt=”12″ width=”635″ height=”165″ />

In windows, click .bat file. other environment, open the terminal and type a command below.

java -jar NftFileGenerator.jar

After run the tool, Open a source image. Select Import from menu, and select LoadImage.
Next, push MakeFeatureSet button.


Dataset generation takes a few minutes.
When complete, feature points are displayedu


Finally, save dataset file. Select Export -> NyARTK NFT dataset file from menu. (NyARToolkit for Unity can not handle files that wrote by “Save Feature Set File”.)


Dataset parameters

  • SourceDPI – This is main image DPI. Normally, do not need to change.
  • Iset DPIs – Set of pyramid image resolutions. AUTO means auto caluclation from SourceDPI. Custom means manual setting which wrote in lower CSV. Normally, do not need to change.
  • FSET parametor – Parametor of tracking feature points detection.(red square)In proportion to the size of lv, feature points detected is incremented. Adjust when the feature points is too much / too little.

Should be restrict a size of image under VGA size. Large image will take a long time.
If you want to use a large image, use from shrinking.

High contrast image such as Unity licence logo is poor for detection.
Neture image are more good for NFT.




NyARToolkitCS/Unity 5.0.8

NyARToolkitCS/5.0.8 and  NyARToolkit for Unity/5.0.8 were been released.



NyARToolkiyCS can be developed VisualStadio2013  environment.

Download zip file from release page. It contains Solution and projects.


The sample project of NFT is a SimpleNFT. NFT target image is infinitycat.pdf.  it located in Data directory.

The program structure is similar with marker based program.
In case of NFT, use the NFT target data instead of MarkerData.


NyARToolkit for Unity

NyARToolkiy for Unity can be developed Unity 5.3   environment.UnityPackage can be download from release.


NFT sample is located in SimpleNFT directory. The target image(infinitycat.pdf) is located in Data directory.

NyARToolkit for Java 5.0.0

NyARToolkit for Java 5.0.0 has been released.

NyARToolkit 5.0.0 supports the natural features tracking which is same as implemented on ARToolKit5 (NFT) .

The development of NyARToolKit5 has received the funding and technical assistance by DAQRI LLC.
I’m grateful to DAQRI LLC and ARToolKit team.

How to running NFT sample

  1. Checkout NyARToolKit from Github.
  2. Import NyARToolkit projects to Eclipse. Make sure that there are no errors in the project shown in .
  3. Print NFT image  to paper. If you do not have a printer, display the pdf file into the screen.
  4. Connect your webcam to computer.
  5. Run NftSimpleLite.java in NyARToolkit.sample.jogl package.
  6. It takes a few seconds to startup. When you take a picture with the camera, The color cube will display on image.

NFT Programming

NFT programming with NyARToolkit is simply.
It requires only a few dozen lines of code.

NftSimpleLite.java is a template of NFT application. You can create the unique application by modify the template.

public class NftSimpleLite extends GlSketch
  String nftdataset="d:\\infinitycat";
  String cparam="../../Data/testcase/camera_para5.dat";
  private Webcam camera;
  private NyARGlNftSystem nyar;
  private NyARGlRender render;
  private NyARSensor sensor;
  public void setup(GL gl)throws Exception
    NyARNftSystemConfig config = new NyARNftSystemConfig(new FileInputStream(cparam),640,480);
    this.camera.setViewSize(new Dimension(640,480));
    this.nyar=new NyARGlNftSystem(config);   //create MarkerSystem
    this.render=new NyARGlRender(this.nyar);
    this.sensor=new NyARSensor(config.getScreenSize());
  private int id;
  public void draw(GL gl)throws Exception
      try {
        this.sensor.update(new NyARBufferedImageRaster(this.camera.getImage()));        
      } catch (Exception e) {
  public static void main(String[] args)
    new NftSimpleLite().run();
  • How to change the tracking image file?
    →Change nftdataset value. In NFT, it need to place 3 files(.iset, .fset, .fset3) onto same path.
    For example: If you specify “d \\ example”, “c:\\ example.iset”, “c:\\ example.fset”, “c:\\example.fset3” will be used as a tracking image.
  • How to change the tracking image size?
    →Set the paper image width in mm to the second parameter of addNftTarget function.
  • How to make the tracking image set file?
    →NftFileGenerator.jar is a fileset generator.
    Download NyARToolkit.utility.zip from the following URL.

For compatibility with ARToolKit5

Calculation algorithm of NyARToolKit is identical to the ARToolKit5 but there is a slight difference.
The cause of the difference are the accuracy of floating-point calculations, and the simplification of  the math functions.

The NyARToolKit and ARToolKit data files(iset fset fset3) are compatible.
These files can be used with each other.










  1. プライベートIDマーカ(一意にIDを識別できないマーカ)
  2. グローバルIDマーカ(一意にIDを識別できるマーカ)