New technology that displays digital content in real world is Augmented Reality. In this blog we are going to learn about displaying 3D model on image target usingEasy AR in unity 3D. The video below will help you for better understanding of this blog.
For better understanding make sure to read the previous blog i.e. DISPLAY 3D MODEL ON IMAGE TARGET USING VUFORIA IN UNITY3D.
Create a new unity project:
In augmented reality creating a new unity project requires some of the things to be done. For creating a new unity project you need to write project name and then click on create project.
Go to EasyAR:
After creating new unity project, we need to go to EasyAR and go to download. After that go to unity packages and click on EasyAR Sense 3.0.1- final Basic_unity.zip and download it.
Now we need to go back to the develop center and add SDK License Key.
Check in the EasyAR SDK Basic and write the name in ” APP Name”. We are making for Android. That’s why we are writing package name as com-zeanex. easyar test. Now click on confirm.
Go back to unity:
Go back to unity and go to file. After go to file we need to click on build settings and change the platform to android. Click on switch platform and then go to player settings. In player settings go to other settings and paste the package name. For pasting the package name, copy the package name from easy AR and paste the package name in unity.
Copy and Paste License Key:
Now go back and import that which you have downloaded. After that drag in assets folder in unity and click on import. Its imported now. Click on Easy AR then click on common. After clicking on common, click on resources. Now click on Easy AR and then click on inspector. Go back to the website of Easy AR and copy that key which we have created and paste that key in the script in the Inspector.
Dragging Image Target:
Now go back to the assets and go to samples. Then go to scenes and drag Hello AR_ Image Target to assets.
Importing Image Target:
Now open assets and double click on it. As the scene is now open click on image target and delete the Quad and Cube. Import the image target which you want to show on the 3d model. We are dragging it to the streaming assets folder. Now click on streaming assets and you can see that the image is imported in it. Now click on image target and name the image target. Write the same name of image target in Target Path.
But in target path make sure that you have write the correct extension in target path. Our target image is in “.jpeg”. Now go back to assets.
Importing the Model:
Now import the model which you want to show on the image target. After importing open that model and drag the model on to the image target. Now we have to scale it as 0.04 in the x, y and z axis. I am rotating the x axis to 270. You can set the positions and rotations according to your choice.
From top menu click on file, then click on build settings. Check the platform is android if not switch it. And then click on add open scenes. Now click on player settings. Go to other settings. Change the package name according to your choice. Unchecked x86 and Android TV compatibility. Change the stripping level to low. Click on XR settings and make sure vuforia augmented reality is selected. And then you can insert the icon of your app. That’s all for settings now connect your android mobile with your computer and click on build and run. Now name it and save it.