Understanding our AR scene

An AR scene has two main components that are common to any image-based AR SDK:

  • The ARCamera: The camera object that will receive the feed from the camera device and process those frames in search of the selected image (target).
  • The ImageTarget: The representation of the real image where we will put the virtual elements. When the camera finds this ImageTarget in the real world, it shows the virtual elements attached to it.

In EasyAR, we have three main elements (apart from the Directional Light):

  • The Main Camera, which is the element that will render the image coming from our mobile device.
  • EasyAR_Setup, which is in charge of the main operations of the app, such as initializing and handling the EasyAR engine, attaching the physical camera device to the Main Camera element of the scene, or implementing the image target detection and tracking through the ImageTracker:

The EasyAR_Setup element and its elements
  • ImageTarget, which is the representation of the image we want to recognize. It contains the virtual elements that will appear and disappear when the image is detected/lost in the real world. In this case, the ImageTarget already comes with two children: a Quad, which represents the image we will track, and a Cube, which we will use to initially test the scene. The values of the image to recognize appear in the Inspector window in the Image Target Controller, as shown in the following screenshot:

ImageTarget with its children on the left and the component values on the right

The parameters in the Image Target Controller are as follows: 

  • Target Name: The target's name. This doesn't have to be the image's name. 
  • Target Path: This is the full path to the image we want to use as a target. It's directly related to the Type option.
  • Target Size: Size of the target. We will usually leave it at 1.
  • Type: Whether the image of the target will be stored inside the assets of the project (specifically, the StreamingAssets folder, which we already have in our Project window) or if the Target Path is absolute.
  • Image Tracker: This is the ImageTracker that will search for this ImageTarget in the camera feed.
  • Target Type: Here, we will be using the first option, Local Image, since our image will be included locally inside the project.

Now that we have seen the main elements of the scene, the next thing we need to do is create our own target. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.142.115