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:
- 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:
- Inside this, create three other folders called Images, Models, and Scripts:
- 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:
Here, we have all the elements we need to replicate our own AR project.
- Now, click on File|Save As... and save the scene inside the Assets|Scenes folder with the name ARScene:
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.