Building image-based AR

You can build AR using different techniques; the most common one is image-based AR, which consists of tracking a previously selected image (target) and superposing the virtual content to it while taking into account the image's position, rotation, and size. This kind of tracking requires the use of different algorithms that differentiate images one from another through characteristic points of the design, and position the image in three dimensions on the camera feed. Don't worry—EasyAR will do this work for you. All you will need to do is decide which images will act as the targets and what virtual content will go on top of them. 

To create this project, we will use EasyAR's ImageTarget sample project as a reference since it already has all the components we need for our app. But before we start with the AR elements, we will set up our project folders:

  1. The first thing we are going to do is create our personal Assets folder, @MyAssets, to differentiate it from the rest of the assets we've imported into Unity. Here, we will add all the external resources, such as marker images and 3D models. For that, right-click on the Project window and select Create|Folder. Name it @MyAssets:

Create a new folder under the main Assets folder and call it @MyAssets
  1. Inside this, create three other folders called Images, Models, and Scripts:
@MyAssets folder with the three folders inside it
Note: This project currently has six folders under the Assets folder. As you can see, projects tend to increase in size quickly and before we realize it, our resources are lost in the chaos of folders and files. Taking a couple of minutes to create a basic structure for our project folders is always good practice.
  1. Now, we can create our AR scene. As we mentioned earlier, we will use EasyAR's sample scene as a reference. To do that, from the Project window, double-click on the HelloAR_ImageTarget scene located at Assets|Samples|Scenes to open it:

The HelloAR_ImageTarget sample scene

Here, we have all the elements we need to replicate our own AR project. 

  1. Now, click on File|Save As... and save the scene inside the Assets|Scenes folder with the name ARScene:

Saving the scene with another name

By doing this, we've created a duplicate of the sample scene. If anything happens to our scene, we can always go back to the original one.

Now that we have the initial scene, we can take a look at each component and customize them for our needs.

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

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